Пример #1
0
        public ActionResult Create(CallQueueEditModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                model = _callQueueService.SaveCallQueue(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                var callQueue  = _callQueueRepository.GetById(model.Id);
                var queueCount = _outboundCallQueueService.GetCallQueueCustomers(callQueue).Count;

                ModelState.Clear();
                var newModel = new CallQueueEditModel
                {
                    FeedbackMessage = queueCount > 0
                     ? FeedbackMessageModel.CreateSuccessMessage(string.Format("Call Queue created sucessfully. You can create more call queue or close this page. Based on the Queue created, currently there are {0} records satisfying the criteria(s).", queueCount))
                     : FeedbackMessageModel.CreateWarningMessage(string.Format("Call Queue created sucessfully. You can create more call queue or close this page. Based on the Queue created, currently there are {0} records satisfying the criteria(s).", queueCount))
                };
                return(View(newModel));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message);
                return(View(model));
            }
        }
Пример #2
0
        public ActionResult EditPublishedCampaign(UpdatePublishedCampaignEditModel model)
        {
            if (ModelState.IsValid)
            {
                _campaignService.EditPublishedCampaign(model);

                model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Campaign end date upadted successfully");
            }
            return(PartialView(model));
        }
Пример #3
0
        public ActionResult Edit(long id)
        {
            var model = _organizationService.GetMedicalVendorCreateModel(id);

            SetPackageAndTerritory(model);
            if (model.OrganizationEditModel.BillingAddress == null)
            {
                model.OrganizationEditModel.BillingAddress = new AddressEditModel();
            }

            if (model.HospitalPartnerEditModel != null && !string.IsNullOrEmpty(model.HospitalPartnerEditModel.DeactivedPackages))
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage(model.HospitalPartnerEditModel.DeactivedPackages);
            }
            return(View(model));
        }
Пример #4
0
        public ActionResult EditActivityModel(CampaignActivityEditModel model)
        {
            if (ModelState.IsValid)
            {
                var camapign           = _campaignService.GetEditModel(model.CampaigndId);
                var campaignActivities = camapign.CampaignActivity.IsNullOrEmpty() ? new List <CampaignActivityEditModel>() : camapign.CampaignActivity.ToList();

                if (model.ActivityId <= 0)
                {
                    var activity = campaignActivities.OrderBy(x => x.Sequence).LastOrDefault();
                    model.Sequence = activity.Sequence + 1;
                    campaignActivities.Add(model);
                }
                else
                {
                    campaignActivities = campaignActivities.Where(x => x.ActivityId != model.ActivityId).ToList();
                    campaignActivities.Add(model);
                }

                var IsValid = IsValidActivity(campaignActivities);
                if (!IsValid)
                {
                    model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("First activity can not be Outbound Call");
                }

                model.IsValid = IsValid;
                var orgId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;

                if (IsValid)
                {
                    _campaignService.EditActivity(orgId, model);
                }

                if (model.IsValid)
                {
                    model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Successfully updated");
                }
            }

            return(View("EditActivityModel", model));
        }
        public ActionResult Edit(HealthPlanCallQueueCriteriaEditModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                else
                {
                    //if ((model.Assignments == null && model.CallCenterTeamAssignments == null)
                    //    ||
                    //    ((model.Assignments != null && !model.Assignments.Any()) && (model.CallCenterTeamAssignments != null && !model.CallCenterTeamAssignments.Any())))
                    //{
                    //    model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Assignment must exist");
                    //    return View(model);
                    //}

                    var healthPlanCriteria = _healthPlanCallQueueCriteriaRepository.GetCriteriaByHealthPlanCallQueue(model.HealthPlanId, model.CallQueue);

                    if (!string.IsNullOrWhiteSpace(model.CriteriaName))
                    {
                        model.CriteriaName = model.CriteriaName.Trim();
                        var currentCriteria = healthPlanCriteria.FirstOrDefault(x => x.Id == model.Id);

                        //if we are Modifying Criteria Name then check for Uniqueness
                        if (currentCriteria.CriteriaName.ToLower() != model.CriteriaName.ToLower())
                        {
                            var criteriaNameList = _healthPlanCallQueueCriteriaRepository.GetAllHealthPlanCallQueueCriteriaNames();
                            if (criteriaNameList.Any(x => x.ToLower() == model.CriteriaName.ToLower()))
                            {
                                model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Name already exists");
                                return(View(model));
                            }
                        }
                        if (model.CallQueue == HealthPlanCallQueueCategory.AppointmentConfirmation && currentCriteria.LanguageId != model.LanguageId)
                        {
                            var healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueueByLanguage(model.CallQueue, model.HealthPlanId, model.LanguageId);
                            if (healthPlanCallQueueCriteria != null)
                            {
                                model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Criteria already exists for selected language.");
                                return(View(model));
                            }
                        }
                    }
                    bool isCriteriaExist = CheckHealthPlanCallQueueCriteriaAlreadyExists(model, healthPlanCriteria);

                    if (isCriteriaExist)
                    {
                        model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Criteria for same healthplan and call queue exist");
                        return(View(model));
                    }
                    else
                    {
                        var criteria = healthPlanCriteria.First(x => x.Id == model.Id);
                        var isCriteriaSameAsPervious = IsCriteriaIsSameAsPerious(model, criteria);

                        if (isCriteriaSameAsPervious)
                        {
                            isCriteriaSameAsPervious = CheckCustomerDataHasBeenUploaded(criteria);
                        }

                        //check if user has changed mode of assignment (agent assignment or team assignment)
                        var isTeamAssignmentOld  = _healthPlanCriteriaTeamAssignmentRepository.GetTeamAssignments(criteria.Id).Any();
                        var isAgentAssignmentOld = _healthPlanCriteriaAssignmentRepository.GetByCriteriaId(criteria.Id).Any();

                        if (model.IsTeamAssignment && isAgentAssignmentOld) //delete old agent assignments
                        {
                            _healthPlanCriteriaAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                        }
                        else if (!model.IsTeamAssignment && isTeamAssignmentOld)     //delete old team assignments
                        {
                            _healthPlanCriteriaTeamAssignmentRepository.DeleteAssignmentsForCriteria(criteria.Id);
                        }
                        else if (model.IsTeamAssignment && isTeamAssignmentOld && model.CallCenterTeamAssignments.IsNullOrEmpty())
                        {
                            _healthPlanCriteriaTeamAssignmentRepository.DeleteAssignmentsForCriteria(criteria.Id);
                        }
                        else if (!model.IsTeamAssignment && isAgentAssignmentOld && model.Assignments.IsNullOrEmpty())
                        {
                            _healthPlanCriteriaAssignmentRepository.DeleteByCriteriaId(criteria.Id);
                        }

                        _healthPlanCallQueueCriteriaService.SaveHealthPlanCallQueueCriteria(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, isCriteriaSameAsPervious);
                        if (model.IsCriteriaSameAsPervious)
                        {
                            model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Criteria Updated");
                            return(View(model));
                        }
                        else
                        {
                            return(RedirectToAction("Edit", new { criteriaId = model.Id, isSuccessfull = true }));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message);
                return(View(model));
            }
        }
        public ActionResult Create(HealthPlanCallQueueCriteriaEditModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                else
                {
                    //if ((model.Assignments == null && model.CallCenterTeamAssignments == null)
                    //    ||
                    //    ((model.Assignments != null && !model.Assignments.Any()) && (model.CallCenterTeamAssignments != null && !model.CallCenterTeamAssignments.Any())))
                    //{
                    //    model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Assignment must exist");
                    //    return View(model);
                    //}

                    var healthPlanCriteria = _healthPlanCallQueueCriteriaRepository.GetCriteriaByHealthPlanCallQueue(model.HealthPlanId, model.CallQueue);

                    if (!string.IsNullOrWhiteSpace(model.CriteriaName))
                    {
                        model.CriteriaName = model.CriteriaName.Trim();
                        var criteriaNameList = _healthPlanCallQueueCriteriaRepository.GetAllHealthPlanCallQueueCriteriaNames();

                        if (criteriaNameList.Any(x => x.ToLower() == model.CriteriaName.ToLower()))
                        {
                            model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Name already exists");
                            return(View(model));
                        }
                    }
                    if (model.CallQueue == HealthPlanCallQueueCategory.AppointmentConfirmation)
                    {
                        var healthPlanCallQueueCriteria = _healthPlanCallQueueCriteriaRepository.GetQueueCriteriaForQueueByLanguage(model.CallQueue, model.HealthPlanId, model.LanguageId);
                        if (healthPlanCallQueueCriteria != null)
                        {
                            model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Criteria already exists for selected language.");
                            return(View(model));
                        }
                    }

                    bool isCriteriaExist = CheckHealthPlanCallQueueCriteriaAlreadyExists(model, healthPlanCriteria);

                    if (isCriteriaExist)
                    {
                        model.FeedbackMessage = FeedbackMessageModel.CreateWarningMessage("Criteria for same healthplan and call queue exist");
                        return(View(model));
                    }
                    else
                    {
                        //if (model.Id > 0)
                        //{
                        //    //check if user has changed mode of assignment (agent assignment or team assignment)
                        //    var isTeamAssignmentOld =
                        //        _healthPlanCriteriaTeamAssignmentRepository.GetTeamAssignments(model.Id).Any();
                        //    var isAgentAssignmentOld =
                        //        _healthPlanCriteriaAssignmentRepository.GetByCriteriaId(model.Id).Any();

                        //    if (model.IsTeamAssignment && isAgentAssignmentOld) //delete old agent assignments
                        //    {
                        //        _healthPlanCriteriaAssignmentRepository.DeleteByCriteriaId(model.Id);
                        //    }
                        //    else if (!model.IsTeamAssignment && isTeamAssignmentOld) //delete old team assignments
                        //    {
                        //        _healthPlanCriteriaTeamAssignmentRepository.DeleteAssignmentsForCriteria(model.Id);
                        //    }
                        //}
                        _healthPlanCallQueueCriteriaService.SaveHealthPlanCallQueueCriteria(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, false);

                        ModelState.Clear();

                        model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Criteria for healthplan and call queue created successfully");
                    }
                }
                return(RedirectToAction("ManageCriteria"));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message);
                return(View(model));
            }
        }
Пример #7
0
        private UserLoginModel GetLoginFailureMessage(UserLoginModel userLogin)
        {
            try
            {
                var notLoggedInUser = _loginRepository.GetByUserName(userLogin.UserName);
                if (notLoggedInUser == null)
                {
                    userLogin.FeedbackMessage =
                        FeedbackMessageModel.CreateFailureMessage(
                            "Username and/or password do not match. Please try again.");
                    return(userLogin);
                }
                if (notLoggedInUser.IsActive == false)
                {
                    userLogin.FeedbackMessage =
                        FeedbackMessageModel.CreateFailureMessage(
                            "Your account is disabled.");
                    return(userLogin);
                }
                //found user but could not login.
                if (notLoggedInUser.Locked)
                {
                    userLogin.FeedbackMessage =
                        FeedbackMessageModel.CreateFailureMessage(
                            "Your account has been locked, due to too many attempts. Please contact " +
                            _settings.SupportEmail + " OR call us at " + _settings.PhoneTollFree);
                    return(userLogin);
                }

                var loginAttempts = notLoggedInUser.FailedAttempts;
                _loginRepository.UpdateLoginStatus(notLoggedInUser.Id, false);

                if (loginAttempts == 1)
                {
                    userLogin.FeedbackMessage =
                        FeedbackMessageModel.CreateWarningMessage(
                            "Looks like you are having trouble logging in. You have only 3 more attempts before your " +
                            "account will be temporarily locked for security reasons. Please click on link beside the login button to try and reset your password.");
                    return(userLogin);
                }
                if (loginAttempts == 3)
                {
                    userLogin.FeedbackMessage =
                        FeedbackMessageModel.CreateWarningMessage(
                            "You have only one attempt left before your account will be temporarily locked " +
                            "for security reasons. Please click on link beside the login button to try and reset your password.");
                    return(userLogin);
                }
                if (loginAttempts == 4)
                {
                    userLogin.FeedbackMessage =
                        FeedbackMessageModel.CreateFailureMessage(
                            "Your account has been locked, due to too many attempts. Please contact " +
                            _settings.SupportEmail + " OR call us at " + _settings.PhoneTollFree);
                    return(userLogin);
                }

                userLogin.FeedbackMessage =
                    FeedbackMessageModel.CreateFailureMessage("Username and/or password do not match. Please try again.");
                return(userLogin);
            }
            catch (Exception)
            {
                userLogin.FeedbackMessage =
                    FeedbackMessageModel.CreateFailureMessage("Username and/or password do not match. Please try again.");
                return(userLogin);
            }
        }