/// <summary> /// 修改 /// </summary> public FineOffice.Modules.OA_Contract Update(FineOffice.Modules.OA_Contract model) { dal.Initialization(); FineOffice.Entity.OA_Contract entity = new Entity.OA_Contract { ID = model.ID, Content = model.Content, ContractName = model.ContractName, ContractNO = model.ContractNO, EndDate = model.EndDate, Handler = model.Handler, Location = model.Location, SingnDate = model.SingnDate, TraderID = model.TraderID, TypeID = model.TypeID, Remark = model.Remark }; dal.Update(entity); dal.Dispose(); return(this.GetModel(l => l.ID == entity.ID)); }
/// <summary> /// 返回一个model /// </summary> /// <returns></returns> public FineOffice.Modules.OA_Contract GetModel(System.Linq.Expressions.Expression <Func <FineOffice.Modules.OA_Contract, bool> > expression) { dal.Initialization(); FineOffice.Modules.OA_Contract model = (from entity in dal.GetTable() select new FineOffice.Modules.OA_Contract { ID = entity.ID, Content = entity.Content, ContractName = entity.ContractName, ContractNO = entity.ContractNO, EndDate = entity.EndDate, TraderName = entity.CRM_Trader == null ? null : entity.CRM_Trader.TraderName, HandlerName = entity.HR_Personnel == null ? null : entity.HR_Personnel.Name, Handler = entity.Handler, Location = entity.Location, SingnDate = entity.SingnDate, TraderID = entity.TraderID, TypeID = entity.TypeID, Remark = entity.Remark }).Where(expression).FirstOrDefault(); dal.Dispose(); return(model); }