public void Save(MES_M001_Order order, List <MES_M001_Order_Detail> orderDetailList) { tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; var existsorder = this.GetById(order.Id); if (existsorder == null) { order.CompCode = tempUser.CompCode; order.CreateDt = DateTime.Now; order.CreateUser = tempUser.UserName; order.Validate(); this.MES_M001_OrderRepository.Add(order); } else { order.ModifyDt = DateTime.Now; order.ModifyUser = tempUser.UserName; order.Validate(); this.MES_M001_OrderRepository.SetValues(order, existsorder); } if (orderDetailList != null) { foreach (var orderDetail in orderDetailList) { var existstorderDetail = this.orderDetailRepository.GetByID(orderDetail.Id); if (existstorderDetail == null) { orderDetail.CompCode = tempUser.CompCode; orderDetail.CreateDt = DateTime.Now; orderDetail.CreateUser = tempUser.UserName; orderDetail.Validate(); this.orderDetailRepository.Add(orderDetail); } else { orderDetail.ModifyDt = DateTime.Now; orderDetail.ModifyUser = tempUser.UserName; orderDetail.Validate(); this.orderDetailRepository.SetValues(orderDetail, existstorderDetail); } } } this.runtimeService.Commit(); }
public void Create(MES_M001_Order MES_M001_Order) { MES_M001_Order.CreateDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; MES_M001_Order.CreateUser = tempUser.UserName; MES_M001_Order.CompCode = tempUser.CompCode; MES_M001_Order.Validate(); this.MES_M001_OrderRepository.Add(MES_M001_Order); this.runtimeService.Commit(); }
public void Update(MES_M001_Order MES_M001_Order) { MES_M001_Order.ModifyDt = DateTime.Now; tb_Sys_User tempUser = appCacheService.GetItem("user") as tb_Sys_User; MES_M001_Order.ModifyUser = tempUser.UserName; MES_M001_Order.Validate(); var existstb_Sys_Menu = this.GetById(MES_M001_Order.Id); this.MES_M001_OrderRepository.SetValues(MES_M001_Order, existstb_Sys_Menu); this.runtimeService.Commit(); }