public void TestUpdateAttached() { List <Comprehensive> lists1 = new List <Comprehensive>(); Comprehensive c1 = new Comprehensive() { 统一编号 = "370101040001", 称 = "西蒋峪村北侧地面塌陷00000000", 灾害类型 = EnumGeoDisasterType.DebrisFlow, GBCodeId = "370101", 地理位置 = "西蒋峪村北侧地面塌陷333", DebrisFlow = new DebrisFlow() { 野外编号 = "ccccccccc", // 统一编号 = "370101040001", }, }; lists1.Add(c1); PhyGeoDisaster phy1 = new PhyGeoDisaster() { Comprehensives = lists1 }; this._service.UpdateRelationAttached(phy1); }
//[ExpectedException(typeof(Exception))] public void TestNewPhySet() { //IDbContext db = new R2DisasterContext(); //IRepository<Comprehensive> re = new EFRepository<Comprehensive>(db); //IComprehensiveService s = new ComprehensiveService(re); //InvestigationController c = new InvestigationController(s); //string a=null; //c.GetCompleteByUId(a); List <Comprehensive> lists1 = new List <Comprehensive>(); List <Comprehensive> lists2 = new List <Comprehensive>(); Comprehensive c1 = new Comprehensive() { 统一编号 = "370101040001", 称 = "西蒋峪村北侧地面塌陷333", 灾害类型 = EnumGeoDisasterType.DebrisFlow, GBCodeId = "370101", 地理位置 = "西蒋峪村北侧地面塌陷333", DebrisFlow = new DebrisFlow() { 野外编号 = "dsadfasdfasfd", // 统一编号 = "370101040001", } }; Comprehensive c2 = new Comprehensive() { 统一编号 = "370101040002", 称 = "西蒋峪村北侧地面塌陷333", 灾害类型 = EnumGeoDisasterType.DebrisFlow, GBCodeId = "370101", 地理位置 = "西蒋峪村北侧地面塌陷333", DebrisFlow = new DebrisFlow() { 野外编号 = "dsadfasdfasfd", // 统一编号 = "370101040001", } }; lists1.Add(c1); lists2.Add(c2); PhyGeoDisaster phy1 = new PhyGeoDisaster() { Comprehensives = lists1 }; PhyGeoDisaster phy2 = new PhyGeoDisaster() { Comprehensives = lists2 }; List <Object> ids = this._controller.NewSet(new List <PhyGeoDisaster>() { phy1, phy2 }); Assert.IsNotNull(ids); Assert.AreNotEqual(0, ids.Count); Assert.AreNotEqual(null, ids[0]); }
public void Test_Insert() { List <Comprehensive> lists = new List <Comprehensive>(); Comprehensive c = new Comprehensive() { 统一编号 = "370101040001", 称 = "西蒋峪村北侧地面塌陷333", 灾害类型 = EnumGeoDisasterType.DebrisFlow, GBCodeId = "370101", 地理位置 = "西蒋峪村北侧地面塌陷333", DebrisFlow = new DebrisFlow() { 野外编号 = "dsadfasdfasfd", // 统一编号 = "370101040001", } }; lists.Add(c); PhyGeoDisaster phy = new PhyGeoDisaster() { Comprehensives = lists }; this._service.New(phy); }
public void TestComprehensiveToComprehensiveModel() { Comprehensive c = this._serviceCpl.Get(1); Mapper.CreateMap <Comprehensive, ComprehensiveSimplify>(); ComprehensiveSimplify model = Mapper.Map <ComprehensiveSimplify>(c); // model = Mapper.Map(c.PhyGeoDisaster, model); }
public void Test_QueryByUnifieldId() { IDbContext db = new R2DisasterContext(); IRepository <Comprehensive> re = new EFRepository <Comprehensive>(db); IComprehensiveService service = new ComprehensiveService(re); string id = "370101060001"; Comprehensive c = service.GetByUnifiedID(id); }
public async Task <IActionResult> Comprehensives([FromBody] Comprehensive c) { if (!ModelState.IsValid) { return(Failure("Invalid model")); } c.created = DateTime.Now; c.modified = DateTime.Now; c.createdby = User.Identity.Name; c.modifiedby = User.Identity.Name; _db.Comprehensives.Add(c); return(await Save()); }
public void TestSample() { Comprehensive cmp = new Comprehensive() { 称 = "1111", //PhyGeoDisaster = new PhyGeoDisaster() //{ // Location="dddddd" //} }; Mapper.CreateMap <Comprehensive, ComprehensiveSimplify>(); ComprehensiveSimplify model = Mapper.Map <ComprehensiveSimplify>(cmp); Assert.AreEqual("1111", model.称); Assert.AreEqual("dddddd", model.地理位置); }
public void Test_InsertComperhensive() { List <Comprehensive> lists = new List <Comprehensive>(); Comprehensive c = new Comprehensive() { 统一编号 = "370101040001", 称 = "西蒋峪村北侧地面塌陷333", 灾害类型 = EnumGeoDisasterType.DebrisFlow, GBCodeId = "370101", 地理位置 = "西蒋峪村北侧地面塌陷333", DebrisFlow = new DebrisFlow() { 野外编号 = "dsadfasdfasfd", // 统一编号 = "370101040001", } }; lists.Add(c); PhyGeoDisaster phy = new PhyGeoDisaster() { Comprehensives = lists }; this._service.New(c); // Comprehensive c1 = new Comprehensive() // { // 统一编号 = "370101040004", // 名称 = "西蒋峪村北侧地面塌陷77777", // 灾害类型 = "塌陷", // 国标代码 = "370101", // LandSubsidence = new LandSubsidence() // { // 统一编号 = "370101040001", // 名称 = "西蒋峪村北侧地面塌陷333" // } // }; //this._service.New(c); // this._service.New(c1); }
public void InitSampleData() { PhyGeoDisaster phy = new PhyGeoDisaster() { GBCodeId = "370101", Location = "西蒋峪村北侧", DisasterType = EnumGeoDisasterType.DebrisFlow, Name = "西蒋峪村北侧地面塌陷333", }; Comprehensive c = new Comprehensive() { 统一编号 = "370101040001", 称 = "西蒋峪村北侧地面塌陷333", 地理位置 = "西蒋峪村北侧", GBCodeId = "370101", 险情等级 = " 大型", //DebrisFlow = new DebrisFlow() //{ // 室内编号="3333333" //} }; PhyGeoDisaster phy1 = new PhyGeoDisaster() { GBCodeId = "370101", Location = "西蒋峪村北侧", DisasterType = EnumGeoDisasterType.LandFracture, Name = "东凤凰村地裂缝33", DamageReports = new List <DamageReport>() { new DamageReport() { 发生时间 = DateTime.Now, 灾险情地点 = "安城镇东凤凰村西南", }, new DamageReport() { 发生时间 = DateTime.Now.AddDays(1.5), 灾险情地点 = "安城镇东凤凰村西南", } }, EmergencySurveys = new List <EmergencySurvey>() { new EmergencySurvey() { 应急调查点 = "甘井子区南关岭街道大北技校修配厂斜坡" }, new EmergencySurvey() { 应急调查点 = "甘井子区南关岭街道大北技校修配厂斜坡" } }, //PrePlan = new PrePlan() //{ // 名称 = "菜园子同益乡政府东斜坡111111", //}, //MassPre = new MassPre() //{ // 名称 = "甘井子区南关岭街道大北技校修配厂斜坡", // 统一编号="370101" //} }; Comprehensive c1 = new Comprehensive() { 统一编号 = "370101060001", 称 = "东凤凰村地裂缝33", 地理位置 = "西蒋峪村北侧", GBCodeId = "370101", 灾害类型 = EnumGeoDisasterType.LandFracture, 险情等级 = "大型", //LandFracture = new LandFracture() //{ // //统一编号 = "370101060001", // //名称 = "东凤凰村地裂缝33" // //地理位置 = "安城镇东凤凰村西南", // 野外编号 = "dddddddd", //} }; //phy1.Comprehensive = c1; //phy.Comprehensive = c; this._service.New(phy); this._service.New(phy1); //Comprehensive c2 = this._re.GetById(1); //PrePlan p = new PrePlan() //{ //// Comprehensive = c2, // 名称 = "菜园子同益乡政府东斜坡77777777", //}; //IRepository<PrePlan> rePre = new EFRepository<PrePlan>(this._db); //rePre.Insert(p); }
private bool IsShow; //构件信息展示标识 void Awake() { instance = this; }