public void Create(MES_M201_Plan MES_M201_Plan) { MES_M201_Plan.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; MES_M201_Plan.CreateUser = tempUser.UserName; MES_M201_Plan.Validate(); this.MES_M201_PlanRepository.Add(MES_M201_Plan); this.runtimeService.Commit(); }
public void Update(MES_M201_Plan MES_M201_Plan) { MES_M201_Plan.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; MES_M201_Plan.ModifyUser = tempUser.UserName; MES_M201_Plan.Validate(); var existstb_Sys_Menu = this.GetById(MES_M201_Plan.Id); this.MES_M201_PlanRepository.SetValues(MES_M201_Plan, existstb_Sys_Menu); this.runtimeService.Commit(); }
public void Save(MES_M201_Plan plan, List <MES_M201_Plan_Detail> productList, List <MES_M201_Plan_Daily> planDailyList) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsplan = this.GetById(plan.Id); if (existsplan == null) { plan.CompCode = tempUser.CompCode; plan.CreateDt = DateTime.Now; plan.CreateUser = tempUser.UserName; plan.Validate(); this.MES_M201_PlanRepository.Add(plan); } else { plan.ModifyDt = DateTime.Now; plan.ModifyUser = tempUser.UserName; plan.Validate(); this.MES_M201_PlanRepository.SetValues(plan, existsplan); } foreach (var product in productList) { var existsmatSupp = planDetailRepository.GetByID(product.Id); if (existsmatSupp == null) { product.CompCode = tempUser.CompCode; product.CreateDt = DateTime.Now; product.CreateUser = tempUser.UserName; product.PLNo = plan.PLNo; product.PlanId = plan.Id; product.Validate(); this.planDetailRepository.Add(product); } else { product.ModifyDt = DateTime.Now; product.ModifyUser = tempUser.UserName; product.Validate(); this.planDetailRepository.SetValues(product, existsmatSupp); } } foreach (var planDaily in planDailyList) { var existsmatSupp = planDailyRepository.GetByID(planDaily.Id); if (existsmatSupp == null) { planDaily.CompCode = tempUser.CompCode; planDaily.PLNo = plan.PLNo; planDaily.Validate(); this.planDailyRepository.Add(planDaily); } else { planDaily.Validate(); this.planDailyRepository.SetValues(planDaily, existsmatSupp); } } this.runtimeService.Commit(); }