From 257bf48a4fc11025c295728d7ee19ee38573a372 Mon Sep 17 00:00:00 2001 From: falcon <9504402@qq.com> Date: Tue, 26 Mar 2019 13:49:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84HIS=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebSiteCode/Cmdjy/Cmdjy.sln | 15 ++++++-------- WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj | 3 +-- WebSiteCode/Cmdjy/Cmdjy/Dal/Configuration.cs | 2 +- .../Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs | 20 ------------------- .../Dal/Wappers/HisPrescriptyInfoWapper.cs | 18 ----------------- WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs | 7 ++++++- WebSiteCode/Cmdjy/Cmdjy/Web.config | 3 ++- .../Cmdjy/Cmdjy/ws/HisInterface.asmx.cs | 7 ++++--- .../Cmdjy/CmdjyTests/Bll/ObjExtendTests.cs | 1 + .../Cmdjy/CmdjyTests/CmdjyTests.csproj | 4 ++++ 10 files changed, 25 insertions(+), 55 deletions(-) delete mode 100644 WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs delete mode 100644 WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs diff --git a/WebSiteCode/Cmdjy/Cmdjy.sln b/WebSiteCode/Cmdjy/Cmdjy.sln index 644eb56..e542739 100644 --- a/WebSiteCode/Cmdjy/Cmdjy.sln +++ b/WebSiteCode/Cmdjy/Cmdjy.sln @@ -7,15 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cmdjy", "Cmdjy\Cmdjy.csproj EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmdjyTests", "CmdjyTests\CmdjyTests.csproj", "{812C9905-9C11-40FD-B58F-02C8A880C494}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmdjyHisFront", "CmdjyHisFront\CmdjyHisFront.csproj", "{E8B0B70C-74D8-419D-94DD-19FF4015C23B}" - ProjectSection(ProjectDependencies) = postProject - {03F35833-1CF9-42BC-BF51-444F7181A967} = {03F35833-1CF9-42BC-BF51-444F7181A967} - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HisInterfaceModels", "HisInterfaceModels\HisInterfaceModels.csproj", "{D0FE758C-DA33-45C7-8110-563056A58717}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonHelper", "CommonHelper\CommonHelper.csproj", "{AA5638CD-29E5-48E7-96F2-F3A32D42BE9F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CmdjyHisFront", "CmdjyHisFront\CmdjyHisFront.csproj", "{E8B0B70C-74D8-419D-94DD-19FF4015C23B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,10 +27,6 @@ Global {812C9905-9C11-40FD-B58F-02C8A880C494}.Debug|Any CPU.Build.0 = Debug|Any CPU {812C9905-9C11-40FD-B58F-02C8A880C494}.Release|Any CPU.ActiveCfg = Release|Any CPU {812C9905-9C11-40FD-B58F-02C8A880C494}.Release|Any CPU.Build.0 = Release|Any CPU - {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Release|Any CPU.Build.0 = Release|Any CPU {D0FE758C-DA33-45C7-8110-563056A58717}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D0FE758C-DA33-45C7-8110-563056A58717}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0FE758C-DA33-45C7-8110-563056A58717}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -42,6 +35,10 @@ Global {AA5638CD-29E5-48E7-96F2-F3A32D42BE9F}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA5638CD-29E5-48E7-96F2-F3A32D42BE9F}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA5638CD-29E5-48E7-96F2-F3A32D42BE9F}.Release|Any CPU.Build.0 = Release|Any CPU + {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8B0B70C-74D8-419D-94DD-19FF4015C23B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj index c78f2d8..b25cc6c 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj +++ b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj @@ -204,8 +204,6 @@ - - @@ -283,6 +281,7 @@ + diff --git a/WebSiteCode/Cmdjy/Cmdjy/Dal/Configuration.cs b/WebSiteCode/Cmdjy/Cmdjy/Dal/Configuration.cs index 56f709c..1e4d453 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Dal/Configuration.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/Dal/Configuration.cs @@ -5,7 +5,7 @@ namespace Cmdjy.Dal internal partial class Configuration:DbMigrationsConfiguration { public Configuration() { - AutomaticMigrationsEnabled = WebSettings.AutoMigrations; + AutomaticMigrationsEnabled = true; AutomaticMigrationDataLossAllowed = false; } diff --git a/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs b/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs deleted file mode 100644 index 0c92f39..0000000 --- a/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs +++ /dev/null @@ -1,20 +0,0 @@ -using HisInterfaceModels; - -namespace Cmdjy.Dal.Wappers -{ - /// - /// 药品信息墙纸 - /// - public class HisDrugInfoWapper:Dal.Tables.HisDrugInfo - { - public HisDrugInfoWapper(HisDrugInfo s) { - if(s == null) return; - foreach(var p in s.GetType().GetProperties()) { - var tp = this.GetType().GetProperty(p.Name); - if(tp != null && tp.CanWrite && p.CanRead) { - tp.SetValue(this,p.GetValue(s)); - } - } - } - } -} \ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs b/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs deleted file mode 100644 index 4eecd79..0000000 --- a/WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisPrescriptyInfoWapper.cs +++ /dev/null @@ -1,18 +0,0 @@ -using HisInterfaceModels; - -namespace Cmdjy.Dal.Wappers -{ - public class HisPrescriptyInfoWapper:Dal.Tables.HisPrescriptionInfo - { - public HisPrescriptyInfoWapper() { } - public HisPrescriptyInfoWapper(HisPrescriptionInfo s) { - if(s == null) return; - foreach(var p in s.GetType().GetProperties()) { - var tp = this.GetType().GetProperty(p.Name); - if(tp != null && tp.CanWrite && p.CanRead) { - tp.SetValue(this,p.GetValue(s)); - } - } - } - } -} \ No newline at end of file diff --git a/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs b/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs index 7476c9a..65c9a72 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs @@ -9,7 +9,12 @@ namespace Cmdjy public class MvcApplication:System.Web.HttpApplication { protected void Application_Start() { - Database.SetInitializer(new MigrateDatabaseToLatestVersion()); + if(WebSettings.AutoMigrations) { + Database.SetInitializer(new MigrateDatabaseToLatestVersion()); + } + else { + Database.SetInitializer(null); + } AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); diff --git a/WebSiteCode/Cmdjy/Cmdjy/Web.config b/WebSiteCode/Cmdjy/Cmdjy/Web.config index 1a21447..a26bd82 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Web.config +++ b/WebSiteCode/Cmdjy/Cmdjy/Web.config @@ -24,7 +24,8 @@ - + + diff --git a/WebSiteCode/Cmdjy/Cmdjy/ws/HisInterface.asmx.cs b/WebSiteCode/Cmdjy/Cmdjy/ws/HisInterface.asmx.cs index 6f38399..080f247 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/ws/HisInterface.asmx.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/ws/HisInterface.asmx.cs @@ -2,9 +2,9 @@ using System.Data.Entity; using System.Web.Services; using Cmdjy.Dal; -using Cmdjy.Dal.Wappers; using HisInterfaceModels; using Newtonsoft.Json; +using CommonHelper; namespace Cmdjy.ws { @@ -29,7 +29,8 @@ namespace Cmdjy.ws }; } using(var db = DbContextFactory.CreateDbContext()) { - var en = new HisPrescriptyInfoWapper(info) as Dal.Tables.HisPrescriptionInfo; + var en = new Dal.Tables.HisPrescriptionInfo(); + en.CopyFrom(info); en.RawAddress = this.Context.Request.UserHostAddress; en.CreateDatetime = DateTime.Now; db.Entry(en).State = EntityState.Added; @@ -62,7 +63,7 @@ namespace Cmdjy.ws } using(var db = DbContextFactory.CreateDbContext()) { - var en = new HisDrugInfoWapper(info) as Dal.Tables.HisDrugInfo; + var en = new Dal.Tables.HisDrugInfo().CopyFrom(info); en.RawAddress = this.Context.Request.UserHostAddress; en.CreateDatetime = DateTime.Now; db.Entry(en).State = EntityState.Added; diff --git a/WebSiteCode/Cmdjy/CmdjyTests/Bll/ObjExtendTests.cs b/WebSiteCode/Cmdjy/CmdjyTests/Bll/ObjExtendTests.cs index a73e928..e21e301 100644 --- a/WebSiteCode/Cmdjy/CmdjyTests/Bll/ObjExtendTests.cs +++ b/WebSiteCode/Cmdjy/CmdjyTests/Bll/ObjExtendTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using CommonHelper; namespace Cmdjy.Bll.Tests { diff --git a/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj b/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj index 37e9e93..baab2e4 100644 --- a/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj +++ b/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj @@ -84,6 +84,10 @@ {03F35833-1CF9-42BC-BF51-444F7181A967} Cmdjy + + {aa5638cd-29e5-48e7-96f2-f3a32d42be9f} + CommonHelper + {d0fe758c-da33-45c7-8110-563056a58717} HisInterfaceModels