public StatusPointsViewModel(AppraiserOrderSetPoint appraiserOrderSetPoint) { if (appraiserOrderSetPoint == null) { throw new ArgumentNullException("appraiserOrder"); } OrderNumber = appraiserOrderSetPoint.AppraiserOrder.Order.OrderPublicId; LoanNumber = appraiserOrderSetPoint.AppraiserOrder.Order.GeneralInfo.LoanNumber; BorrowerName = appraiserOrderSetPoint.AppraiserOrder.Order.GetBorrowerName(); PropertyAddress = appraiserOrderSetPoint.AppraiserOrder.Order.GeneralInfo.PropertyAddress; Status = GetAppraiserOrderStatus(appraiserOrderSetPoint); OrderAccepted = appraiserOrderSetPoint.AppraiserOrder.Order.AcceptDate; ReturnedByDvs = DateTime.Now; ReSubmittedToDvs = appraiserOrderSetPoint.AppraiserOrder.Order.ReSubmittedToDVSDate; Validated = DateTime.Now; InspectionScheduled = appraiserOrderSetPoint.AppraiserOrder.Order.ScheduleInspectionDate; InspectionCompleted = appraiserOrderSetPoint.AppraiserOrder.Order.InspectionCompleteDate; SubmittedToDvs = appraiserOrderSetPoint.AppraiserOrder.Order.SubmittedToDVSDate; ConditionCreated = appraiserOrderSetPoint.ConditionCreated; ConditionResolved = appraiserOrderSetPoint.ConditionResolved; OrderCompleted = appraiserOrderSetPoint.AppraiserOrder.Order.CompletionDate; AppraiserOrderId = appraiserOrderSetPoint.AppraiserOrder.Id; OrderId = appraiserOrderSetPoint.AppraiserOrder.OrderId; if (appraiserOrderSetPoint.AppraiserOrder.AppraiserUser != null) { AppraisalFullName = appraiserOrderSetPoint.AppraiserOrder.AppraiserUser.GetAppraiserFullName(); AppraisalEmail = appraiserOrderSetPoint.AppraiserOrder.AppraiserUser.GetAppraiserEmail(); } }
private AppraiserOrderStatus GetAppraiserOrderStatus(AppraiserOrderSetPoint appraiserOrderSetPoint) { var result = AppraiserOrderStatus.Pending; if (appraiserOrderSetPoint.AppraiserOrder.IsDeclined) result = AppraiserOrderStatus.Decline; if (appraiserOrderSetPoint.AppraiserOrder.Order.AcceptedAppraiserUserId != null) { switch (appraiserOrderSetPoint.AppraiserOrder.Order.OrderStatus) { case OrderStatus.OrderAccepted: result = AppraiserOrderStatus.AcceptedSuccessfully; break; case OrderStatus.Cancelled: result = AppraiserOrderStatus.Cancelled; break; case OrderStatus.Completed: result = AppraiserOrderStatus.Completed; 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 StatusPointViewModel. Order status: " + appraiserOrderSetPoint.AppraiserOrder.Order.OrderStatusId); } } return result; }