Beispiel #1
0
        //public static void ApplyClassCollection( MailRoomViewModel mailRoomViewModel )
        //{
        //    if ( mailRoomViewModel.MailRoomItems != null )
        //    {
        //        // Business rule
        //        foreach ( var item in mailRoomViewModel.MailRoomItems )
        //        {
        //            if ( item.LockExpiration < DateTime.Now && item.LockExpiration != DateTime.MinValue && ( item.LockStatus == -1 || (LockStatus)item.LockStatus != LockStatus.LockRequested ))
        //            {
        //                item.ClassCollection = "mailroomtablelistduedate";
        //            }
        //            else
        //            {
        //                item.ClassCollection = "mailroomtablelist";
        //            }

        //            if ( item.ExceptionItemMaxWeight != -1 )
        //            {
        //                item.ExceptionClassCollection = item.ExceptionItemMaxWeight < 300
        //                                                    ? "exceptionIcon exceptionIcon0"
        //                                                    : "exceptionIcon exceptionIcon1";
        //            }
        //        }
        //    }
        //}

        public static void ChangeStatusesForDocumentsToSent(Guid loanId, int userAccountId, DocumentClass documentClass)
        {
            DocumentsServiceFacade documentsServiceFacade = new DocumentsServiceFacade();

            List <UploadedFile> listOfUploadedFiles = null;

            if (documentClass.Equals(DocumentClass.LoanDisclosuresPackage))
            {
                listOfUploadedFiles = documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.LoanDisclosuresPackage, loanId);
                listOfUploadedFiles.AddRange(documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.InitialDisclosuresMailingCoverLetter, loanId));
                listOfUploadedFiles.AddRange(documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.AuthorizationsPackage, loanId));
            }

            if (documentClass.Equals(DocumentClass.LoanReDisclosuresPackage))
            {
                listOfUploadedFiles = documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.LoanReDisclosuresPackage, loanId);
                listOfUploadedFiles.AddRange(documentsServiceFacade.RetrieveUploadedFilesByDocumentClass(( int )DocumentClass.ReDisclosuresMailingCoverLetter, loanId));
            }

            if (listOfUploadedFiles != null && listOfUploadedFiles.Any())
            {
                List <UploadedFile> listOfUploadedFilesForChangeStatus = new List <UploadedFile>();

                if (listOfUploadedFiles.Any(f => f.CurrentStatus == UploadedFileStatus.Delivered))
                {
                    listOfUploadedFilesForChangeStatus = listOfUploadedFiles.Where(f => f.CurrentStatus == UploadedFileStatus.Delivered).ToList();
                }

                for (int i = 0; i < listOfUploadedFilesForChangeStatus.Count; i++)
                {
                    if (i == 0)
                    {
                        DocumentsServiceFacade.ChangeUploadedFileStatus(loanId, listOfUploadedFilesForChangeStatus[i].UploadedFileId, UploadedFileStatus.Sent, userAccountId, true);
                    }
                    else
                    {
                        DocumentsServiceFacade.ChangeUploadedFileStatus(loanId, listOfUploadedFilesForChangeStatus[i].UploadedFileId, UploadedFileStatus.Sent, userAccountId, false);
                    }
                }
            }
        }