Beispiel #1
0
		public GeocodingArg(ValidateAddressArg arg)
		{
			Street = arg.Street;
			City = arg.City;
			State = arg.State;
			ZIP = arg.ZIP;
		}
		public ValidateAddressResult ValidateAddress(ValidateAddressArg addressArg)
		{
			var validationAddressResult = new ValidateAddressResult
			{
				IsValid = true
			};
			return validationAddressResult;
		}
Beispiel #3
0
		public ValidateAddressResult ValidateAddress(ValidateAddressArg addressArg)
		{
			var countyExists = false;

			_geocodingDataService.ResolveData(new GeocodingArg(addressArg), (result, arg) =>
			{
				countyExists = !string.IsNullOrWhiteSpace(result.County);
			});

			return new ValidateAddressResult { IsValid = countyExists };
		}
		private bool CheckValidity(AppraisalCompanyAddViewModel model)
		{
			var validateAddress = new ValidateAddressArg
			{
				City = model.PhysicalAddress.City,
				State = model.PhysicalAddress.State,
				Street = model.PhysicalAddress.Street,
				ZIP = model.PhysicalAddress.ZIP
			};
			var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
			if (!geocodingValidationResult.IsValid)
			{
				model.AddressValidationFailedMessage = Constants.ErrorMessages.GeocodingVerificationError;
			}
			return geocodingValidationResult.IsValid && ModelState.IsValid;
		}
		public ActionResult ServiceArea(AppraiserUserServiceAreaViewModel serviceAreaModel, NotRequiredAddressViewModel serviceAreaAddress, string nextStep,
				int? userId = null)
		{
			if (serviceAreaModel.EditUserId == 0)
			{
				serviceAreaModel.EditUserId = userId.HasValue ? userId.Value : 0;
			}
			if (serviceAreaModel.ServiceAreaCenterpoint == 0)
			{
				return RedirectToStep(nextStep, serviceAreaModel.EditUserId, serviceAreaModel.IsOwnPage);
			}
			if (ModelState.IsValid)
			{
				if (serviceAreaAddress != null)
				{
					serviceAreaModel.ServiceAreaAddress = serviceAreaAddress;
				}
				serviceAreaModel.IsAddressReadOnly = SafeConvert.ToBool(Session[SiteConstants.SessionConstants.AppraiserServiceAreaIsReadonly]) ?? true;
				var validateAddress = _appraiserUserService.GetGeocodingAddress(serviceAreaModel, SecurityContext.CurrentUser.Email);
				var validateAddressArg = new ValidateAddressArg
																														{
																															City = validateAddress.City,
																															State = validateAddress.State,
																															Street = validateAddress.Street,
																															ZIP = validateAddress.ZIP
																														};
				var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddressArg);
				if (!geocodingValidationResult.IsValid)
				{
					ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
					return GetServiceAreaView(serviceAreaModel, serviceAreaModel.EditUserId);
				}
				_appraiserUserService.SaveAppraiserServiceArea(serviceAreaModel, User.Identity.Name);
				CommitProviderInstance.Commit();
				return RedirectToStep(nextStep, serviceAreaModel.EditUserId, serviceAreaModel.IsOwnPage);
			}
			TempData[_appraiserServiceAreaKey] = serviceAreaModel;
			return RedirectToStep(NameHelper.AppraiserProfile.ServiceArea, serviceAreaModel.EditUserId, serviceAreaModel.IsOwnPage);
		}
		public ActionResult Contact(AppraiserUserContactViewModel contactModel, string nextStep, int? userId)
		{
			if (contactModel.EditUserId == 0)
			{
				contactModel.EditUserId = userId.HasValue ? userId.Value : 0;
			}
			if (ModelState.IsValid)
			{
				var validateAddress = new ValidateAddressArg
				{
					City = string.IsNullOrEmpty(contactModel.PhysicalAddress.City) ? string.Empty : contactModel.PhysicalAddress.City,
					State = string.IsNullOrEmpty(contactModel.PhysicalAddress.State) ? string.Empty : contactModel.PhysicalAddress.State,
					Street = string.IsNullOrEmpty(contactModel.PhysicalAddress.Street) ? string.Empty : contactModel.PhysicalAddress.Street,
					ZIP = string.IsNullOrEmpty(contactModel.PhysicalAddress.ZIP) ? string.Empty : contactModel.PhysicalAddress.ZIP
				};

				var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
				if (geocodingValidationResult != null && !geocodingValidationResult.IsValid)
				{
					ViewBag.CurrentControllerName = NameHelper.AppraiserProfile.Controller;
					ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
					return GetContactView(contactModel, contactModel.EditUserId);
				}

				_appraiserUserService.SaveAppraiserContact(contactModel, User.Identity.Name);
				CommitProviderInstance.Commit();
				return RedirectToStep(nextStep, contactModel.EditUserId, contactModel.IsOwnPage);
			}

			TempData[_appraiserContactKey] = contactModel;
			return RedirectToStep(NameHelper.AppraiserProfile.Contact, contactModel.EditUserId, contactModel.IsOwnPage);
		}
		public ActionResult Contact(int id, AppraisalCompanyContactViewModel appraisalCompanyContact, int? nextStep)
		{
			if (ModelState.IsValid)
			{
				var validateAddress = new ValidateAddressArg
				{
					City = appraisalCompanyContact.PhysicalAddress.City,
					State = appraisalCompanyContact.PhysicalAddress.State,
					Street = appraisalCompanyContact.PhysicalAddress.Street,
					ZIP = appraisalCompanyContact.PhysicalAddress.ZIP
				};
				var geocodingIsResolved = _geocodingValidation.ValidateAddress(validateAddress).IsValid;
				if (geocodingIsResolved)
				{
					_appraisalCompanyWizardService.SaveAppraisalCompanyContact(id, appraisalCompanyContact);
					CommitProviderInstance.Commit();
					return RedirectToStep(id, nextStep ?? (int)TabSteps.Contact);
				}
				TempData[GeocodingErrorMessageKey] = Constants.ErrorMessages.GeocodingVerificationError;
				TempData[AppraisalCompanyContactKey] = appraisalCompanyContact;
				return RedirectToAction(NameHelper.AppraisalCompanyDetails.Contact);
			}
			TempData[AppraisalCompanyContactKey] = appraisalCompanyContact;
			return RedirectToAction(NameHelper.AppraisalCompanyDetails.Contact);
		}
		public ActionResult AddCompanyBranch(int companyId, AppraisalCompanyBranchViewModel companyBranchViewModel)
		{
			if (ModelState.IsValid)
			{
				var validateAddress = new ValidateAddressArg
				{
					City = companyBranchViewModel.AddressViewModel.City,
					State = companyBranchViewModel.AddressViewModel.State,
					Street = companyBranchViewModel.AddressViewModel.Street,
					ZIP = companyBranchViewModel.AddressViewModel.ZIP
				};
				var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
				if (!geocodingValidationResult.IsValid)
				{
					ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
					return PartialView(EditBranchDialog, companyBranchViewModel);
				}
				_propertyCurrentCompanyService.CurrentCompany = companyId;
				bool? geocodingIsResolved;
				_branchesService.AddBranch(companyBranchViewModel, out geocodingIsResolved);
				_brancheMessagesService.AddBranche();
				CommitProviderInstance.Commit();
			}
			ModelState.Clear();
			return ShowAddBranchPopup(companyId, true);
		}
		public ActionResult Contact(AppraisalCompanyContactViewModel appraisalCompanyContact, int? nextStep)
		{
			if (ModelState.IsValid)
			{
				var validateAddress = new ValidateAddressArg
				{
					City = appraisalCompanyContact.PhysicalAddress.City,
					State = appraisalCompanyContact.PhysicalAddress.State,
					Street = appraisalCompanyContact.PhysicalAddress.Street,
					ZIP = appraisalCompanyContact.PhysicalAddress.ZIP
				};
				var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
				if (!geocodingValidationResult.IsValid)
				{
					ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
					return GetContactView(appraisalCompanyContact);
				}
				var appraisalCompanyId = GetAppraisalCompanyId();
				_appraisalCompanyWizardService.SaveAppraisalCompanyContact(appraisalCompanyId, appraisalCompanyContact);
				CommitProviderInstance.Commit();
				return RedirectToStep(nextStep);
			}

			TempData[AppraisalCompanyContactKey] = appraisalCompanyContact;
			return RedirectToAction(NameHelper.AppraisalCompanyProfile.Contact);
		}
		public ActionResult Contact(AppraisalCompanyContactViewModel appraisalCompanyContact, int? nextStep, bool? isNextBanking = null, bool? preBankingPopupCompleted = null)
		{
			const int currentStep = (int)TabIndex.Contact;
			if ((nextStep ?? currentStep) <= currentStep || ModelState.IsValid)
			{
				var appraisalCompanyId = GetAppraisalCompanyId();
				//geocoding validation if next button is pressed
				if (nextStep != currentStep && !(preBankingPopupCompleted.HasValue && preBankingPopupCompleted.Value))
				{
					var validateAddress = new ValidateAddressArg
					{
						City = string.IsNullOrEmpty(appraisalCompanyContact.PhysicalAddress.City) ? string.Empty : appraisalCompanyContact.PhysicalAddress.City,
						State = string.IsNullOrEmpty(appraisalCompanyContact.PhysicalAddress.State) ? string.Empty : appraisalCompanyContact.PhysicalAddress.State,
						Street = string.IsNullOrEmpty(appraisalCompanyContact.PhysicalAddress.Street) ? string.Empty : appraisalCompanyContact.PhysicalAddress.Street,
						ZIP = string.IsNullOrEmpty(appraisalCompanyContact.PhysicalAddress.ZIP) ? string.Empty : appraisalCompanyContact.PhysicalAddress.ZIP
					};
					var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
					if (!geocodingValidationResult.IsValid)
					{
						ViewBag.ControllerName = CurrentControllerName;
						ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
						return GetContactView(appraisalCompanyContact);
					}
				}
				_appraisalCompanyService.SaveAppraisalCompanyContact(appraisalCompanyId, appraisalCompanyContact);
				SaveLastCompletedStep(currentStep, nextStep);
				CommitProviderInstance.Commit();
				if (isNextBanking ?? false)
				{
					TempData["ShowPrebankingPopup"] = true;
					ViewBag.PreBankingAction = NameHelper.AppraisalCompanyWizard.Banking;
					ViewBag.PreBankingController = NameHelper.AppraisalCompanyWizard.Controller;

					return RedirectToStep((int)TabIndex.Contact);
				}
				if (!preBankingPopupCompleted.HasValue || !preBankingPopupCompleted.Value)
				{
					if (!nextStep.HasValue || nextStep.Value == currentStep)
					{
						TempData["SaveDraft"] = true;
					}
				}
				if (preBankingPopupCompleted.HasValue && preBankingPopupCompleted.Value)
				{
					nextStep = currentStep + 1;
				}
				if (!nextStep.HasValue || nextStep.Value > currentStep)
				{
					CompanyWizzardMenuManager.SetCompleteMenuIndex(currentStep);
				}
				return RedirectToStep(nextStep ?? currentStep);
			}

			ViewBag.ControllerName = CurrentControllerName;
			ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
			return GetContactView(appraisalCompanyContact);
		}
Beispiel #11
0
		public ActionResult ServiceArea(AppraiserUserServiceAreaViewModel serviceAreaModel, NotRequiredAddressViewModel serviceAreaAddress, int? nextStep, bool? isNextBanking = false, bool? isSubmit = null)
		{
			if ((nextStep ?? (int)TabIndex.ServiceArea) <= (int)TabIndex.ServiceArea || ModelState.IsValid)
			{
				if (serviceAreaAddress != null)
				{
					serviceAreaModel.ServiceAreaAddress = serviceAreaAddress;
				}
				if ((nextStep ?? (int)TabIndex.ServiceArea) == (int)TabIndex.Banking)
				{
					serviceAreaModel.IsAddressReadOnly = SafeConvert.ToBool(Session[SiteConstants.SessionConstants.AppraiserServiceAreaIsReadonly]) ?? true;
					var validateAddress = _appraiserUserService.GetGeocodingAddress(serviceAreaModel, SecurityContext.CurrentUser.Email);
					var validateAddressArg = new ValidateAddressArg
					{
						City = validateAddress.City,
						State = validateAddress.State,
						Street = validateAddress.Street,
						ZIP = validateAddress.ZIP
					};
					var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddressArg);
					if (!geocodingValidationResult.IsValid)
					{
						ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
						return GetServiceAreaView(serviceAreaModel);
					}
					_appraiserUserService.SaveAppraiserServiceArea(serviceAreaModel, User.Identity.Name);
					SaveLastCompletedStep(TabIndex.ServiceArea, nextStep);
			
					CommitProviderInstance.Commit();
				}
				if (isNextBanking ?? false)
				{
					TempData["ShowPrebankingPopup"] = true;
					ViewBag.PreBankingAction = NameHelper.AppraiserWizard.Banking;
					ViewBag.PreBankingController = NameHelper.AppraiserWizard.Controller;

					//adding test order for current appraiser
					var order = _testOrderManager.CreateTestOrderForCurrentAppraiser();
					CommitProviderInstance.Commit();
					if (order != null)
					{
						_taskManager.GenerateLOEDocument(order.Id, base.SecurityContext.CurrentUser.Id);
					}

					return RedirectToStep(TabIndex.ServiceArea);
				}
				if (isSubmit ?? false)
				{
					TempData["ShowProceedPopup"] = true;
					TempData[_appraiserServiceAreaKey] = serviceAreaModel;
				}
				else if (!nextStep.HasValue || nextStep.Value == (int)TabIndex.ServiceArea)
				{
					TempData["SaveDraft"] = true;
				}
				CommitProviderInstance.Commit();
				return RedirectToStep(SafeConvert.ToEnum<TabIndex>(nextStep) ?? TabIndex.ServiceArea);
			}
			TempData[_appraiserServiceAreaKey] = serviceAreaModel;
			return RedirectToStep(TabIndex.ServiceArea);
		}
Beispiel #12
0
		public ActionResult Contact(AppraiserUserContactViewModel contactModel, int? nextStep)
		{
			if ((nextStep ?? (int)TabIndex.Contact) <= (int)TabIndex.Contact || ModelState.IsValid)
			{
				if (!nextStep.HasValue || nextStep.Value == (int)TabIndex.Contact)
				{
					TempData["SaveDraft"] = true;
					_appraiserUserService.SaveAppraiserContact(contactModel, User.Identity.Name);
					SaveLastCompletedStep(TabIndex.Contact, nextStep);
					CommitProviderInstance.Commit();
					return RedirectToStep(SafeConvert.ToEnum<TabIndex>(nextStep) ?? TabIndex.Contact);
				}
				var validateAddress = new ValidateAddressArg
				{
					City = contactModel.PhysicalAddress.City,
					State = contactModel.PhysicalAddress.State,
					Street = contactModel.PhysicalAddress.Street,
					ZIP = contactModel.PhysicalAddress.ZIP
				};
				var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
				if (geocodingValidationResult.IsValid)
				{
					_appraiserUserService.SaveAppraiserContact(contactModel, User.Identity.Name);
					SaveLastCompletedStep(TabIndex.Contact, nextStep);
					CommitProviderInstance.Commit();
					return RedirectToStep(SafeConvert.ToEnum<TabIndex>(nextStep) ?? TabIndex.Contact);
				}
				ViewBag.GeocodingErrorMessage = Constants.ErrorMessages.GeocodingVerificationError;
				return GetContactView(contactModel);

			}
			TempData[_appraiserContactKey] = contactModel;
			return RedirectToStep(TabIndex.Contact);
		}
Beispiel #13
0
		public ActionResult SaveAppraiserUser(AppraiserUserCreateViewModel user, AppraiserUserCompanyInfoViewModel company, bool? toRedirect)
		{
			var validateAddress = new ValidateAddressArg
			{
				City = user.Contact.PhysicalAddress.City,
				State = user.Contact.PhysicalAddress.State,
				Street = user.Contact.PhysicalAddress.Street,
				ZIP = user.Contact.PhysicalAddress.ZIP
			};
			var geocodingValidationResult = _geocodingValidation.ValidateAddress(validateAddress);
			if (!geocodingValidationResult.IsValid)
			{
				TempData[GeocodingErrorMessage] = Constants.ErrorMessages.GeocodingVerificationError;
				TempData[_appraiserCreationKey] = user;

				return RedirectToAction(NameHelper.AppraiserUserAdd.Index);
			}
			user.CompanyInfo = company;
			SkipConditionalValidation(user);
			if (!ModelState.IsValid)
			{
				return View(NameHelper.AppraiserUserAdd.Index, user);
			}
			SaveUser(user);
			_taskManager.ScheduleManuallyRegisteredUserNotification(user.GeneralInfo.Email, user.GeneralInfo.Password);
			if (toRedirect.GetValueOrDefault(false))
			{
				if (!string.IsNullOrEmpty(user.PreviousUrl))
				{
					return Redirect(user.PreviousUrl);
				}
				return View(NameHelper.AppraiserUserAdd.Index, user);
			}
			AppraiserUserCreateViewModel newUser = new AppraiserUserCreateViewModel();
			newUser.PreviousUrl = user.PreviousUrl;
			newUser.Contact.Phones.PhoneItems.Add(new PhoneItemViewModel() { Id = Guid.NewGuid().ToString(), PhoneType = PhoneType.Mobile });
			TempData[_appraiserCreationKey] = newUser;
			if (!string.IsNullOrEmpty(user.PreviousUrl) && user.PreviousUrl.Contains(NameHelper.AppraisalCompaniesPipeline.Controller))
			{
				return RedirectToAction(NameHelper.AppraiserUserAdd.Index, new { appraisalCompanyId = company.CompanyID });
			}
			return RedirectToAction(NameHelper.AppraiserUserAdd.Index);
		}