예제 #1
0
        public ActionResult Create(CheckListTemplateEditModel model)
        {
            try
            {
                var newModel     = _checkListTemplateService.GetbyId(model.Id);
                var questionsIds = model.Questions != null && model.Questions.Any() ? model.Questions.Select(x => x.Id) : null;

                newModel.Questions.ForEach(x => { x.IsSelected = questionsIds != null && questionsIds.Contains(x.Id) ? true : false; });
                model.Questions = newModel.Questions;

                if (ModelState.IsValid)
                {
                    _checkListTemplateService.SaveTemplate(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);

                    model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Template is created successfully. You can create more templates or close this page.");
                    return(View(model));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex);
                return(View(model));
            }
        }
예제 #2
0
        public virtual ActionResult EditModel(RoleEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            try
            {
                var isNew = model.Id <= 0;
                model = _roleService.Save(model);

                if (isNew)
                {
                    ModelState.Clear();
                    model = new RoleEditModel();
                }

                model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Saved Successfully.");
            }
            catch (Exception ex)
            {
                if (ex.Message == "Duplicate Name")
                {
                    model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("A role with same name already exists.");
                }
                else
                {
                    _logger.Error(string.Format("Some error while add/edit role - {0}", model.Name), ex);
                    model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Some Error Occured.");
                }
            }

            return(PartialView(model));
        }
예제 #3
0
 public ActionResult Create(OnSiteRegistrationEditModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             using (var scope = new TransactionScope())
             {
                 var order = _customerRegistrationService.RegisterOnsiteCustomer(model);
                 scope.Complete();
                 if (order.DiscountedTotal > 0)
                 {
                     Response.RedirectUser("/Scheduling/EventCustomerList/Index?id=" + model.EventId + "&customerIdforAcceptPayment=" + order.CustomerId);
                     return(null);
                 }
                 Response.RedirectUser("/Scheduling/EventCustomerList/Index?id=" + model.EventId);
                 return(null);
             }
         }
         catch (Exception ex)
         {
             model = _eventPackageSelectorService.SetEventAndPackageDetail(model, model.EventId, Roles.Technician);
             model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message);
             return(View(model));
         }
     }
     model = _eventPackageSelectorService.SetEventAndPackageDetail(model, model.EventId, Roles.Technician);
     return(View(model));
 }
예제 #4
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));
            }
        }
예제 #5
0
        public ActionResult Authenticator(OtpModel model)
        {
            ViewBag.IsOtpBySmsEnabled   = _configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.OtpNotificationMediumSms) == "True";
            ViewBag.IsOtpByEmailEnabled = _configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.OtpNotificationMediumEmail) == "True";
            ViewBag.IsOtpByAppEnabled   = _configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.OtpByGoogleAuthenticator) == "True";

            model.IsAllowSafeComputerEnabled = _configurationSettingRepository.GetConfigurationValue(ConfigurationSettingName.AllowSafeComputerRemember) == "True";
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var userId        = (long)Session["UserId"];
            var loginSettings = _loginSettingRepository.Get(userId);
            var isValid       = TimeBasedOneTimePassword.IsValid(loginSettings.GoogleAuthenticatorSecretKey, model.Otp, 50);

            if (!isValid)
            {
                model.IsOtpVerified   = false;
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("The OTP entered is wrong. Please try again.");
                return(View(model));
            }
            if (model.MarkAsSafe)
            {
                var browserName  = Request.Browser.Browser + " " + Request.Browser.Version;
                var requestingIp = Request.UserHostAddress;
                var safeComputer = new SafeComputerHistory()
                {
                    BrowserType = browserName, ComputerIp = requestingIp, DateCreated = DateTime.Now, DateModified = DateTime.Now, IsActive = true, UserLoginId = userId
                };
                _safeComputerHistoryService.Save(safeComputer);
            }

            return(GoToDashboard(userId));
        }
예제 #6
0
        public ActionResult Index(string sessionTimeout = "", bool isSessionTaken = false)
        {
            if (!Request.IsAuthenticated || _sessionContext == null || _sessionContext.UserSession == null)
            {
                if (string.IsNullOrEmpty(sessionTimeout) && isSessionTaken == false)
                {
                    return(View());
                }


                var model = new UserLoginModel()
                {
                    FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Your session has expired! Please login to continue.")
                };

                if (isSessionTaken)
                {
                    model = new UserLoginModel()
                    {
                        FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("This session has been logged out because another user has logged in with these credentials.")
                    };
                    return(View(model));
                }

                return(View(model));
            }
            Response.RedirectUser("/Users/Role/Switch?roleId=" + _sessionContext.UserSession.CurrentOrganizationRole.RoleId + "&organizationId=" + _sessionContext.UserSession.CurrentOrganizationRole.OrganizationId);
            return(null);
        }
 public ActionResult CreateCustomTag(CustomTagEditViewModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var orgId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;
             if (model.TagId > 0)
             {
                 _customTagService.UpdateCustomeTag(model);
             }
             else
             {
                 _customTagService.SaveCustomeTag(model, orgId);
             }
             model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("CustomTag has been saved successfully!");
         }
         catch (Exception ex)
         {
             model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(string.Format("System Failure! Message: {0}", ex.Message));
             _logger.Info(string.Format("New CustomTag {0}!  Message: {1} \nStackTrace: {2}", model.CustomTag, ex.Message, ex.StackTrace));
         }
     }
     return(View(model));
 }
예제 #8
0
        public ActionResult ChangeUserName(UserNameEditModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var userLoginRepository = IoC.Resolve <IUserLoginRepository>();
                    var userNameUpdated     = userLoginRepository.UpdateUserName(model.UserId, model.UserName);

                    if (userNameUpdated)
                    {
                        var notifier = IoC.Resolve <INotifier>();
                        var emailNotificationModelsFactory = IoC.Resolve <IEmailNotificationModelsFactory>();
                        var currentSession = IoC.Resolve <ISessionContext>().UserSession;

                        var customerRepository = IoC.Resolve <ICustomerRepository>();
                        var customer           = customerRepository.GetCustomerByUserId(model.UserId);

                        var welcomeEmailViewModel = emailNotificationModelsFactory.GetWelcomeWithUserNameNotificationModel(model.UserName, customer.Name.FullName, customer.DateCreated);
                        notifier.NotifySubscribersViaEmail(NotificationTypeAlias.CustomerWelcomeEmailWithUsername, EmailTemplateAlias.CustomerWelcomeEmailWithUsername, welcomeEmailViewModel, model.UserId, currentSession.CurrentOrganizationRole.OrganizationRoleUserId, Request.Url.AbsolutePath);

                        model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("User Name updated uccessfully");

                        return(View(model));
                    }
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage =
                    FeedbackMessageModel.CreateFailureMessage("System Failure. Message: " + ex.Message);
                return(View(model));
            }
        }
예제 #9
0
        public HealthPlanRevenueEditModel SaveHealthPlanRevenue(HealthPlanRevenueEditModel model, long createdBy)
        {
            var healthPlanRevenue  = _healthPlanRevenueFactory.MapHealthPlanRevenueInfo(model, createdBy);
            var helathPlanPrevious = _healthPlanRevenueRepository.GetHealthPlanRevenuesId(model.HealthPlanId);

            if (helathPlanPrevious != null && helathPlanPrevious.Any())
            {
                foreach (var revenue in helathPlanPrevious)
                {
                    if (revenue.DateFrom >= model.DateFrom.Value)
                    {
                        _healthPlanRevenueRepository.DeleteRevenue(revenue.Id);
                    }
                    else if (revenue.DateTo == null)
                    {
                        _healthPlanRevenueRepository.UpdatePreviousHealthPlanRevenue(model.DateFrom.Value, revenue.Id);
                    }
                    else if (revenue.DateTo.HasValue && revenue.DateTo.Value >= model.DateFrom.Value && revenue.DateTo.Value <= DateTime.Today)
                    {
                        _healthPlanRevenueRepository.UpdatePreviousHealthPlanRevenue(model.DateFrom.Value, revenue.Id);
                    }
                }
            }

            var healthPlanSaved        = _healthPlanRevenueRepository.Save(healthPlanRevenue);
            var healthPlanRevenueItems = _healthPlanRevenueFactory.MapHealthPlanRevenueItemInfo(model, healthPlanSaved.Id);

            foreach (var item in healthPlanRevenueItems)
            {
                _healthPlanRevenueItemRepository.Save(item);
            }

            model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Health Plan Revenue Saved Successfully.");
            return(model);
        }
예제 #10
0
        public ActionResult ResultConfigModel(ResultConfigEditModel model)
        {
            try
            {
                model.RecordableTests = _testRepository.GetRecordableTests();

                if (!ModelState.IsValid)
                {
                    return(PartialView(model));
                }

                _corporateAccountService.SaveAccountResultConfig(model);

                model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Updated Successfully");
            }
            catch (Exception exception)
            {
                _logger.Error(string.Format("Error While Updating {0} \n message: {1} \n stack Trace: {2} ",
                                            model.AccountId, exception.Message, exception.StackTrace));

                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Some Error Occured");
            }

            return(PartialView(model));
        }
예제 #11
0
        public ActionResult BasicInfoModel(CorporateAccountBasicInfoEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            try
            {
                model = _corporateAccountService.SaveAccountInfo(model);
                model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Saved Successfully");
            }
            catch (Exception exception)
            {
                _logger.Error(
                    string.Format(
                        "While {0} organization Error Occured Organization Id {1}, \n message: {2} \n stack Trace {3}",
                        (model.IsNew ? "Created" : "Updated"), model.OrganizationEditModel.Id, exception.Message,
                        exception.StackTrace));

                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Some error Occured while saving");
            }

            return(PartialView(model));
        }
예제 #12
0
        public ActionResult EditHospitalPartnerCustomer(HospitalPartnerCustomerEditModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var currentSession = _sessionContext.UserSession.CurrentOrganizationRole;
                    var customer       = Mapper.Map <HospitalPartnerCustomerEditModel, HospitalPartnerCustomer>(model);

                    customer.CareCoordinatorOrgRoleUserId = currentSession.OrganizationRoleUserId;
                    customer.DataRecorderMetaData         = new DataRecorderMetaData(currentSession.OrganizationRoleUserId, DateTime.Now, DateTime.Now);

                    _hospitalPartnerCustomerRepository.Save(customer);

                    var eventCustomer = _eventCustomerRepository.Get(model.EventId, model.CustomerId);

                    SavePcp(model.CustomerId, model.PrimaryCarePhysicianName, currentSession.OrganizationRoleUserId, eventCustomer.Id);

                    model.FeedbackMessage =
                        FeedbackMessageModel.CreateSuccessMessage("The Information updated uccessfully");

                    return(View(model));
                }
                return(View(model));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage =
                    FeedbackMessageModel.CreateFailureMessage("System Failure. Message: " + ex.Message);
                return(View(model));
            }
        }
예제 #13
0
        private void Save(SourceCodeEditModel model)
        {
            try
            {
                var  sourceCode = Mapper.Map <SourceCodeEditModel, SourceCode>(model);
                bool forEdit    = false;
                if (model.Id > 0)
                {
                    forEdit = true;
                    var sourceCodeInDb = _sourceCodeRepository.GetSourceCodeById(model.Id);
                    sourceCode.DataRecorderMetaData = sourceCodeInDb.DataRecorderMetaData;
                    sourceCode.DataRecorderMetaData.DataRecorderModifier = new OrganizationRoleUser(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                    sourceCode.DataRecorderMetaData.DateModified         = DateTime.Now;
                }
                else
                {
                    sourceCode.DataRecorderMetaData = new DataRecorderMetaData(_sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId, DateTime.Now, null)
                    {
                        DataRecorderModifier = null
                    };
                }

                _sourceCodeRepository.SaveSourceCode(sourceCode);
                model.FeedbackMessage =
                    FeedbackMessageModel.CreateSuccessMessage("Source Code " + (forEdit ? "edited" : "created") +
                                                              " successfully!");
            }
            catch (Exception ex)
            {
                model.FeedbackMessage =
                    FeedbackMessageModel.CreateFailureMessage("System Failure! Message: " + ex.Message);
            }
        }
예제 #14
0
        public ActionResult Edit(StaffEventRoleEditModel staffEventRoleEditModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var staffEventRole = Mapper.Map <StaffEventRoleEditModel, StaffEventRole>(staffEventRoleEditModel);

                    var inDbStaffEventRole = _staffEventRoleRepository.GetById(staffEventRole.Id);
                    staffEventRole.DataRecorderMetaData = inDbStaffEventRole.DataRecorderMetaData;

                    staffEventRole.DataRecorderMetaData.DataRecorderModifier = Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(
                        _sessionContext.UserSession.CurrentOrganizationRole);
                    staffEventRole.DataRecorderMetaData.DateModified = DateTime.Now;

                    staffEventRole                          = _staffEventRoleRepository.Save(staffEventRole);
                    staffEventRoleEditModel                 = Mapper.Map <StaffEventRole, StaffEventRoleEditModel>(staffEventRole);
                    staffEventRoleEditModel.Tests           = _testRepository.GetAll();
                    staffEventRoleEditModel.FeedbackMessage =
                        FeedbackMessageModel.CreateSuccessMessage("Staff Event Role edited succesfully.");
                }
                staffEventRoleEditModel.Tests = _testRepository.GetAll();
                return(View(staffEventRoleEditModel));
            }
            catch (Exception exception)
            {
                staffEventRoleEditModel.Tests           = _testRepository.GetAll();
                staffEventRoleEditModel.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + exception);
                return(View(staffEventRoleEditModel));
            }
        }
예제 #15
0
 public ActionResult CustomerActivityTypeUpload(string message)
 {
     return(View(new CustomerActivityTypeUploadViewModel()
     {
         FeedbackMessage = !string.IsNullOrWhiteSpace(message) ? FeedbackMessageModel.CreateSuccessMessage(message) : null
     }));
 }
예제 #16
0
        public ActionResult Create(EmailTemplateEditModel model)
        {
            if (!ModelState.IsValid)
            {
                var templateMacros = _emailTemplateService.GetMacrosForNotificationTypeId(model.NotificationTypeId);

                model.TemplateMacros = templateMacros.Select(tm => tm.IdentifierName).OrderBy(t => t);
                return(View(model));
            }

            try
            {
                if (model.Id > 0)
                {
                    model = _emailTemplateService.Save(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                }
                else
                {
                    model = _emailTemplateService.SaveNewTemplate(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                }

                model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Template Created successfully!");
                ModelState.Clear();
            }
            catch (Exception ex)
            {
                var templateMacros = _emailTemplateService.GetMacrosForNotificationTypeId(model.NotificationTypeId);
                model.TemplateMacros = templateMacros.Select(tm => tm.IdentifierName).OrderBy(t => t);

                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(string.Concat("System Failure! Message: ", ex.Message));
            }

            return(View(model));
        }
예제 #17
0
        public ActionResult Create(StaffEventRoleEditModel staffEventRoleEditModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var staffEventRole = Mapper.Map <StaffEventRoleEditModel, StaffEventRole>(staffEventRoleEditModel);

                    if (staffEventRole.Id == 0)
                    {
                        staffEventRole.DataRecorderMetaData = new DataRecorderMetaData()
                        {
                            DataRecorderCreator = Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(
                                _sessionContext.UserSession.CurrentOrganizationRole),
                            DateCreated = DateTime.Now
                        };
                    }
                    _staffEventRoleRepository.Save(staffEventRole);

                    var newModel = new StaffEventRoleEditModel(_testRepository);
                    newModel.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Staff Event Role created succesfully.");
                    return(View(newModel));
                }
                staffEventRoleEditModel.Tests = _testRepository.GetAll();
                return(View(staffEventRoleEditModel));
            }
            catch (Exception exception)
            {
                staffEventRoleEditModel.Tests           = _testRepository.GetAll();
                staffEventRoleEditModel.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + exception);
                return(View(staffEventRoleEditModel));
            }
        }
예제 #18
0
        public ActionResult Create(MedicalVendorEditModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.OrganizationEditModel.LogoImage = FileObject(model.OrganizationEditModel.Name, "organization_logo", _mediaRepository.GetOrganizationLogoImageFolderLocation());
                    model.ResultLetterCoBrandingFile      = FileObject(model.OrganizationEditModel.Name, "result_letter", _mediaRepository.GetOrganizationResultLetterFolderLocation());

                    model.DoctorLetterFile = FileObject(model.OrganizationEditModel.Name, "doctor_letter", _mediaRepository.GetOrganizationDoctorLetterFolderLocation());

                    model.OrganizationEditModel.OrganizationType = OrganizationType.MedicalVendor;
                    _organizationService.CreateMedicalVendor(model);

                    var newModel = new MedicalVendorEditModel();
                    SetPackageAndTerritory(newModel);

                    newModel.FeedbackMessage =
                        FeedbackMessageModel.CreateSuccessMessage(string.Format("The medical vendor {0} was saved successfully. You can add more medical vendors from here.", model.OrganizationEditModel.Name));

                    return(View(newModel));
                }
                SetPackageAndTerritory(model);
                return(View(model));
            }
            catch (Exception ex)
            {
                SetPackageAndTerritory(model);
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Failure. Message: " + ex.Message);
                return(View(model));
            }
        }
예제 #19
0
        private ActivityLogListModel GetRecords(ActivityLogListFilter filter, int pageNumber)
        {
            int totalCount = 0;
            var model      = new ActivityLogListModel();

            try
            {
                filter.EndDate = filter.EndDate.AddHours(23).AddMinutes(59);
                model          = _activityLogViewService.GetList(filter, pageNumber, _settings.DefaultPageSizeForReports,
                                                                 out totalCount);
            }
            catch (Exception e)
            {
                _logger.Error(e);
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Some Error Occured");
            }

            model.PagingModel = new PagingModel(pageNumber, _settings.DefaultPageSizeForReports, totalCount,
                                                p =>
                                                Server.UrlDecode(Url.Action("Index",
                                                                            new
            {
                StartDate  = filter.StartDate.Date,
                EndDate    = filter.EndDate.Date,
                pageNumber = p,
                filter.AccessedBy,
                filter.CustomerName,
                filter.AccessedByName,
                filter.CustomerId
            })));

            return(model);
        }
예제 #20
0
        public ActionResult Edit(HospitalFacilityEditModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    model.OrganizationEditModel.LogoImage = FileObject(model.OrganizationEditModel.Name, "organization_logo", _mediaRepository.GetOrganizationLogoImageFolderLocation(), model.OrganizationEditModel.LogoImage != null ? model.OrganizationEditModel.LogoImage.Id : 0);
                    model.ResultLetterFile = FileObject(model.OrganizationEditModel.Name, "result_letter", _mediaRepository.GetOrganizationResultLetterFolderLocation(), model.ResultLetterFile != null ? model.ResultLetterFile.Id : 0);

                    model.OrganizationEditModel.OrganizationType = OrganizationType.HospitalFacility;
                    _organizationService.CreateHospitalFacility(model);

                    model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage(string.Format("The hospital facility {0} was saved successfully.", model.OrganizationEditModel.Name));

                    return(View(model));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Failure. Message: " + ex.Message);
                return(View(model));
            }
        }
예제 #21
0
        private bool IsFileValid(RapsFileUploadEditModel model, out long count)
        {
            try
            {
                var archiveLocation = _mediaRepository.GetRapsUploadMediaFileLocation();
                _csvReader.Delimiter = _csvReader.GetFileDelimiter(archiveLocation.PhysicalPath + model.File.Path).ToString();
                var customerTable = _csvReader.ReadWithTextQualifier(archiveLocation.PhysicalPath + model.File.Path);
                count = customerTable.Rows.Count;
                if (customerTable.Rows.Count == 0)
                {
                    model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Uploaded file has no data.");
                    return(false);
                }

                var missingColumnNames = _rapsUploadHelper.CheckForColumns(customerTable.Rows[0]);
                if (!string.IsNullOrEmpty(missingColumnNames))
                {
                    model.FeedbackMessage =
                        FeedbackMessageModel.CreateFailureMessage("Missing Column Name(s) : " + missingColumnNames);
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                count = 0;
                IoC.Resolve <ILogManager>().GetLogger <Global>().Error("Raps Upload Validation Failure: " + ex.Message + "\n\t" + ex.StackTrace);
                return(false);
            }
        }
예제 #22
0
        public ActionResult Create(PackageEditModel model)
        {
            try
            {
                var tests = _testRepository.GetAll();
                model.AllTests      = Mapper.Map <IEnumerable <Test>, IEnumerable <TestViewModel> >(tests);
                model.AllRoles      = _userService.GetRoleswithRegistrationEnabled();
                model.SelectedTests = GetDefaultSelectedTests(tests.Where(x => x.IsDefaultSelectionForPackage), model.SelectedTests);
                if (ModelState.IsValid)
                {
                    model.ForOrderDisplayFile = FileObject(model.Name.Replace(" ", "_").Replace("+", "_"), "package_image", _mediaRepository.GetPackageImageFolderLocation());
                    SavePackage(model);
                    model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Package is created successfully. You can create more packages or close this page.");

                    return(View(model));
                }

                return(View(model));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex);
                return(View(model));
            }
        }
예제 #23
0
        private bool ValidatePaymentModel(PaymentEditModel model)
        {
            bool isValid = true;

            if (model.Payments == null)
            {
                if (model.Amount > 0)
                {
                    isValid = false;
                }
            }
            else
            {
                foreach (var payment in model.Payments)
                {
                    var validationResult = _paymentValidator.Validate(payment);
                    if (!validationResult.IsValid)
                    {
                        isValid = false;

                        var propertyNames = validationResult.Errors.Select(e => e.PropertyName).Distinct();
                        var htmlString    = propertyNames.Aggregate("", (current, property) => current + (validationResult.Errors.Where(e => e.PropertyName == property).FirstOrDefault().ErrorMessage + "<br />"));

                        payment.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(htmlString);
                    }
                }
            }

            return(isValid);
        }
예제 #24
0
        public ActionResult AccountMemberVerificationForm(AccountVerificationEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }
            var isCustomerVerified = _customerRepository.IsCustomerVerified(model);

            if (isCustomerVerified)
            {
                var customer = _customerRepository.GetCustomer(model.CustomerId);
                model.FirstName     = customer.Name.FirstName;
                model.LastName      = customer.Name.LastName;
                model.DateOfBirth   = customer.DateOfBirth.HasValue ? customer.DateOfBirth.Value : (DateTime?)null;
                model.CustomerEmail = customer.Email.ToString();
                model.MemberId      = customer.InsuranceId;
                model.ZipCode       = customer.Address.ZipCode.Zip;
            }


            model.FeedbackMessage = isCustomerVerified
                ? FeedbackMessageModel.CreateSuccessMessage("Verification Success")
                : FeedbackMessageModel.CreateFailureMessage(string.Format("Unable to verify your information. Please call us as {0} for any queries.", _settings.PhoneTollFree));

            return(PartialView(model));
        }
예제 #25
0
        public ActionResult PcpAppointment(PcpAppointmentListModelFilter filter = null, int pageNumber = 1)
        {
            var filterValidator = IoC.Resolve <PcpAppointmentListModelFilterValidator>();
            var result          = filterValidator.Validate(filter);

            if (result.IsValid)
            {
                int totalRecords;
                var model = _eventCustomerReportingService.GetPcpAppointment(pageNumber, _pageSize, filter, out totalRecords);
                model        = model ?? new PcpAppointmentListModel();
                model.Filter = filter;

                var currentAction        = ControllerContext.RouteData.Values["action"].ToString();
                var routeValueDictionary = GetRouteValueDictionaryForPcpAppointment(filter);

                Func <int, string> urlFunc = pn => Url.Action(currentAction, AddRouteValueDictionary(routeValueDictionary, pn));

                model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc);

                return(View(model));
            }

            var propertyNames = result.Errors.Select(e => e.PropertyName).Distinct();
            var htmlString    = propertyNames.Aggregate("", (current, property) => current + (result.Errors.Where(e => e.PropertyName == property).FirstOrDefault().ErrorMessage + "<br />"));

            return(View(new PcpAppointmentListModel {
                Filter = filter, FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(htmlString)
            }));
        }
예제 #26
0
        public ActionResult Edit(CampaignEditModel model)
        {
            try
            {
                var orgRoleId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId;

                if (ModelState.IsValid)
                {
                    if (!IsAlreadyPublished(model.CampaignId))
                    {
                        _campaignService.Save(model, orgRoleId);
                        model.FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Campaign updated successfully");
                    }

                    else
                    {
                        model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Campaign has been already published");
                    }


                    //return RedirectToAction("ManageCampaign");
                }
            }
            catch (Exception ex)
            {
                model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("Some Error occured while saving your record");
                logger.Error("Message: " + ex.Message + " stack Trace: " + ex.StackTrace);
            }

            return(View(model));
        }
예제 #27
0
 public ActionResult AssignPhysicianToCustomer(PhysicianCustomerAssignmentEditModel model)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var physicianCustomerAssignment =
                 Mapper.Map <PhysicianCustomerAssignmentEditModel, PhysicianCustomerAssignment>(model);
             physicianCustomerAssignment.DataRecorderMetaData = new DataRecorderMetaData
             {
                 DataRecorderCreator = Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(
                     _sessionContext.UserSession.CurrentOrganizationRole),
                 DateCreated = DateTime.Now
             };
             _physicianCustomerAssignmentRepository.Save(physicianCustomerAssignment);
             model.FeedbackMessage    = FeedbackMessageModel.CreateSuccessMessage("Physicians assigned successfully");
             model.AssignedPhysicians = _physicianAssignmentService.GetPhysiciansAssignedToCustomer(model.EventCustomerId);
         }
         catch (Exception exception)
         {
             model.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + exception.Message);
             return(View(model));
         }
     }
     return(View(model));
 }
예제 #28
0
        public ActionResult Create(ContentEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            try
            {
                model = _contentService.SaveModel(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);
                model = new ContentEditModel
                {
                    FeedbackMessage = FeedbackMessageModel.CreateSuccessMessage("Content Saved successfully! Create another.")
                };

                ModelState.Clear();

                return(View(model));
            }
            catch (Exception ex)
            {
                model.FeedbackMessage =
                    FeedbackMessageModel.CreateFailureMessage(string.Format("System Failure! Message: {0}", ex.Message));
                _logger.Info(string.Format("Create New Content {0}!  Message: {1} \nStackTrace: {2}", model.Title, ex.Message, ex.StackTrace));
                return(View(model));
            }
        }
예제 #29
0
        public ActionResult Edit(PodEditModel podEditModel)
        {
            try
            {
                podEditModel.Territories = _territoryRepository.GetAllTerritoriesIdNamePair(TerritoryType.Pod);
                podEditModel.Tests       = _testRepository.GetAll();
                if (ModelState.IsValid)
                {
                    var pod     = Mapper.Map <PodEditModel, Pod>(podEditModel);
                    var podInDb = _podRepository.GetById(pod.Id);
                    pod.DataRecorderMetaData = podInDb.DataRecorderMetaData;

                    pod.DataRecorderMetaData.DataRecorderModifier =
                        Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(_sessionContext.UserSession.CurrentOrganizationRole);
                    pod.DataRecorderMetaData.DateModified = DateTime.Now;

                    using (var scope = new TransactionScope())
                    {
                        pod = _podRepository.Save(pod);

                        var podTeam = new List <PodStaff>();
                        podEditModel.DefaultStaffAssigned.ToList().ForEach(dsa =>
                        {
                            var teamMember   = Mapper.Map <PodStaffEditModel, PodStaff>(dsa);
                            teamMember.PodId = pod.Id;
                            teamMember.DataRecorderMetaData = new DataRecorderMetaData()
                            {
                                DataRecorderCreator = Mapper.Map <OrganizationRoleUserModel, OrganizationRoleUser>(_sessionContext.UserSession.CurrentOrganizationRole),
                                DateCreated         = DateTime.Now
                            };
                            podTeam.Add(teamMember);
                        });

                        ((IPodRepository)_podRepository).SavePodTerritories(podEditModel.AssignedTerritories,
                                                                            pod.Id);

                        // Need to check the DefaultPodTeam Issue.
                        podTeam = _podStaffAssignmentRepository.SaveMultiple(podTeam, pod.Id).ToList();

                        _podService.SavePodRooms(podEditModel.Rooms, pod.Id);
                        scope.Complete();
                    }

                    var newModel = _podService.GetPodEditModel(podEditModel.Id);

                    newModel.FeedbackMessage =
                        FeedbackMessageModel.CreateSuccessMessage(
                            "The POD was edited successfully. You can edit it for more changes or close this page.");

                    return(View(newModel));
                }
                return(View(podEditModel));
            }
            catch (Exception exception)
            {
                podEditModel.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + exception);
                return(View(podEditModel));
            }
        }
        public JsonResult RegenerateHealthPlanCriteria(long criteriaId)
        {
            _healthPlanCallQueueCriteriaRepository.RegenerateHealthPlanCriteria(criteriaId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId);

            var feedback = FeedbackMessageModel.CreateSuccessMessage("Health Plan Criteria Regenerated.");

            return(Json(feedback, JsonRequestBehavior.AllowGet));
        }