private void SetModel(DingdanDataModel model, Dingdan dingdan) { ClassPropertyHelper.ChangeProperty(model, dingdan); model.Yewuyuan = dingdan.Yewuyuan.Account; model.KehuId = dingdan.Kehu.Id; model.MingxiListJson = JsonConvert.SerializeObject(dingdan.MingxiList.Select(m => this.GetMingxiModel(m)).ToList()); model.ShoukuanListJson = JsonConvert.SerializeObject(dingdan.ShoukuanList.Select(s => new ShoukuanDataModel(s)).ToList()); }
public DingdanMingxiBaseModel(DingdanMingxi mingxi) { ClassPropertyHelper.ChangeProperty(this, mingxi); this.danwei = mingxi.Chanpin.Danwei; this.guige = mingxi.Chanpin.Guige; this.xinghao = mingxi.Chanpin.Xinghao; this.chanpin = new ChanpinInputModel(mingxi.Chanpin); }
private DingdanMingxiDataModel GetMingxiModel(DingdanMingxi mingxi) { DingdanMingxiDataModel model = new DingdanMingxiDataModel(); ClassPropertyHelper.ChangeProperty(model, mingxi); model.ChanpinId = mingxi.Chanpin.Id; return(model); }
private DingdanMingxi CreateDingdanMingxi(Dingdan dingdan, DingdanMingxiDetailsModel detailsModel) { DingdanMingxiCreateInfo mingxiInfo = new DingdanMingxiCreateInfo(); ClassPropertyHelper.ChangeProperty(mingxiInfo, detailsModel); mingxiInfo.Dingdan = dingdan; mingxiInfo.Chanpin = this._coreManager.ChanpinManager.GetChanpinById(detailsModel.chanpin.id); return(new DingdanMingxi(mingxiInfo)); }
public ShoukuanGridModel(Shoukuan shoukuan) { ClassPropertyHelper.ChangeProperty(this, shoukuan); this.dingdanhao = shoukuan.Dingdan.Danhao; this.yewuyuan = shoukuan.Dingdan.Yewuyuan.Name; this.jiekuanRiqi = shoukuan.Dingdan.JiekuanRiqi; this.xiadanRiqi = shoukuan.Dingdan.XiadanRiqi; this.kehu = shoukuan.Dingdan.Kehu.Name; }
private Shoukuan CreateShoukuan(Dingdan dingdan, ShoukuanDetailsModel detailsModel) { ShoukuanCreateInfo shoukuanCreateInfo = new ShoukuanCreateInfo(); shoukuanCreateInfo.Dingdan = dingdan; ClassPropertyHelper.ChangeProperty(shoukuanCreateInfo, detailsModel); Shoukuan shoukuan = new Shoukuan(shoukuanCreateInfo); return(shoukuan); }
public List <DingdanGridModel> GetDingdan(DingdanFilterModel model, out int totalCount) { DingdanFilter filter = new DingdanFilter(); ClassPropertyHelper.ChangeProperty(filter, model); filter.KeywordRegex = RegexHelper.GetRegexList(model.keyword); int skipCount = model.start; List <Dingdan> dingdanList = this._coreManager.DingdanManager.GetDingdan(filter); totalCount = dingdanList.Count; return(dingdanList.Skip(skipCount).Take(model.size).Select(k => new DingdanGridModel(k)).ToList()); }
public void Load() { List <ChanpinDataModel> models = NHibernateHelper.CurrentSession.QueryOver <ChanpinDataModel>().List().ToList(); if (models != null) { models.ForEach(m => { Chanpin chanpin = new Chanpin(); ClassPropertyHelper.ChangeProperty(chanpin, m); this._coreManager.ChanpinManager.Add(chanpin); }); } }
public DingdanDetailsModel(Dingdan chanpin) { ClassPropertyHelper.ChangeProperty(this, chanpin); this.kehu = new KehuInputModel { id = chanpin.Kehu.Id, name = chanpin.Kehu.Name }; this.yewuyuan = new UserInputModel(chanpin.Yewuyuan); this.jiekuanFangshi = chanpin.JiekuanFangshi; this.mingxiList = chanpin.MingxiList.Select(m => new DingdanMingxiDetailsModel(m)).ToList(); if (chanpin.ShoukuanList != null) { this.shoukuanList = chanpin.ShoukuanList.Select(m => new ShoukuanDetailsModel(m)).ToList(); } }
public void Load() { List <KehuDataModel> models = NHibernateHelper.CurrentSession.QueryOver <KehuDataModel>().List().ToList(); if (models != null) { models.ForEach(m => { Kehu kehu = new Kehu(); ClassPropertyHelper.ChangeProperty(kehu, m); kehu.Yewuyuan = this._coreManager.OrgManager.UserManager.GetUserByAccount(m.Yewuyuan); this._coreManager.KehuManager.Add(kehu); }); } }
public ShoukuanListModel GetShoukuan(ShoukuanFilterModel filterModel) { ShoukuanListModel listModel = new ShoukuanListModel(); ShoukuanFilter filter = new ShoukuanFilter(); ClassPropertyHelper.ChangeProperty(filter, filterModel); filter.KeywordRegex = RegexHelper.GetRegexList(filterModel.keyword); int skipCount = filterModel.start; List <Shoukuan> shoukuanList = this._coreManager.DingdanManager.GetShoukuan(filter); listModel.totalCount = shoukuanList.Count; listModel.shoukuanJineSum = shoukuanList.Sum(m => m.ShoukuanJine); listModel.tichengSum = Math.Round(shoukuanList.Sum(m => m.Ticheng), 2); listModel.shoukuanList = shoukuanList.Skip(skipCount).Take(filterModel.size).Select(m => new ShoukuanGridModel(m)).ToList(); return(listModel); }
private List <Shoukuan> CreateShoukuanList(Dingdan dingdan, List <ShoukuanDataModel> models) { List <Shoukuan> mingxiList = new List <Shoukuan>(); if (models != null) { foreach (ShoukuanDataModel model in models) { ShoukuanCreateInfo createInfo = new ShoukuanCreateInfo(); ClassPropertyHelper.ChangeProperty(createInfo, model); createInfo.Dingdan = dingdan; Shoukuan shoukuan = new Shoukuan(createInfo); mingxiList.Add(shoukuan); } } return(mingxiList); }
private List <DingdanMingxi> CreateDingdanMingxiList(Dingdan dingdan, List <DingdanMingxiDataModel> models) { List <DingdanMingxi> mingxiList = new List <DingdanMingxi>(); if (models != null) { foreach (DingdanMingxiDataModel model in models) { DingdanMingxiCreateInfo createInfo = new DingdanMingxiCreateInfo(); createInfo.Dingdan = dingdan; createInfo.Chanpin = this._coreManager.ChanpinManager.GetChanpinById(model.ChanpinId); ClassPropertyHelper.ChangeProperty(createInfo, model); DingdanMingxi mingxi = new DingdanMingxi(createInfo); mingxiList.Add(mingxi); } } return(mingxiList); }
public DingdanMingxiListModel GetDingdanMingxi(DingdanMingxiFilterModel filterModel) { DingdanMingxiListModel listModel = new DingdanMingxiListModel(); DingdanMingxiFilter filter = new DingdanMingxiFilter(); ClassPropertyHelper.ChangeProperty(filter, filterModel); filter.KeywordRegex = RegexHelper.GetRegexList(filterModel.keyword); int skipCount = filterModel.start; List <DingdanMingxi> dingdanMingxiList = this._coreManager.DingdanManager.GetDingdanMingxi(filter); listModel.totalCount = dingdanMingxiList.Count; listModel.zongjineSum = Math.Round(dingdanMingxiList.Sum(m => m.Zongjine), 2); listModel.yewufeiSum = Math.Round(dingdanMingxiList.Sum(m => m.Yewufei), 2); listModel.tichengSum = Math.Round(dingdanMingxiList.Sum(m => m.Ticheng), 2); listModel.fahuoJineSum = Math.Round(dingdanMingxiList.Sum(m => m.FahuoJine.HasValue ? m.FahuoJine.Value : 0), 2); listModel.dingdanMingxiList = dingdanMingxiList.Skip(skipCount).Take(filterModel.size).Select(m => new DingdanMingxiGridModel(m)).ToList(); return(listModel); }
public DingdanListModel GetDingdan(DingdanFilterModel filterModel) { DingdanListModel listModel = new DingdanListModel(); DingdanFilter filter = new DingdanFilter(); filter.KeywordRegex = RegexHelper.GetRegexList(filterModel.keyword); ClassPropertyHelper.ChangeProperty(filter, filterModel); int skipCount = filterModel.start; List <Dingdan> dingdanList = this._coreManager.DingdanManager.GetDingdan(filter); listModel.tichengSum = dingdanList.Sum(d => d.Ticheng); listModel.totalCount = dingdanList.Count; listModel.weishoukuanJineSum = dingdanList.Sum(d => d.WeishoukuanJine); listModel.yingshoukuanJineSum = dingdanList.Sum(d => d.YingshoukuanJine); listModel.yishoukuanJineSum = dingdanList.Sum(d => d.YishoukuanJine); listModel.dingdanList = dingdanList.Skip(skipCount).Take(filterModel.size).Select(k => new DingdanGridModel(k)).ToList(); return(listModel); }
public void Load() { List <DingdanDataModel> models = NHibernateHelper.CurrentSession.QueryOver <DingdanDataModel>().List().ToList(); if (models != null) { models.ForEach(m => { DingdanCreateInfo createInfo = new DingdanCreateInfo(); ClassPropertyHelper.ChangeProperty(createInfo, m); createInfo.Yewuyuan = this._coreManager.OrgManager.UserManager.GetUserByAccount(m.Yewuyuan); createInfo.Kehu = this._coreManager.KehuManager.GetKehuById(m.KehuId); Dingdan dingdan = new Dingdan(createInfo); DingdanChangeInfo changeInfo = new DingdanChangeInfo(dingdan); changeInfo.MingxiList = this.CreateDingdanMingxiList(dingdan, JsonConvertHelper.TryDeserializeObject <List <DingdanMingxiDataModel> >(m.MingxiListJson)); changeInfo.ShoukuanList = this.CreateShoukuanList(dingdan, JsonConvertHelper.TryDeserializeObject <List <ShoukuanDataModel> >(m.ShoukuanListJson)); dingdan.Change(changeInfo); this._coreManager.DingdanManager.Add(dingdan); }); } }
public void TestChangeProperty() { C1 c1 = new C1(); c1.p1 = "11"; c1.p3 = new List <string> { "1", "2" }; C2 c2 = new C2(); ClassPropertyHelper.ChangeProperty(c2, c1); TestHelper.AreEqual(c1, c2); C4 c4 = new C4(); ClassPropertyHelper.ChangeProperty(c4, c1); TestHelper.AreEqual(c1, c4); ClassPropertyHelper.ChangeProperty(c1, c4); TestHelper.AreEqual(c1, c4); }
private Dingdan CreateDingdan(DingdanDetailsModel createModel) { DingdanCreateInfo createInfo = new DingdanCreateInfo(); ClassPropertyHelper.ChangeProperty(createInfo, createModel); createInfo.Id = Guid.NewGuid().ToString(); createInfo.Kehu = this._coreManager.KehuManager.GetKehuById(createModel.kehu.id); createInfo.Yewuyuan = this._coreManager.OrgManager.UserManager.GetUserByAccount(createModel.yewuyuan.account); createInfo.CreateTime = DateTime.Now; Dingdan dingdan = new Dingdan(createInfo); DingdanChangeInfo changeInfo = new DingdanChangeInfo(dingdan); if (createModel.mingxiList != null) { changeInfo.MingxiList = createModel.mingxiList.Select(m => this.CreateDingdanMingxi(dingdan, m)).ToList(); } if (createModel.shoukuanList != null) { changeInfo.ShoukuanList = createModel.shoukuanList.Select(m => this.CreateShoukuan(dingdan, m)).ToList(); } dingdan.Change(changeInfo); return(dingdan); }
public void Change(DingdanDetailsModel changeModel) { Dingdan dingdan = this._coreManager.DingdanManager.GetDingdanById(changeModel.id); DingdanChangeInfo backupChangeInfo = new DingdanChangeInfo(dingdan); try { DingdanChangeInfo changeInfo = new DingdanChangeInfo(dingdan); ClassPropertyHelper.ChangeProperty(changeInfo, changeModel); changeInfo.Yewuyuan = this._coreManager.OrgManager.UserManager.GetUserByAccount(changeModel.yewuyuan.account); changeInfo.Kehu = this._coreManager.KehuManager.GetKehuById(changeModel.kehu.id); changeInfo.MingxiList = changeModel.mingxiList.Select(m => this.CreateDingdanMingxi(dingdan, m)).ToList(); changeInfo.ShoukuanList = changeModel.shoukuanList.Select(m => this.CreateShoukuan(dingdan, m)).ToList(); //update dingdan.Change(changeInfo); this._dataManager.DingdanDataProvider.Update(dingdan); } catch { dingdan.Change(backupChangeInfo); throw; } }
public ShoukuanDetailsModel(Shoukuan shoukuan) { ClassPropertyHelper.ChangeProperty(this, shoukuan); }
public ChanpinBaseModel(Chanpin chanpin) { ClassPropertyHelper.ChangeProperty(this, chanpin); }
private void SetKehuInfo(Kehu kehu, KehuDetailsModel detailsModel) { ClassPropertyHelper.ChangeProperty(kehu, detailsModel); kehu.Yewuyuan = this._coreManager.OrgManager.UserManager.GetUserByAccount(detailsModel.yewuyuan.account); }
public KehuBaseModel(Kehu kehu) { ClassPropertyHelper.ChangeProperty(this, kehu); }
private void SetChanpinInfo(Chanpin chanpin, ChanpinDetailsModel detailsModel) { ClassPropertyHelper.ChangeProperty(chanpin, detailsModel); }
private void SetModel(KehuDataModel model, Kehu kehu) { ClassPropertyHelper.ChangeProperty(model, kehu); model.Yewuyuan = kehu.Yewuyuan.Account; }
private void SetModel(ChanpinDataModel model, Chanpin chanpin) { ClassPropertyHelper.ChangeProperty(model, chanpin); }
public DingdanGridModel(Dingdan chanpin) { ClassPropertyHelper.ChangeProperty(this, chanpin); this.kehu = chanpin.Kehu.Name; this.yewuyuan = chanpin.Yewuyuan.Name; }