コード例 #1
0
		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);
		}
コード例 #2
0
		private ActionResult GetServiceAreaView(AppraiserUserServiceAreaViewModel serviceAreaViewModel, int? userId)
		{
			ViewBag.Header = serviceAreaViewModel.SectionTitle;
			ViewBag.IsOwnPage = serviceAreaViewModel.IsOwnPage;
			ViewBag.CurrentStep = NameHelper.AppraiserProfile.ServiceArea;
			return View(NameHelper.AppraiserProfile.ServiceArea, GetViewModel(serviceAreaViewModel, userId));
		}
コード例 #3
0
		public void AppraiserWizard_ServiceArea_valid_model_post_should_redirect_to_software_without_model_and_populate_tempdata_if_nextstep_is_not_specified()
		{
			var model = new AppraiserUserServiceAreaViewModel();
			var actionResult = Target.ServiceArea(model, new NotRequiredAddressViewModel(), null);
			Target.TempData.Should().HaveCount(1);
			Target.TempData["SaveDraft"].Should().Be(true);
			actionResult.Should().NotBeNull().And.BeOfType<RedirectToRouteResult>();
			((RedirectToRouteResult)actionResult).RouteValues.Should().HaveCount(1);
			((RedirectToRouteResult)actionResult).RouteValues["action"].Should().Be("ServiceArea");
		}
コード例 #4
0
		public void AppraiserWizard_ServiceArea_invalid_model_post_should_redirect_to_service_area_with_model()
		{
			Target.ModelState.AddModelError("test error", "test error");

			var model = new AppraiserUserServiceAreaViewModel();
			var actionResult = Target.ServiceArea(model, null, null);
			Target.TempData.Should().HaveCount(1);
			actionResult.Should().NotBeNull().And.BeOfType<RedirectToRouteResult>();
			((RedirectToRouteResult)actionResult).RouteValues.Should().HaveCount(1);
			((RedirectToRouteResult)actionResult).RouteValues["action"].Should().Be("ServiceArea");
		}
コード例 #5
0
		private ActionResult GetServiceAreaView(AppraiserUserServiceAreaViewModel model)
		{
			ViewBag.CurrentStep = (int)TabIndex.ServiceArea;
			return View(NameHelper.AppraiserWizard.ServiceArea, GetWrappedViewModel(model));
		}
コード例 #6
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);
		}