示例#1
0
        public ActionResult _AddLeadScore()
        {
            LeadScoreRuleViewModel viewModel = new LeadScoreRuleViewModel();

            viewModel.AccountID = this.Identity.ToAccountID();
            var dropdownValues = cachingService.GetDropdownValues(this.Identity.ToAccountID());

            viewModel.TourTypes       = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.TourType).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            viewModel.LeadsourceTypes = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.LeadSources).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            viewModel.NoteCategories  = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.NoteCategory).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            viewModel.ActionTypes     = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.ActionType).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            GetLeadScoreCategoriesResponse categoriesResponse = leadScoreService.GetLeadScoreCategories(new GetLeadScoreCategoriesRequest()
            {
            });

            viewModel.Categories = categoriesResponse.Categories;
            GetLeadScoreConditionsResponse conditionsResponce = leadScoreService.GetLeadScoreConditions(new GetLeadScoreConditionsRequest()
            {
            });

            viewModel.Conditions = conditionsResponce.Conditions;
            var leadScoreConditionValues = new List <LeadScoreConditionValueViewModel>();
            var newConditionValue        = new LeadScoreConditionValueViewModel()
            {
                LeadScoreConditionValueId = 0,
                LeadScoreRuleId           = 0,
                Value     = "",
                ValueType = LeadScoreValueType.PageDuration
            };

            leadScoreConditionValues.Add(newConditionValue);
            viewModel.LeadScoreConditionValues = leadScoreConditionValues;
            return(PartialView("_AddEditRule", viewModel));
        }
        public ActionResult EditLeadScore(int leadScoreRuleMapId)
        {
            var dropdownValues            = cachingService.GetDropdownValues(this.Identity.ToAccountID());
            GetLeadScoreResponse response = leadScoreService.GetLeadScoreRule(new GetLeadScoreRequest(leadScoreRuleMapId)
            {
            });

            response.LeadScoreViewModel.DateFormat      = this.Identity.ToDateFormat();
            response.LeadScoreViewModel.CreatedOn       = response.LeadScoreViewModel.CreatedOn.ToUserUtcDateTimeV2();
            response.LeadScoreViewModel.LeadsourceTypes = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.LeadSources).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            response.LeadScoreViewModel.TourTypes       = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.TourType).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            response.LeadScoreViewModel.NoteCategories  = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.NoteCategory).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            response.LeadScoreViewModel.ActionTypes     = dropdownValues.Where(s => s.DropdownID == (byte)DropdownFieldTypes.ActionType).Select(s => s.DropdownValuesList).ToList().FirstOrDefault().Where(d => d.IsActive == true);
            GetLeadScoreCategoriesResponse categoriesResponse = leadScoreService.GetLeadScoreCategories(new GetLeadScoreCategoriesRequest()
            {
            });

            response.LeadScoreViewModel.Categories = categoriesResponse.Categories;
            GetLeadScoreConditionsResponse conditionsResponce = leadScoreService.GetLeadScoreConditions(new GetLeadScoreConditionsRequest()
            {
            });
            var leadScoreConditionValues = new List <LeadScoreConditionValueViewModel>();
            var newConditionValue        = new LeadScoreConditionValueViewModel()
            {
                LeadScoreConditionValueId = 0,
                LeadScoreRuleId           = 0,
                Value     = "",
                ValueType = LeadScoreValueType.PageDuration
            };

            leadScoreConditionValues.Add(newConditionValue);
            if (!response.LeadScoreViewModel.LeadScoreConditionValues.IsAny())
            {
                response.LeadScoreViewModel.LeadScoreConditionValues = leadScoreConditionValues;
            }


            response.LeadScoreViewModel.Conditions = conditionsResponce.Conditions;
            ViewBag.IsModal = true;
            var view = PartialView("_AddEditRule", response.LeadScoreViewModel);

            return(view);
        }