Exemplo n.º 1
0
        public List<OpportunityStageEntity> GetOpportunityStages(string agentid, string clientid)
        {
            if (OpportunityStages.ContainsKey(clientid))
            {
                return OpportunityStages[clientid].OrderBy(m => m.Sort).ToList();
            }

            List<OpportunityStageEntity> list = new List<OpportunityStageEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetOpportunityStages(clientid);
            foreach (DataRow dr in ds.Tables["Stages"].Rows)
            {
                OpportunityStageEntity model = new OpportunityStageEntity();
                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);
            }
            OpportunityStages.Add(clientid, list);

            return list;
        }
Exemplo n.º 2
0
        public OpportunityStageEntity GetOpportunityStageByID(string stageid, string agentid, string clientid)
        {
            if (string.IsNullOrEmpty(stageid))
            {
                return null;
            }
            var list = GetOpportunityStages(agentid, clientid);
            if (list.Where(m => m.StageID == stageid).Count() > 0)
            {
                return list.Where(m => m.StageID == stageid).FirstOrDefault();
            }

            OpportunityStageEntity model = new OpportunityStageEntity();
            DataSet ds = SystemDAL.BaseProvider.GetOpportunityStageByID(stageid);
            if (ds.Tables["Stages"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Stages"].Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, 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);
                }
                OpportunityStages[clientid].Add(model);
            }

            return model;
        }
Exemplo n.º 3
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;
        }