public DocumentUserType AddOrderDocument(int orderId, Guid fileId, int documentType, string documentDescription) { var appraiserRoles = new RoleType[] { RoleType.Appraiser, RoleType.CompanyAdminAndAppraiser, RoleType.AppraisalCompanyAdmin }; var user = _securityContext.CurrentUser; DocumentUserType userType; if (appraiserRoles.Contains(user.PrimaryRole.RoleType) || documentType == (int)DocumentType.AppraisalReportPDF || documentType == (int)DocumentType.AppraisalReportReviewPDF || documentType == (int)DocumentType.ACIXML) userType = DocumentUserType.Appraisal; else userType = DocumentUserType.Lender; _orderHistoryManager.AddDocumentUploadedNote(orderId, documentType, documentDescription); OrderDocumentInfo orderDocumentInfo = new OrderDocumentInfo() { DocumentDescription = documentDescription, DocumentTypeId = documentType, FileId = fileId, UserType = userType, OrderId = orderId }; _orderDocumentsRepository.Add(orderDocumentInfo); return userType; }
public void SaveLoanAndContactInfo(OrderLoanAndContactInfoViewModel viewModel) { var order = _orderManager.GetOrderById(viewModel.OrderId); CheckOrderAccessForClients(order); var orderLoanAndContactInfo = order.LoanAndContactInfo; order.LoanAndContactInfo = orderLoanAndContactInfo; orderLoanAndContactInfo.LoanPurposeTypeId = viewModel.LoanPurpose == 0 ? null : viewModel.LoanPurpose; orderLoanAndContactInfo.PurchasePrice = viewModel.PurchasePrice; orderLoanAndContactInfo.Instructions.Clear(); if (viewModel.Instructions != null) { foreach (var instructionId in viewModel.Instructions) { orderLoanAndContactInfo.Instructions.Add(_orderManager.GetSpecialInstructionAndRequirementById(instructionId)); } } if (orderLoanAndContactInfo.PurchaseContractFileGuid != viewModel.ContactFileId) { if (orderLoanAndContactInfo.PurchaseContractFileGuid.HasValue) { var docInfo = _orderDocumentsRepository.Get(di => di.FileId == orderLoanAndContactInfo.PurchaseContractFileGuid).FirstOrDefault(); _orderDocumentsRepository.Delete(docInfo); _documentService.DeleteDocument(orderLoanAndContactInfo.PurchaseContractFileGuid.Value); } orderLoanAndContactInfo.PurchaseContractFileGuid = viewModel.ContactFileId; if (viewModel.ContactFileId.HasValue) { OrderDocumentInfo orderDocumentInfo = new OrderDocumentInfo() { DocumentTypeId = (int)DocumentType.PurchaseContract, FileId = viewModel.ContactFileId, UserType = DocumentUserType.Lender, OrderId = viewModel.OrderId }; _orderDocumentsRepository.Add(orderDocumentInfo); } } }
public void SaveAppraisalInfo(OrderAppraisalInfoViewModel viewModel) { var order = _orderManager.GetOrderById(viewModel.OrderId); CheckOrderAccessForClients(order); order.AppraisalInfo = order.AppraisalInfo ?? new OrderAppraisalInfo(); viewModel.FillModel(order.AppraisalInfo); if (viewModel.FileId != null) { OrderDocumentInfo orderDocumentInfo = new OrderDocumentInfo() { DocumentDescription = "Original Appraisal", DocumentTypeId = (int)DocumentType.Other, FileId = viewModel.FileId, UserType = DocumentUserType.Lender, OrderId = viewModel.OrderId }; _orderDocumentsRepository.Add(orderDocumentInfo); } }