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); }
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); }
public JsonResult SaveOpportunityStage(string entity) { JavaScriptSerializer serializer = new JavaScriptSerializer(); OpportunityStageEntity model = serializer.Deserialize <OpportunityStageEntity>(entity); if (string.IsNullOrEmpty(model.StageID)) { model.StageID = new SystemBusiness().CreateOpportunityStage(model.StageName, model.Probability, CurrentUser.UserID, CurrentUser.AgentID, CurrentUser.ClientID); } else { bool bl = new SystemBusiness().UpdateOpportunityStage(model.StageID, model.StageName, model.Probability, CurrentUser.UserID, OperateIP, CurrentUser.AgentID, CurrentUser.ClientID); if (!bl) { model.StageID = ""; } } JsonDictionary.Add("model", model); return(new JsonResult { Data = JsonDictionary, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }