Exemple #1
0
        public List <CustomStageEntity> GetCustomStages(string agentid, string clientid)
        {
            if (CustomStages.ContainsKey(clientid))
            {
                return(CustomStages[clientid].OrderBy(m => m.Sort).ToList());
            }

            List <CustomStageEntity> list = new List <CustomStageEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetCustomStages(clientid);

            foreach (DataRow dr in ds.Tables["Stages"].Rows)
            {
                CustomStageEntity model = new CustomStageEntity();
                model.FillData(dr);
                model.StageItem = new List <StageItemEntity>();
                foreach (DataRow itemdr in ds.Tables["Items"].Select("StageID='" + model.StageID + "'"))
                {
                    StageItemEntity item = new StageItemEntity();
                    item.FillData(itemdr);
                    model.StageItem.Add(item);
                }

                list.Add(model);
            }
            CustomStages.Add(clientid, list);

            return(list);
        }
Exemple #2
0
        public CustomStageEntity GetCustomStageByID(string stageid, string agentid, string clientid)
        {
            if (string.IsNullOrEmpty(stageid))
            {
                return(null);
            }
            var list = GetCustomStages(agentid, clientid);

            if (list.Where(m => m.StageID == stageid).Count() > 0)
            {
                return(list.Where(m => m.StageID == stageid).FirstOrDefault());
            }

            CustomStageEntity model = new CustomStageEntity();
            DataSet           ds    = SystemDAL.BaseProvider.GetCustomStageByID(stageid);

            if (ds.Tables["Stages"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Stages"].Rows[0]);
                model.StageItem = new List <StageItemEntity>();
                foreach (DataRow itemdr in ds.Tables["Items"].Rows)
                {
                    StageItemEntity item = new StageItemEntity();
                    item.FillData(itemdr);
                    model.StageItem.Add(item);
                }
                CustomStages[clientid].Add(model);
            }
            return(model);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        public JsonResult SaveStageItem(string entity)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            StageItemEntity      model      = serializer.Deserialize <StageItemEntity>(entity);

            if (string.IsNullOrEmpty(model.ItemID))
            {
                model.ItemID = new SystemBusiness().CreateStageItem(model.ItemName, model.StageID, CurrentUser.UserID, CurrentUser.AgentID, CurrentUser.ClientID);
            }
            else
            {
                bool bl = new SystemBusiness().UpdateStageItem(model.ItemID, model.ItemName, model.StageID, CurrentUser.UserID, OperateIP, CurrentUser.AgentID, CurrentUser.ClientID);
                if (!bl)
                {
                    model.ItemID = "";
                }
            }
            JsonDictionary.Add("model", model);
            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }