Example #1
0
        public List <LeadStagesJSONModel> GetLeadsByStageGroup(int userId, int companyId, int currentPage, int pageSize, ref int totalRecords)
        {
            int totalRecord = 0;
            List <LeadStagesJSONModel> leadJsonModelList = new List <LeadStagesJSONModel>();
            LeadStagesJSONModel        leadJsonModel;
            List <Stage> stageList = stageRepository.GetAll(c => c.CompanyId == companyId && c.RecordDeleted == false).OrderBy(c => c.StageOrder).ToList();

            foreach (Stage stage in stageList)
            {
                leadJsonModel = new LeadStagesJSONModel();
                // totalRecords = 0;
                //leadJsonModel.Leads = null;
                leadJsonModel.StageId        = stage.StageId;
                leadJsonModel.IsInitialStage = stage.IsInitialStage ?? false;
                leadJsonModel.IsLastStage    = stage.IsLastStage ?? false;
                leadJsonModel.StageName      = stage.StageName;
                leadJsonModel.TotalRecords   = totalRecord;
                leadJsonModelList.Add(leadJsonModel);
            }

            return(leadJsonModelList);
        }
Example #2
0
        /// <summary>
        /// for mobile fetching stages with their leads and related information
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="companyId"></param>
        /// <param name="currentPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="totalRecords"></param>
        /// <returns></returns>
        public List <LeadStagesJSONModel> GetLeadsByStageGroupformobile(int userId, int companyId, int currentPage, int pageSize, ref int totalRecords)
        {
            int    LeadId      = 0;
            int    tagId       = 0;
            string LeadName    = null;
            int    totalRecord = 0;
            List <LeadStagesJSONModel> leadJsonModelList = new List <LeadStagesJSONModel>();
            LeadStagesJSONModel        leadJsonModel;
            List <Stage> stageList = stageRepository.GetAll(c => c.CompanyId == companyId && c.RecordDeleted == false).OrderBy(c => c.StageOrder).ToList();

            foreach (Stage stage in stageList)
            {
                leadJsonModel = new LeadStagesJSONModel();

                // totalRecords = 0;
                leadJsonModel.Leads = GetLeadsbyStageIdWeb(userId, companyId, stage.StageId, currentPage, null, LeadName, pageSize, false, LeadId, ref totalRecords).ToList();
                foreach (LeadModel lead in leadJsonModel.Leads)
                {
                    TaskItemBusiness     taskItemBusiness = new TaskItemBusiness(unitOfWork);
                    List <TaskItemModel> taskItemModel    = new List <TaskItemModel>();
                    taskItemModel = taskItemBusiness.GetLeadTasks(companyId, lead.LeadId, 1, 10, ref totalRecords).ToList();
                    //string sortColumnName=" ";
                    //string sortDir=" ";
                    //taskItemModel = taskItemBusiness.GetTasks(userId,companyId, currentPage, 10, ref totalRecords, "", "");
                    leadJsonModel.Leads.Find(x => x.LeadId == lead.LeadId).TaskItems = taskItemModel;
                }
                leadJsonModel.StageId        = stage.StageId;
                leadJsonModel.IsInitialStage = stage.IsInitialStage ?? false;
                leadJsonModel.IsLastStage    = stage.IsLastStage ?? false;
                leadJsonModel.StageName      = stage.StageName;
                leadJsonModel.TotalRecords   = totalRecord;
                leadJsonModelList.Add(leadJsonModel);
            }

            return(leadJsonModelList);
        }