public CustomerContactViewModel UpdateCallQueueCustomer([FromBody] CallQueueCustomerEditModel customerEditModel) { _callQueueCustomerContactService.UpdateCustomerData(customerEditModel, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); if (customerEditModel.IsHealthPlanQueue) { _primaryCarePhysicianHelper.UpdatePrimaryCarePhysician(customerEditModel.PrimaryCarePhysician, customerEditModel.CustomerId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } return(_callQueueCustomerContactService.Get(customerEditModel.CallQueueCustomerId, customerEditModel.CallId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId)); }
public ActionResult SavePatientInfoAppointmentConfirmation(CallQueueCustomerEditModel model) { if (ModelState.IsValid) { _callQueueCustomerContactService.UpdateCustomerData(model, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); if (model.IsHealthPlanQueue) { _primaryCarePhysicianHelper.UpdatePrimaryCarePhysician(model.PrimaryCarePhysician, model.CustomerId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); } } var viewModel = _callQueueCustomerContactService.GetByCustomerId(model.CustomerId, model.CallId, _sessionContext.UserSession.CurrentOrganizationRole.OrganizationRoleUserId); if (!ModelState.IsValid) { viewModel.HasError = true; viewModel.PatientInfoEditModel = model; } return(PartialView("GetPatientInfoAppointmentConfirmation", viewModel)); }
public bool UpdateCustomerData(CallQueueCustomerEditModel model, long createdByOrgRoleUserId) { if (model.CustomerId > 0) { var customer = _customerRepository.GetCustomer(model.CustomerId); var previousIncorrectPhoneNumberStatus = customer.IsIncorrectPhoneNumber; customer.Name.FirstName = model.FirstName; customer.Name.LastName = model.LastName; var address = _addressService.SaveAfterSanitizing(Mapper.Map <AddressEditModel, Address>(model.Address)); if (customer.Address != null && customer.Address.Id > 0) { address.Id = customer.Address.Id; } customer.Address = address; string officePhoneNumber = PhoneNumber.Create(model.OfficePhoneNumber, PhoneNumberType.Office).ToString(); string mobilePhoneNumber = PhoneNumber.Create(model.MobilePhoneNumber, PhoneNumberType.Mobile).ToString(); string homePhoneNumber = PhoneNumber.Create(model.CallBackPhoneNumber, PhoneNumberType.Home).ToString(); if ((customer.OfficePhoneNumber != null && customer.OfficePhoneNumber.ToString() != officePhoneNumber) || (customer.MobilePhoneNumber != null && customer.MobilePhoneNumber.ToString() != mobilePhoneNumber) || (customer.HomePhoneNumber != null && customer.HomePhoneNumber.ToString() != homePhoneNumber)) { customer.IsIncorrectPhoneNumber = false; customer.IncorrectPhoneNumberMarkedDate = null; } var currentIncorrectPhoneNumberStatus = customer.IsIncorrectPhoneNumber; customer.OfficePhoneNumber = PhoneNumber.Create(model.OfficePhoneNumber, PhoneNumberType.Office); customer.MobilePhoneNumber = PhoneNumber.Create(model.MobilePhoneNumber, PhoneNumberType.Mobile); customer.HomePhoneNumber = PhoneNumber.Create(model.CallBackPhoneNumber, PhoneNumberType.Home); customer.Hicn = model.Hicn; customer.Mbi = model.Mbi; customer.InsuranceId = model.MemberId; //customer.IsEligible = model.EligibleStatus; customer.ActivityId = model.ActivityId > 0 ? model.ActivityId : (long?)null; customer.Email = null; if (!string.IsNullOrEmpty(model.Email)) { customer.Email = new Email(model.Email); } //else if (!string.IsNullOrEmpty(customer.Email.ToString()) && string.IsNullOrEmpty(model.Email)) //{ // customer.Email = null; //} customer.AlternateEmail = null; if (!string.IsNullOrEmpty(model.AlternateEmail)) { customer.AlternateEmail = new Email(model.AlternateEmail); } customer.DateOfBirth = model.DateOfBirth; customer.Gender = (Gender)model.Gender; customer.EnableEmail = model.EnableEmail; _customerService.SaveCustomer(customer, createdByOrgRoleUserId); if (previousIncorrectPhoneNumberStatus && !currentIncorrectPhoneNumberStatus) { _customerNotesService.SavePhoneNumberUpdatedMessage(customer.CustomerId, createdByOrgRoleUserId); } } ProspectCustomer prospectCustomer = null; if (model.ProspectCustomerId > 0) { prospectCustomer = _prospectCustomerRepository.GetProspectCustomer(model.ProspectCustomerId); } else if (model.CustomerId > 0) { prospectCustomer = _prospectCustomerRepository.GetProspectCustomerByCustomerId(model.CustomerId); } if (prospectCustomer == null) { return(true); } prospectCustomer.FirstName = model.FirstName; prospectCustomer.LastName = model.LastName; if (model.Gender > 0) { prospectCustomer.Gender = (Gender)model.Gender; } prospectCustomer.BirthDate = model.DateOfBirth; prospectCustomer.Email = string.IsNullOrEmpty(model.Email) ? null : new Email(model.Email); prospectCustomer.CallBackPhoneNumber = PhoneNumber.Create(model.CallBackPhoneNumber, PhoneNumberType.Home); if (model.Address != null) { prospectCustomer.Address.StreetAddressLine1 = model.Address.StreetAddressLine1; prospectCustomer.Address.StreetAddressLine2 = model.Address.StreetAddressLine2; if (model.Address.StateId > 0) { var state = _stateRepository.GetState(model.Address.StateId); prospectCustomer.Address.State = state.Name; } if (!string.IsNullOrEmpty(model.Address.City)) { prospectCustomer.Address.City = model.Address.City; } prospectCustomer.Address.ZipCode = new ZipCode(model.Address.ZipCode); } ((IUniqueItemRepository <ProspectCustomer>)_prospectCustomerRepository).Save(prospectCustomer); return(true); }
public CallQueueCustomerEditModel GetCallQueueCustomerEditModel(CustomerContactViewModel model, bool isHealthPlanCallQueue) { var editModel = new CallQueueCustomerEditModel(); editModel.CustomerId = model.PatientInfomation.CustomerId.Value; editModel.ProspectCustomerId = model.PatientInfomation.ProspectCustomerId.HasValue ? model.PatientInfomation.ProspectCustomerId.Value : 0; editModel.FirstName = model.PatientInfomation.FirstName; editModel.LastName = model.PatientInfomation.LastName; editModel.Gender = (int)model.PatientInfomation.Gender; editModel.Email = model.PatientInfomation.Email; editModel.AlternateEmail = model.PatientInfomation.AlternateEmail; editModel.UserId = model.PatientInfomation.UserId; editModel.DateOfBirth = model.PatientInfomation.DateOfBirth; editModel.CallId = model.CallId; editModel.CallQueueCustomerId = model.PatientInfomation.CallQueueCustomerId; editModel.CallBackPhoneNumber = model.PatientInfomation.CallBackPhoneNumber.FormatPhoneNumber; editModel.OfficePhoneNumber = model.PatientInfomation.OfficePhoneNumber.FormatPhoneNumber; editModel.MobilePhoneNumber = model.PatientInfomation.MobilePhoneNumber.FormatPhoneNumber; editModel.IsHealthPlanQueue = isHealthPlanCallQueue; editModel.Hicn = model.PatientInfomation.HicnNumber; editModel.Mbi = model.PatientInfomation.MbiNumber; editModel.MemberId = model.PatientInfomation.MemberId; editModel.ActivityId = model.PatientInfomation.ActivityId; editModel.Address = new AddressEditModel { City = model.PatientInfomation.AddressViewModel.City, CountryId = 1, StateId = model.PatientInfomation.AddressViewModel.StateId, StreetAddressLine1 = model.PatientInfomation.AddressViewModel.StreetAddressLine1, StreetAddressLine2 = model.PatientInfomation.AddressViewModel.StreetAddressLine2, ZipCode = model.PatientInfomation.AddressViewModel.ZipCode }; if (model.PatientInfomation.PrimaryCarePhysician != null) { editModel.PrimaryCarePhysician = new Core.Medical.ViewModels.PrimaryCarePhysicianEditModel { FullName = model.PatientInfomation.PrimaryCarePhysician.FullName, Address = model.PatientInfomation.PrimaryCarePhysician.Address == null ? new AddressEditModel() { CountryId = 1 } : new AddressEditModel { City = model.PatientInfomation.PrimaryCarePhysician.Address.City, CountryId = 1, StreetAddressLine1 = model.PatientInfomation.PrimaryCarePhysician.Address.StreetAddressLine1, StreetAddressLine2 = model.PatientInfomation.PrimaryCarePhysician.Address.StreetAddressLine2, ZipCode = model.PatientInfomation.PrimaryCarePhysician.Address.ZipCode, StateId = model.PatientInfomation.PrimaryCarePhysician.Address.StateId }, MailingAddress = model.PatientInfomation.PrimaryCarePhysician.MailingAddress == null ? new AddressEditModel() { CountryId = 1 } : new AddressEditModel { City = model.PatientInfomation.PrimaryCarePhysician.MailingAddress.City, CountryId = 1, StreetAddressLine1 = model.PatientInfomation.PrimaryCarePhysician.MailingAddress.StreetAddressLine1, StreetAddressLine2 = model.PatientInfomation.PrimaryCarePhysician.MailingAddress.StreetAddressLine2, ZipCode = model.PatientInfomation.PrimaryCarePhysician.MailingAddress.ZipCode, StateId = model.PatientInfomation.PrimaryCarePhysician.MailingAddress.StateId }, Email = model.PatientInfomation.PrimaryCarePhysician.Email, Phone = model.PatientInfomation.PrimaryCarePhysician.Phone, HasSameAddress = model.PatientInfomation.PrimaryCarePhysician.HasSameAddress }; } editModel.EnableEmail = model.PatientInfomation.EnableEmail; return(editModel); }