Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public string CreateOrderStage(string name, int sort, int mark, int hours, string pid, string processid, string userid, string clientid, out int result)
        {
            string stageid = Guid.NewGuid().ToString();

            bool bl = SystemDAL.BaseProvider.CreateOrderStage(stageid, name, sort, mark, hours, pid, processid, userid, clientid, out result);

            if (bl)
            {
                if (!OrderStages.ContainsKey(processid))
                {
                    GetOrderStages(processid, clientid);
                }
                else
                {
                    var list = OrderStages[processid].Where(m => m.Sort >= sort && m.Status == 1).ToList();

                    foreach (var model in list)
                    {
                        model.Sort += 1;
                    }

                    var Process = GetOrderProcessByID(processid, clientid);

                    OrderStages[processid].Add(new OrderStageEntity()
                    {
                        StageID    = stageid.ToLower(),
                        StageName  = name,
                        Sort       = sort,
                        PID        = pid,
                        Mark       = mark,
                        MaxHours   = hours,
                        MarkEntity = GetCategoryItemByMark(Process.CategoryID, mark, clientid),
                        Status     = 1,
                        CreateTime = DateTime.Now,
                        ProcessID  = processid,
                        OwnerID    = userid,
                        StageItem  = new List <StageItemEntity>(),
                        Owner      = OrganizationBusiness.GetUserByUserID(userid, clientid),
                        ClientID   = clientid
                    });
                }

                return(stageid);
            }
            return("");
        }