public OrderStageEntity GetOrderStageByID(string stageid, string processid, string clientid) { if (string.IsNullOrEmpty(stageid) || string.IsNullOrEmpty(processid)) { return(null); } var list = GetOrderStages(processid, clientid); if (list.Where(m => m.StageID == stageid).Count() > 0) { return(list.Where(m => m.StageID == stageid).FirstOrDefault()); } OrderStageEntity model = new OrderStageEntity(); DataSet ds = SystemDAL.BaseProvider.GetOrderStageByID(stageid); if (ds.Tables["Stages"].Rows.Count > 0) { model.FillData(ds.Tables["Stages"].Rows[0]); model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, clientid); model.StageItem = new List <StageItemEntity>(); foreach (DataRow itemdr in ds.Tables["Items"].Rows) { StageItemEntity item = new StageItemEntity(); item.FillData(itemdr); model.StageItem.Add(item); } OrderStages[clientid].Add(model); } return(model); }
public JsonResult SaveOrderStage(string entity) { JavaScriptSerializer serializer = new JavaScriptSerializer(); OrderStageEntity model = serializer.Deserialize <OrderStageEntity>(entity); int result = 0; if (string.IsNullOrEmpty(model.StageID)) { model.StageID = new SystemBusiness().CreateOrderStage(model.StageName, model.Sort, model.Mark, model.MaxHours, "", model.ProcessID, CurrentUser.UserID, CurrentUser.ClientID, out result); model.Owner = OrganizationBusiness.GetUserByUserID(CurrentUser.UserID, CurrentUser.ClientID); } else { bool bl = new SystemBusiness().UpdateOrderStage(model.StageID, model.StageName, model.Mark, model.MaxHours, model.ProcessID, CurrentUser.UserID, OperateIP, CurrentUser.ClientID); if (bl) { result = 1; } } JsonDictionary.Add("status", result); JsonDictionary.Add("model", model); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public List <OrderStageEntity> GetOrderStages(string processid, string clientid) { if (OrderStages.ContainsKey(processid)) { return(OrderStages[processid].OrderBy(m => m.Sort).ToList()); } var model = GetOrderProcessByID(processid, clientid); List <OrderStageEntity> list = new List <OrderStageEntity>(); DataSet ds = SystemDAL.BaseProvider.GetOrderStages(processid); foreach (DataRow dr in ds.Tables["Stages"].Rows) { OrderStageEntity item = new OrderStageEntity(); item.FillData(dr); item.MarkEntity = GetCategoryItemByMark(model.CategoryID, item.Mark, clientid); item.Owner = OrganizationBusiness.GetUserByUserID(item.OwnerID, clientid); list.Add(item); } OrderStages.Add(processid, list); return(list); }