Exemplo n.º 1
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();
            DataTable dt = SystemDAL.BaseProvider.GetOpportunityStageByID(stageid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);
                OpportunityStages[clientid].Add(model);
            }

            return(model);
        }
Exemplo n.º 2
0
        public List <OpportunityStageEntity> GetOpportunityStages(string agentid, string clientid)
        {
            if (OpportunityStages.ContainsKey(clientid))
            {
                return(OpportunityStages[clientid].OrderBy(m => m.Probability).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);

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

            return(list);
        }