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)); } }
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); }
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)); }
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); }
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); } }
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)); }
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) })); }
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 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)); }
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)); } }
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)); }
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)); }
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)); }
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)); }
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); } }
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)); } }
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)); }
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)); } }
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)); }
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)); }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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)); } }
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 ActionResult Molina(MolinaAttestationListModel model, bool saveAndContinue) { var attestationValidator = IoC.Resolve <MolinaAttestationViewModelValidator>(); var invalidattestationList = new List <MolinaAttestationViewModel>(); _molinaAttestationRepository.Delete(model.EventCustomerResultId); foreach (var item in model.Attestations) { var result = ValidateModel(attestationValidator, item); if (string.IsNullOrEmpty(result)) { try { using (var scope = new TransactionScope()) { if (item.StatusId != (long)MolinaAttestationStatus.Resolved) { item.DateResolved = null; } if (item.StatusId != (long)MolinaAttestationStatus.UnabletodetermineDiagnosis) { item.WhyNoDiagnosis = ""; } var molinaAttestation = Mapper.Map <MolinaAttestationViewModel, MolinaAttestation>(item); if (!_molinaAttestationRepository.Save(molinaAttestation)) { invalidattestationList.Add(item); } scope.Complete(); } } catch (Exception ex) { item.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage("System Error:" + ex.Message); invalidattestationList.Add(item); } } else { item.FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(result); invalidattestationList.Add(item); } } if (invalidattestationList.Count > 0) { // model.Attestations = invalidattestationList; GetDetails(model); return(View(model)); } if (!saveAndContinue) { return(Redirect("/Medical/Results/ResultStatusList?EventId=" + model.EventId)); } return(View(model)); }
public ActionResult ProspectCustomerAbandonedReport(int pageNumber = 1, ProspectCustomerListModelFilter filter = null) { var filterValidator = IoC.Resolve <ProspectCustomerListModelFilterValidator>(); var result = filterValidator.Validate(filter); if (result.IsValid) { if (_sessionContext.UserSession.CurrentOrganizationRole.GetSystemRoleId == (long)Roles.CallCenterRep) { filter.AgentOrganizationId = _sessionContext.UserSession.CurrentOrganizationRole.OrganizationId; } int totalRecords; var model = _prospectCustomerService.GetAbandonedCustomers(pageNumber, _pageSize, filter, out totalRecords); if (model == null) { model = new ProspectCustomerListModel(); } model.Filter = filter; var currentAction = ControllerContext.RouteData.Values["action"].ToString(); //Func<int, string> urlFunc = pn => Url.Action(currentAction, new // { // pageNumber = pn, // filter.FromDate, // filter.ToDate, // filter.DateType, // filter.Source, // filter.Tag, // filter.Miles, // filter.Zipcode, // filter.PhoneNumber, // filter.StateId, // filter.City, // filter.CorporateTag, // CustomTags = filter.CustomTags.IsNullOrEmpty() ? "" : string.Join("&CustomTags=", filter.CustomTags) // }); var routeValueDictionary = GetProspectCustomerAbandonedReport(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 ProspectCustomerListModel { Filter = filter, FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(htmlString) })); }
public ActionResult CustomerAggregateResultSummary(HospitalPartnerCustomerListModelFilter filter = null, int pageNumber = 1) { var filterValidator = IoC.Resolve <HospitalPartnerCustomerListModelFilterValidator>(); var result = filterValidator.Validate(filter); if (!result.IsValid) { 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 HospitalPartnerCustomerListModel { Filter = filter, FeedbackMessage = FeedbackMessageModel.CreateFailureMessage(htmlString) })); } int totalRecords = 0; var model = _hospitalPartnerService.GetCustomerAggregateResultSummary(pageNumber, _pageSize, filter, out totalRecords) ?? new HospitalPartnerCustomerListModel(); model.Filter = filter; var currentAction = ControllerContext.RouteData.Values["action"].ToString(); Func <int, string> urlFunc = pn => Url.Action(currentAction, new { pageNumber = pn, filter.FromDate, filter.ToDate, filter.HospitalPartnerId, filter.CustomerId, filter.CustomerName, filter.Pod, filter.CorporateAccountId, filter.IsRetailEvent, filter.IsCorporateEvent, filter.IsHospitalPartnerAttached, filter.IsPublicEvent, filter.IsPrivateEvent, filter.ResultSummary, filter.Status, filter.DateType, filter.PhoneNumber, filter.SortingColumn, filter.SortingOrder }); model.PagingModel = new PagingModel(pageNumber, _pageSize, totalRecords, urlFunc); return(View(model)); }