public void Delete(Dingdan dingdan) { DingdanDataModel model = NHibernateHelper.CurrentSession.Get <DingdanDataModel>(dingdan.Id); NHibernateHelper.CurrentSession.Delete(model); NHibernateHelper.CurrentSession.Flush(); }
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 void Update(Dingdan dingdan) { DingdanDataModel model = NHibernateHelper.CurrentSession.Get <DingdanDataModel>(dingdan.Id); this.SetModel(model, dingdan); NHibernateHelper.CurrentSession.Update(model); NHibernateHelper.CurrentSession.Flush(); }
public void Insert(Dingdan dingdan) { DingdanDataModel model = new DingdanDataModel(); this.SetModel(model, dingdan); NHibernateHelper.CurrentSession.Save(model); NHibernateHelper.CurrentSession.Flush(); }