public StatusPointsViewModel(AppraiserOrder appraiserOrder) { if (appraiserOrder == null) { throw new ArgumentNullException("appraiserOrder"); } OrderNumber = appraiserOrder.Order.OrderPublicId; LoanNumber = appraiserOrder.Order.GeneralInfo.LoanNumber; BorrowerName = appraiserOrder.Order.GetBorrowerName(); PropertyAddress = appraiserOrder.Order.GeneralInfo.PropertyAddress; Status = appraiserOrder.IsDeclined ? AppraiserOrderStatus.Decline : appraiserOrder.Order.AcceptedAppraiserUserId != null ? AppraiserOrderStatus.AcceptedSuccessfully : AppraiserOrderStatus.Pending; OrderAccepted = appraiserOrder.Order.AcceptDate; ReturnedByDvs = DateTime.Now; ReSubmittedToDvs = DateTime.Now; Validated = DateTime.Now; InspectionScheduled = DateTime.Now; InspectionCompleted = DateTime.Now; SubmittedToDvs = DateTime.Now; ConditionCreated = DateTime.Now; ConditionResolved = DateTime.Now; AppraiserOrderId = appraiserOrder.Id; OrderId = appraiserOrder.OrderId; if (appraiserOrder.AppraiserUser != null) { AppraisalFullName = appraiserOrder.AppraiserUser.GetAppraiserFullName(); AppraisalEmail = appraiserOrder.AppraiserUser.GetAppraiserEmail(); } }
public RequestDetailsViewModel(Order order, IReferenceManagement refManager, AppraiserOrder appraiserOrder, ISecurityContext securityContext) { if (order != null) { bool isAppraiserUser = new RoleType[] { RoleType.AppraisalCompanyAdmin, RoleType.Appraiser, RoleType.CompanyAdminAndAppraiser } .Contains(securityContext.CurrentUser.PrimaryRole.RoleType); bool isDVSUser = new RoleType[] { RoleType.DvsAdmin, RoleType.DvsDisbursementsProcessor, RoleType.DvsSuperAdmin } .Contains(securityContext.CurrentUser.PrimaryRole.RoleType); AcceptOrderData = new RequestDetailsAcceptOrderViewModel(); if (appraiserOrder != null) { Distance = appraiserOrder.Distance; AppraiserOrderId = appraiserOrder.Id; AllowAcceptDeclineOrder = appraiserOrder.Order.OrderStatus == OrderStatus.PendingAssignment && (isDVSUser || (!appraiserOrder.IsDeclined && isAppraiserUser)); AcceptOrderData.DefaultAppraiserId = appraiserOrder.AppraiserUser.Id; AcceptOrderData.DefaultAppraiserFirstName = appraiserOrder.AppraiserUser.User.FirstName; AcceptOrderData.DefaultAppraiserLastName = appraiserOrder.AppraiserUser.User.LastName; AcceptOrderData.DefaultAppraiserEmail = appraiserOrder.AppraiserUser.User.Email; AcceptOrderData.IsOtherAppraiser = false; } else { if (order.AcceptedAppraiserUser != null) { AcceptedInfo = String.Format("Accepted on {0} {1} by {2} ({3})", order.AcceptDate.Value.Date.ToString(Constants.DateTimeFormats.Date), order.AcceptDate.Value.ToString(Constants.DateTimeFormats.Time), order.AcceptedAppraiserUser.User.FullName, order.AcceptedAppraiserUser.User.Email); } else { AllowAcceptDeclineOrder = isDVSUser && order.OrderStatus == OrderStatus.PendingAssignment; } AcceptOrderData.IsOtherAppraiser = order.AcceptedAppraiserUser == null; } Address propertyAddress = order.GeneralInfo.PropertyAddress; if (!string.IsNullOrEmpty(order.GeocodingCounty)) propertyAddress.County = order.GeocodingCounty; Address = new AddressWithCountyViewModel { City = propertyAddress.City, County = propertyAddress.County, State = propertyAddress.State, Street = propertyAddress.Street, Street2 = propertyAddress.Street2, ZIP = propertyAddress.ZIP }; IsRush = order.AppraisalInfo.Rush; IsSecondAppraisalOrDuplicateAppraisal = order.AppraisalInfo.SecondDuplicateAppraisal; IsSupplementalREOAddendum = order.AppraisalInfo.SupplementalREOAddendum; DueDate = order.DueDate.Value; AppraisalFormType = order.AppraisalInfo.AppraisalForm.HasValue ? refManager.GetAppraisalForms().Single(e => e.Id == order.AppraisalInfo.AppraisalForm.Value).FormAbbreviation : null; ReviewFormType = order.AppraisalInfo.ReviewForm.HasValue ? refManager.GetAppraisalForms().Single(e => e.Id == order.AppraisalInfo.ReviewForm.Value).FormAbbreviation : null; AppraisalType = order.AppraisalInfo.AppraisalType.Value; LoanPurpose = refManager.GetReference(ReferenceType.LoanPurposeTypes)[order.LoanAndContactInfo.LoanPurposeTypeId.Value]; Occupancy = refManager.GetReference(ReferenceType.OccupancyTypes)[order.AppraisalInfo.OccupancyTypeId.Value]; PropertyType = refManager.GetReference(ReferenceType.PropertyTypes)[order.AppraisalInfo.PropertyTypeId.Value]; LoanType = order.AppraisalInfo.LoanType.HasValue ? order.AppraisalInfo.LoanType.Value.ToString() : Constants.Text.EmptyField; if (order.LoanAndContactInfo.LoanPurpose == Model.Enums.OrderManagement.LoanPurpose.Purchase) PurchasePrice = order.LoanAndContactInfo.PurchasePrice.Value.ToString(); TotalFee = order.AppraisersFee; Instructions = order.LoanAndContactInfo.Instructions != null ? order.LoanAndContactInfo.Instructions.ToList().Select(s => s.Id) : new List<int>(); } }
public NewRequestViewModel(AppraiserOrder appraiserOrder, IAppraisalFormsService formsService) { if (appraiserOrder != null) { OrderNumber = appraiserOrder.Order.OrderPublicId; PropertyAddress = appraiserOrder.Order.GeneralInfo.PropertyAddress; Distance = appraiserOrder.Distance; OrderCreatedDate = appraiserOrder.CreatedDate; Rush = appraiserOrder.Order.AppraisalInfo.Rush; AppraiserOrderId = appraiserOrder.Id; AppraiserId = appraiserOrder.AppraiserId; OrderId = appraiserOrder.OrderId; DueDate = appraiserOrder.Order.DueDate; Form = formsService.GetFormTitle(appraiserOrder.Order.AppraisalInfo, true); if (appraiserOrder.AppraiserUser != null) { AppraisalFullName = appraiserOrder.AppraiserUser.GetAppraiserFullName(); AppraisalEmail = appraiserOrder.AppraiserUser.GetAppraiserEmail(); } Fee = appraiserOrder.Order.AppraisersFee; SupplementalReoAddendum = appraiserOrder.Order.AppraisalInfo.SupplementalREOAddendum; } }
public void SendOrderInvitations(Order order, AppraiserUser[] appraisers) { List<AppraiserOrder> appraiserOrders = new List<AppraiserOrder>(); foreach (var appraiser in appraisers) { var appraiserOrder = _appraiserOrderRepository.Get(e => e.AppraiserId == appraiser.Id && e.OrderId == order.Id).SingleOrDefault(); if (appraiserOrder == null) { appraiserOrder = new AppraiserOrder() { AppraiserUser = appraiser, Distance = (float)GeographyManager.CalculateDistance((double)order.Longitude, (double)order.Latitude, (double)appraiser.ServiceArea.Longitude, (double)appraiser.ServiceArea.Latitude), Order = order, IsDeclined = false, CreatedDate = DateTime.Now }; _appraiserOrderRepository.Add(appraiserOrder); appraiserOrders.Add(appraiserOrder); } } _taskManager.SendAppraiserOrderInvitations(appraiserOrders.ToArray(), (AppraiserOrderDeliveryType)order.AppraiserOrderDeliveryType); }
public AppraiserOrder CreateAppraiserOrder(Order order, AppraiserUser appraiser) { var appraiserOrder = new AppraiserOrder() { AppraiserUser = appraiser, AppraiserId = appraiser.Id, Distance = (float)GeographyManager.CalculateDistance((double)order.Longitude, (double)order.Latitude, (double)appraiser.ServiceArea.Longitude, (double)appraiser.ServiceArea.Latitude), Order = order, IsDeclined = false, CreatedDate = DateTime.Now }; return appraiserOrder; }
private AppraiserOrder GetChildAppraiserOrder(AppraiserOrder appraiserOrder) { return _appraiserOrderRepository.GetAppraiserOrders(o => o.Where(order => order.Order.ParentOrderId == appraiserOrder.Order.Id && order.AppraiserId == appraiserOrder.AppraiserId)).SingleOrDefault(); }
private void CreateDuplicatedAppraisalOrder(AppraiserOrder order) { var appraiserOrders = _appraiserOrderRepository.GetAppraiserOrders(orders => orders.Where(o => o.OrderId == order.OrderId && o.AppraiserId != order.AppraiserId)); var newOrder = _orderManager.CreateOrderDuplicate(order.Order); _commitProvider.Commit(); _orderHistoryManager.AddOrderCreatedNote(newOrder.Id); _orderHistoryManager.AddOrderSetToPendingAssignmentsNote(newOrder.Id); foreach (var appraiser in appraiserOrders.Select(o => o.AppraiserUser)) { _appraiserOrderRepository.Add(new AppraiserOrder { AppraiserUser = appraiser, Order = newOrder, CreatedDate = order.CreatedDate, Distance = order.Distance }); } _commitProvider.Commit(); _taskManager.AssignmentAppraisersForOrder(newOrder.Id, _dateTimeManager.GetNextBusinessDateTime(order.Order.CreationDate, 4)); }
public void AcceptOrder_should_return_DateExpiredOrOrderWasAcceptedByAnotherUser_if_order_was_accepted_by_another_user() { var order = new AppraiserOrder() { Order = new Order() { OrderStatus = OrderStatus.OrderAccepted, AcceptedAppraiserUserId = 3, ClientCompany = new ClientCompany() { Settings = new ClientCompanySettings() { AppraiserLicenseRequirements = AppraiserLicenseRequirementsType.NoPreference, } }, }, AppraiserId = 1, }; _appraiserOrderRepository.GetById(order.Id).Returns(order); // act var actual = Target.AcceptOrder(order.Id); actual.Should().Be(AppraiserOrderSuccessStatus.DateExpiredOrOrderWasAcceptedByAnotherUser); }
public void SendAppraiserOrderInvitations(AppraiserOrder[] appraiserOrders, AppraiserOrderDeliveryType appraiserOrderDeliveryTypes) { foreach (var appraiserOrder in appraiserOrders) { if (appraiserOrderDeliveryTypes.HasFlag(AppraiserOrderDeliveryType.SMS)) { var parameters = new Dictionary<TaskParamsKey, string>(); parameters.Add(TaskParamsKey.PublicOrderId, appraiserOrder.Order.OrderPublicId); parameters.Add(TaskParamsKey.UserId, appraiserOrder.AppraiserUser.User.Id.ToString()); parameters.Add(TaskParamsKey.SMSTemplate, SMSTemplateType.NewAppraisalRequested.ToString()); _backgroundService.AddTask(TaskTypeEnum.SendAppraiserOrderInvitationSMS, parameters); } if (appraiserOrderDeliveryTypes.HasFlag(AppraiserOrderDeliveryType.Email)) { var parameters = new Dictionary<TaskParamsKey, string>(); parameters.Add(TaskParamsKey.PublicOrderId, appraiserOrder.Order.OrderPublicId); parameters.Add(TaskParamsKey.UserId, appraiserOrder.AppraiserUser.User.Id.ToString()); _backgroundService.AddTask(TaskTypeEnum.SendAppraiserOrderInvitationEmail, parameters); } } }
private AppraiserOrderSuccessStatus AcceptOrderInternal(AppraiserOrder appraiserOrder) { AppraiserOrderSuccessStatus result; using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions() { IsolationLevel = IsolationLevel.RepeatableRead })) { var childAppraiserOrder = GetChildAppraiserOrder(appraiserOrder); if (childAppraiserOrder != null) { appraiserOrder = childAppraiserOrder; } Order order = appraiserOrder.Order; var clientCompany = appraiserOrder.Order.ClientCompany ?? appraiserOrder.Order.CreatedByClientUser.Company; if (order.AcceptedAppraiserUserId.HasValue && order.AcceptedAppraiserUserId != appraiserOrder.AppraiserId) { Logger.WriteInfo(String.Format("AcceptOrder. Accepted By Another User order [{0}]", order.Id)); result = AppraiserOrderSuccessStatus.DateExpiredOrOrderWasAcceptedByAnotherUser; } else if (appraiserOrder.Order.DueDate.HasValue && appraiserOrder.Order.DueDate.Value.Date < DateTime.Now.Date) { Logger.WriteInfo(String.Format("AcceptOrder. Order.DueDate <= DateTime.Now appraiserOrderId [{0}]", appraiserOrder.Id)); result = AppraiserOrderSuccessStatus.DateExpiredOrOrderWasAcceptedByAnotherUser; } else if (order.AcceptedAppraiserUserId.HasValue && order.AcceptedAppraiserUserId == appraiserOrder.AppraiserId && !appraiserOrder.IsDeclined) { Logger.WriteInfo(String.Format("AcceptOrder. AcceptResponseDuplication appraiserOrderId [{0}]", appraiserOrder.Id)); result = AppraiserOrderSuccessStatus.AcceptResponseDuplication; } else if (order.AcceptedAppraiserUserId.HasValue && order.AcceptedAppraiserUserId == appraiserOrder.AppraiserId && appraiserOrder.IsDeclined) { Logger.WriteInfo(String.Format("AcceptOrder. DeclineResponseDuplication appraiserOrderId [{0}]", appraiserOrder.Id)); result = AppraiserOrderSuccessStatus.DeclineResponseDuplication; } else if (!IsValidAppraiserByLicense(appraiserOrder.AppraiserUser, order.GeneralInfo.PropertyAddress.State, order.AppraisalInfo.LoanType == LoanType.FHA || clientCompany.Settings.AppraiserLicenseRequirements == AppraiserLicenseRequirementsType.FHAApprovedOnly) || !appraiserOrder.AppraiserUser.User.Roles.Any(e => e.Id == (int)RoleType.Appraiser || e.Id == (int)RoleType.CompanyAdminAndAppraiser)) { Logger.WriteInfo(String.Format("AcceptOrder. Not IsValidAppraiserByLicense appraiserOrderId [{0}]", appraiserOrder.Id)); result = AppraiserOrderSuccessStatus.UserDoesNotSatisfyRequiredCriteria; } else if (appraiserOrder.Order.OrderStatus != OrderStatus.PendingAssignment) { Logger.WriteInfo(String.Format("AcceptOrder. Inappropriate order status, order id [{0}]", appraiserOrder.Order.Id)); result = AppraiserOrderSuccessStatus.DateExpiredOrOrderWasAcceptedByAnotherUser; } else { appraiserOrder.Order.AcceptDate = DateTime.Now; appraiserOrder.Order.AcceptedAppraiserUserId = appraiserOrder.AppraiserId; appraiserOrder.Order.OrderStatus = OrderStatus.OrderAccepted; result = AppraiserOrderSuccessStatus.Successfully; } if (result == AppraiserOrderSuccessStatus.Successfully) { _orderHistoryManager.AddOrderAcceptedNote(order.Id, appraiserOrder.AppraiserUser.User.Id); _orderPeriodicalNotificationManager.SheduleOrderPeriodicalNotifications(order, OrderPeriodicalNotificationType.SheduleInspectionNotification); _orderPeriodicalNotificationManager.SheduleOrderPeriodicalNotifications(order, OrderPeriodicalNotificationType.SheduleInspectionEscalation); if (order.AppraisalInfo.SecondDuplicateAppraisal && !order.ParentOrderId.HasValue) { CreateDuplicatedAppraisalOrder(appraiserOrder); } if (appraiserOrder.Id == default(int)) { _appraiserOrderRepository.Add(appraiserOrder); _commitProvider.Commit(); } } if (appraiserOrder.Id != default(int)) { _appraiserOrderRepository.Update(appraiserOrder); _commitProvider.Commit(); scope.Complete(); } } return result; }
public void AcceptOrder_should_return_DeclineResponseDuplication_if_order_was_declined_by_current_user() { var order = new AppraiserOrder() { Order = new Order() { OrderStatus = OrderStatus.OrderAccepted, AcceptedAppraiserUserId = 1, ClientCompany = new ClientCompany() { Settings = new ClientCompanySettings() { AppraiserLicenseRequirements = AppraiserLicenseRequirementsType.NoPreference, } }, }, AppraiserId = 1, IsDeclined = true }; _appraiserOrderRepository.GetById(order.Id).Returns(order); // act var actual = Target.AcceptOrder(order.Id); actual.Should().Be(AppraiserOrderSuccessStatus.DeclineResponseDuplication); }
private static AppraiserOrderStatus GetAppraiserOrderStatus(AppraiserOrder appraiserOrder) { if (appraiserOrder.IsDeclined) return AppraiserOrderStatus.Decline; else { switch (appraiserOrder.Order.OrderStatus) { case OrderStatus.OrderAccepted: return AppraiserOrderStatus.AcceptedSuccessfully; case OrderStatus.InspectionCompleted: return AppraiserOrderStatus.InspectionCompleted; case OrderStatus.InspectionScheduled: return AppraiserOrderStatus.InspectionScheduled; case OrderStatus.ConditionCreated: return AppraiserOrderStatus.ConditionCreated; case OrderStatus.ConditionResolved: return AppraiserOrderStatus.ConditionResolved; case OrderStatus.ReSubmittedToDVS: return AppraiserOrderStatus.ReSubmittedToDVS; case OrderStatus.SubmittedToDVS: return AppraiserOrderStatus.SubmittedToDVS; case OrderStatus.Cancelled: return AppraiserOrderStatus.Cancelled; case OrderStatus.Completed: return AppraiserOrderStatus.Completed; default: return AppraiserOrderStatus.AcceptedSuccessfully; } } }
public AppraiserOrderSuccessStatus AcceptOrder(AppraiserOrder appraiserOrder) { throw new NotImplementedException(); }
private static PaymentHistoryListItemViewModel CreatePaymentHistoryListItem(AppraiserOrder appraiserOrder) { var result = new PaymentHistoryListItemViewModel(); result.OrderId = appraiserOrder.Order.Id; result.AppraiserOrderId = appraiserOrder.Id; result.OrderNumber = appraiserOrder.Order.OrderPublicId; result.LoanNumber = appraiserOrder.Order.GeneralInfo.LoanNumber; result.BorrowerFirstName = appraiserOrder.Order.GeneralInfo.BorrowerFirstName; result.BorrowerLastName = appraiserOrder.Order.GeneralInfo.BorrowerLastName; if (appraiserOrder.Order.AcceptedAppraiserUser != null) { result.AppraiserFirstName = appraiserOrder.Order.AcceptedAppraiserUser.User.FirstName; result.AppraiserLastName = appraiserOrder.Order.AcceptedAppraiserUser.User.LastName; result.AppraiserEmail = appraiserOrder.Order.AcceptedAppraiserUser.User.Email; } result.PropertyAddress = appraiserOrder.Order.GeneralInfo.PropertyAddress; result.Status = appraiserOrder.Order.OrderStatus.ToString(); result.Fee = (double)appraiserOrder.Order.AppraisersFee; result.PaidDate = appraiserOrder.Order.PaidDate; return result; }
public void AcceptOrder_should_return_UserDoesNotSatisfyRequiredCriteria_if_user_doesnt_have_active_license() { var newOrder = new AppraiserOrder() { AppraiserId = 0, AppraiserUser = new AppraiserUser() { Status = AppraiserUserStatus.Active, Licenses = new List<License>() }, Order = new Order() { GeneralInfo = new OrderGeneralInfo() { PropertyAddress = new Address() { State = "NY" }, }, AppraisalInfo = new OrderAppraisalInfo() { AppraisalTypeId = 1 }, ClientCompany = new ClientCompany() { Settings = new ClientCompanySettings() { AppraiserLicenseRequirements = AppraiserLicenseRequirementsType.NoPreference, } }, } }; _appraiserOrderRepository.GetById(Arg.Any<int>()).Returns(newOrder); // act var actual = Target.AcceptOrder(newOrder.Id); actual.Should().Be(AppraiserOrderSuccessStatus.UserDoesNotSatisfyRequiredCriteria); }
public AppraiserOrderSuccessStatus AcceptOrder(AppraiserOrder appraiserOrder) { return AcceptOrderInternal(appraiserOrder); }
public void AcceptOrder_should_return_Successfully_for_valid_AppraisalCompanyAdminAndAppraiser() { var newOrder = new AppraiserOrder() { AppraiserId = 0, AppraiserUser = new AppraiserUser() { Status = AppraiserUserStatus.Active, Licenses = new List<License>(new License[] { new License() { State = "NY", Status = LicenseStatus.Active } }), User = new User() { Roles = new List<Role>(new Role[] { new Role() { Id = (int)RoleType.CompanyAdminAndAppraiser } }) } }, Order = new Order() { GeneralInfo = new OrderGeneralInfo() { PropertyAddress = new Address() { State = "NY" }, }, AppraisalInfo = new OrderAppraisalInfo() { AppraisalTypeId = 1 }, OrderStatusId = OrderStatus.PendingAssignment.ToString(), ClientCompany = new ClientCompany() { Settings = new ClientCompanySettings() { AppraiserLicenseRequirements = AppraiserLicenseRequirementsType.NoPreference, } }, } }; _appraiserOrderRepository.GetById(Arg.Any<int>()).Returns(newOrder); // act var actual = Target.AcceptOrder(newOrder.Id); actual.Should().Be(AppraiserOrderSuccessStatus.Successfully); }
private Order CreateTestOrderInternal(int appraiserUserId) { var isTestOrderAdded = _orderRepository.Get(o => o.IsTestOrder == true && o.AcceptedAppraiserUserId == appraiserUserId).Count() > 0; if (!isTestOrderAdded) { var order = new Order(); var orderData = _referenceManagement.GetTestOrderData(); #region Populate Fields order.AcceptedAppraiserUserId = appraiserUserId; order.IsTestOrder = true; order.LastCompletedStep = 5; order.AppraisalInfo = new OrderAppraisalInfo { AppraisalForm = int.Parse(orderData[OrderField.AppraisalForm]), AppraisalTypeId = int.Parse(orderData[OrderField.AppraisalTypeId]), LoanTypeId = int.Parse(orderData[OrderField.LoanTypeId]), OccupancyTypeId = int.Parse(orderData[OrderField.OccupancyTypeId]), PropertyTypeId = int.Parse(orderData[OrderField.PropertyTypeId]), Rush = false, SecondDuplicateAppraisal = false, SupplementalREOAddendum = false }; order.AppraiserOrderDeliveryType = (int)AppraiserOrderDeliveryType.Email; order.ClientCompanyId = int.Parse(orderData[OrderField.ClientCompanyId]); order.ClientCompanyBrancheId = int.Parse(orderData[OrderField.ClientCompanyBrancheId]); order.CreatedByClientUserId = int.Parse(orderData[OrderField.CreatedByClientUserId]); order.CreationDate = DateTime.Now; order.DueDate = _businessDaysCalc.GetNextBusinessDay(DateTime.Now, 5); order.FeeInfo = new OrderFeeInfo { IsPlatformUtilizationFeeVisible = true, AppraisalFee = 100, RushFee = 100, SecondAppraisalFee = 100, PlatformUtilizationFee = 100, SupplementalREOAddendumFee = 100 }; order.GeneralInfo = new OrderGeneralInfo { BorrowerFirstName = orderData[OrderField.BorrowerFirstName], BorrowerLastName = orderData[OrderField.BorrowerLastName], LoanNumber = orderData[OrderField.LoanNumber], PropertyAddress = new Address { City = orderData[OrderField.PropertyCity], County = orderData[OrderField.PropertyCounty], State = orderData[OrderField.PropertyState], Street = orderData[OrderField.PropertyStreet], ZIP = orderData[OrderField.PropertyZip] } }; order.LoanAndContactInfo = new OrderLoanAndContactInfo { PurchasePrice = double.Parse(orderData[OrderField.PurchasePrice]), GFEAmount = double.Parse(orderData[OrderField.GFEAmount]), GFEDate = DateTime.Now, LoanPurposeTypeId = int.Parse(orderData[OrderField.LoanPurposeTypeId]), Contacts = new List<OrderContact> { new OrderContact { ContactRoleId = int.Parse(orderData[OrderField.ContactRoleId]), Name = orderData[OrderField.ContactName], Phone = orderData[OrderField.ContactPhone] } } }; order.GeocodingCounty = orderData[OrderField.PropertyCounty]; order.Latitude = 1; order.Longitude = 1; order.OrderPublicId = orderData[OrderField.OrderPublicId]; order.OrderStatus = OrderStatus.OrderAccepted; var appraiserOrder = new AppraiserOrder { AppraiserId = order.AcceptedAppraiserUserId.Value, CreatedDate = order.CreationDate, Distance = 1, IsDeclined = false, Order = order }; if (_configurationHelper.Environment != DvsEnvironment.Local) { var fileName = orderData[OrderField.PurchaseContractFileName]; var purchaseContract = _documentService.GetStaticContent(fileName); var documentInfo = new DocumentInfo(); documentInfo.Name = fileName; documentInfo.DateAdded = DateTime.Now; documentInfo.AddedByUserId = _securityContext.CurrentUser.Id; documentInfo.Size = purchaseContract.Length; var documentStorageId = _documentService.StoreDocument(documentInfo, purchaseContract); order.LoanAndContactInfo.PurchaseContractFileGuid = documentStorageId; _orderDocumentsRepository.Add(new OrderDocumentInfo() { DocumentTypeId = (int)DocumentType.PurchaseContract, FileId = documentStorageId, UserType = DocumentUserType.Lender, OrderId = order.Id }); } #endregion _appraiserOrderRepository.Add(appraiserOrder); return order; } else { return null; } }
private static AppraiserOrderStatus GetAppraiserOrderStatus(AppraiserOrder appraiserOrder) { var result = AppraiserOrderStatus.Pending; if (appraiserOrder.IsDeclined) result = AppraiserOrderStatus.Decline; if (appraiserOrder.Order.AcceptedAppraiserUserId != null) { switch (appraiserOrder.Order.OrderStatus) { case OrderStatus.OrderAccepted: result = AppraiserOrderStatus.AcceptedSuccessfully; break; case OrderStatus.Cancelled: result = AppraiserOrderStatus.Cancelled; break; case OrderStatus.InspectionCompleted: result = AppraiserOrderStatus.InspectionCompleted; break; case OrderStatus.InspectionScheduled: result = AppraiserOrderStatus.InspectionScheduled; break; case OrderStatus.ConditionCreated: result = AppraiserOrderStatus.ConditionCreated; break; case OrderStatus.ConditionResolved: result = AppraiserOrderStatus.ConditionResolved; break; case OrderStatus.ReSubmittedToDVS: result = AppraiserOrderStatus.ReSubmittedToDVS; break; case OrderStatus.SubmittedToDVS: result = AppraiserOrderStatus.SubmittedToDVS; break; default: throw new ArgumentOutOfRangeException("Unknown Order status for ActiveAssigmentsList. Order status: " + appraiserOrder.Order.OrderStatusId); } } return result; }