Ejemplo n.º 1
0
        public OrderStageEntity GetOrderStageByID(string stageid, string processid, string agentid, string clientid)
        {
            if (string.IsNullOrEmpty(stageid) || string.IsNullOrEmpty(processid))
            {
                return null;
            }
            var list = GetOrderStages(processid, agentid, 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, agentid);
                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;
        }
Ejemplo n.º 2
0
        public List<OrderStageEntity> GetOrderStages(string processid, string agentid, string clientid)
        {
            if (OrderStages.ContainsKey(processid))
            {
                return OrderStages[processid].OrderBy(m => m.Sort).ToList();
            }

            List<OrderStageEntity> list = new List<OrderStageEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetOrderStages(processid);
            foreach (DataRow dr in ds.Tables["Stages"].Rows)
            {
                OrderStageEntity model = new OrderStageEntity();
                model.FillData(dr);

                model.MarkStr = CommonBusiness.GetEnumDesc<EnumOrderStageMark>((EnumOrderStageMark)model.Mark);

                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, agentid);
                //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);
            }
            OrderStages.Add(processid, list);

            return list;
        }