private static bool ArchiveDocument(Upsilab.Data.Model.SignatureTransaction signatureTransaction)
        {
            bool bOK = true; //TODO

            DTPClient dtpClient = new DTPClient(signatureTransaction.idDTPTransaction);

            //1- Update missionDocument table
            //signatoryTransaction.Status = ReportBL.Status.Completed.ToString(); //If signed by all signatories
            DocumentBL.Status docStatus = DocumentBL.Status.Completed;
            DocumentSignatureTransactionBL.UpdateTransactionStatus(signatureTransaction.idSignatureTransaction, docStatus);

            //2- Reduice firm credit after signature + mise au coffre
            //TODO : don't archive, sign doc if credit is not sufficient
            try
            {
                //var firmSDG = Upsilab.Business.Configuration.FirmInstitutionBL.GetFirmInstitutionParentByIdUser(signatureTransaction.idUserCreated);
                var firmSDG = Configuration.FirmInstitutionBL.GetFirmInstitutionParentByIdFirm(signatureTransaction.idFirmInstitution.Value);

                CreditOperationBL.OperationType operationType = CreditOperationBL.OperationType.UNKNOWN;//TODO
                if (signatureTransaction.SignatureTransactionType == DocumentSignatureTransactionBL.SignatureTransactionType.CONVENTION.ToString())
                {
                    operationType = CreditOperationBL.OperationType.SIGNATURE_SDG_CONVENTION;
                }
                else if (signatureTransaction.SignatureTransactionType == DocumentSignatureTransactionBL.SignatureTransactionType.AVENANT.ToString())
                {
                    operationType = CreditOperationBL.OperationType.SIGNATURE_SDG_AVENANT;
                }

                CreditOperationBL.SubstractCredit(firmSDG.idFirmInstitution, operationType.ToString(), signatureTransaction.idUserCreated);
            }
            catch { }

            //3- Save signed document to the server
            var docDocType = ElectronicSafeDocumentBL.DocumentType.DOC.ToString();
            var documentsToSign = (from doc in signatureTransaction.Document
                                   where doc.DocumentType != docDocType && doc.DocumentSignatory.Count > 0
                                   select doc).ToList();

            //TODO - TEST--------------------------------
            //documentsToSign = documentsToSign.Where(x => x.DocumentType == "CPART").ToList();
            //--------------------------------------------

            for (int i = 0; i < documentsToSign.Count; i++)
            {
                try
                {
                    var document = documentsToSign.ElementAt(i);

                    //Document to sign
                    var dtpDocType = (i == 0) ? DTPClient.DocumentTypes.CONTRACT.ToString() : string.Format("{0}{1}", DTPClient.APPENDIX, i);

                    var relativePath = string.Empty;
                    var documentName = ElectronicSafeDocumentBL.BuildDocumentName(document.DocumentType, document.idDocument);
                    var fullPath = ElectronicSafeDocumentBL.BuildSignatureDocumentPath(signatureTransaction.FirmInstitution.FirmInstitutionName, signatureTransaction.FirmInstitution.idFirmInstitution, document.DocumentType.ToDocumentTypeEnum(), false, out relativePath); //CF

                    Upsilab.Infrastructure.DictaoDTPCoreServiceReference.Document dtpDoc = dtpClient.GetDocumentByType(dtpDocType);

                    if (dtpDoc != null)
                    {
                        //Save physically
                        dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

                        //TODO : Save document to ElectronicSafe table
                        var documentLabel = LanguageContentBL.Translate(document.DocumentType.ToLower());

                        //Particular case for "AVENANT"
                        if (signatureTransaction.SignatureTransactionType == DocumentSignatureTransactionBL.SignatureTransactionType.AVENANT.ToString())
                        {
                            documentLabel = document.Designation;
                        }

                        ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, document.DocumentType, documentLabel, relativePath, signatureTransaction.idFirmInstitution.Value, signatureTransaction.idDTPTransaction, null, false, null, null, signatureTransaction.idSignatureTransaction);
                    }
                }
                catch (Exception ex)
                {
                    Log.Log.AppendException(ex);
                }
            } 
      
            //4- Save to coffre document of type "DOC", doc not signed (documents de complétude)
            var clientD3S = new D3SClient();

            var documentsNotSigned = (from doc in signatureTransaction.Document
                                      where doc.DocumentType == docDocType
                                      select doc).ToList();

            foreach (var document in documentsNotSigned)
            {
                try
                {
                    //1- Copy to directory
                    var sourceFilePath = FileManager.GetFileFromUploadDirectory(document.Location, document.Name);

                    var relativePath = string.Empty;
                    var fullPath = ElectronicSafeDocumentBL.BuildSignatureDocumentPath(signatureTransaction.FirmInstitution.FirmInstitutionName, signatureTransaction.FirmInstitution.idFirmInstitution, ElectronicSafeDocumentBL.DocumentType.DOC, false, out relativePath); //CF
                    var destFileName = ElectronicSafeDocumentBL.BuildDocumentName(document.Label, document.idDocument);
                    var destFilePath = Path.Combine(fullPath, destFileName);

                    if (!System.IO.File.Exists(destFilePath))
                    {
                        System.IO.File.Copy(sourceFilePath, destFilePath);

                        //2- Send to dictao
                        var dictaoId = ElectronicSafeDocumentBL.SendToDictaoCoffreFort(sourceFilePath.Replace(document.Name, string.Empty),
                            document.Name, clientD3S);

                        if (!string.IsNullOrEmpty(dictaoId))
                        {
                            var documentLabel = document.DocumentCategory != null ? document.DocumentCategory.Label : document.Name.Split('.')[0];
                            ElectronicSafeDocumentBL.SaveDocumentToDB(destFileName, document.DocumentType, documentLabel, relativePath, signatureTransaction.idFirmInstitution.Value, dictaoId, clientD3S, false, document.IdDocumentCategory, null, signatureTransaction.idSignatureTransaction);
                        }

                    }

                }
                catch (Exception ex)
                {
                    Log.Log.AppendException(ex);
                }
            }


            //5- If all is ok, finish / close transaction
            dtpClient.FinishTransaction();

            IList<string> documentTypesToExcludeOnArchive = null; //TODO

            //6- Archive transaction : TODO : asynchrone ?
            try
            {
                string businessId = string.Format("{0}-{1}", DOCUMENT, signatureTransaction.idSignatureTransaction);
                dtpClient.ArchiveTransaction(string.Empty, string.Empty, string.Empty, businessId, documentTypesToExcludeOnArchive);
            }
            catch { }


            return bOK;
        }
        private static bool ArchiveSignedDER(Upsilab.Data.Model.DER der)
        {
            bool bOK = true; //TODO

            DTPClient dtpClient = new DTPClient(der.idDictao);

            //1- Update missionDocument table
            der.Status = ReportBL.Status.Completed.ToString(); //If signed by the 2 parts and saved to coffrefort
            der.Archived = true;
            der.IsOriginal = true;

            //2- Reduice firm credit after signature + mise au coffre
            //TODO : don't archive, sign doc if credit is not sufficient
            try
            {
                CreditOperationBL.SubstractCredit(der.CustomerProspect.idFirmInstitution, CreditOperationBL.OperationType.MISE_AU_COFFRE_AUTOMATIQUE_DER.ToString(), der.CustomerProspect.idUserCreated, der.CustomerProspect.idCustomer);
            }
            catch { }

            //3- Save signed document to the server 
            //a- CONTRACT
            ElectronicSafeDocumentBL.DocumentType docType = ElectronicSafeDocumentBL.DocumentType.FIL; //<=> DER
            string documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), der.idCustomerProspect);
            string documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), der.CustomerProspect);
            string fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

            Upsilab.Infrastructure.DictaoDTPCoreServiceReference.Document dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.CONTRACT);
            dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

            //4- Save document to ElectronicSafe table
            string docLabel = LanguageContentBL.Translate("der_title");
            string documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), docLabel, (der.DateUpdated.HasValue) ? der.DateUpdated.Value.ToString("dd/MM/yyyy") : der.DateCreated.ToString("dd/MM/yyyy"));

            ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, der.idCustomerProspect, der.idDictao, null);

            //b- APPENDIX 1 : BS
            if (der.AttachPresentation)
            {
                docType = ElectronicSafeDocumentBL.DocumentType.BS;
                documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), der.idCustomerProspect);
                documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), der.CustomerProspect);
                fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

                dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.APPENDIX1);

                if (dtpDoc != null)
                {
                    dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

                    //Save document to ElectronicSafe table
                    documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), LanguageContentBL.Translate("der_bs_title"), (der.DateUpdated.HasValue) ? der.DateUpdated.Value.ToString("dd/MM/yyyy") : der.DateCreated.ToString("dd/MM/yyyy"));

                    ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, der.idCustomerProspect, der.idDictao, null);
                }

            }

            //5- If all is ok, finish / close transaction
            dtpClient.FinishTransaction();

            IList<string> documentTypesToExcludeOnArchive = null; //TODO

            //6- Archive transaction : TODO : asynchrone ?
            try
            {
                string businessId = string.Format("DER-{0}", der.idDer);
                dtpClient.ArchiveTransaction(der.CustomerProspect.FirmInstitution.FirmInstitutionName, der.CustomerProspect.User.UserName, der.CustomerProspect.User.UserFirstName, businessId, documentTypesToExcludeOnArchive);
            }
            catch { }


            return bOK;
        }
        private static bool ArchiveCRTOSignedDocument(Upsilab.Data.Model.CustomerProspect customer)
        {
            bool bOK = true; //TODO

            Upsilab.Data.Model.ConventionRTO crto = customer.ConventionRTO;

            DTPClient dtpClient = new DTPClient(crto.idDictao);

            //1- Update ConfidentialityAgreement table
            crto.Status = ReportBL.Status.Completed.ToString(); //If signed by the 2 parts and saved to coffrefort
            crto.Archived = true;

            //2- Reduice firm credit after signature + mise au coffre
            //TODO : don't archive, sign doc if credit is not sufficient
            try
            {
                CreditOperationBL.SubstractCredit(customer.idFirmInstitution, CreditOperationBL.OperationType.MISE_AU_COFFRE_AUTOMATIQUE_CRTO.ToString(), customer.idUserCreated, customer.idCustomer);
            }
            catch (Exception ex)
            {
                Log.Log.AppendException(ex);
            }

            //3- Save signed document to the server
            string documentName = ElectronicSafeDocumentBL.BuildDocumentName(ElectronicSafeDocumentBL.DocumentType.CRTO.ToString(), customer.idCustomer);
            string documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(ElectronicSafeDocumentBL.DocumentType.CRTO.ToString(), customer);
            string fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

            Upsilab.Infrastructure.DictaoDTPCoreServiceReference.Document dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.CONTRACT);
            dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

            //4- Save document to ElectronicSafe table
            string documentLabel = LanguageContentBL.Translate("signature_crto_title");
            ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, ElectronicSafeDocumentBL.DocumentType.CRTO.ToString(), documentLabel, documentPath, customer.idCustomer, crto.idDictao, null);

            //5- If all is ok, finish / close transaction
            dtpClient.FinishTransaction();

            //6- Archive transaction : TODO : asynchrone ?
            IList<string> documentTypesToExcludeOnArchive = null; //TODO
            try
            {
                string businessId = string.Format("{0}-{1}", CONVENTION_RTO, customer.idCustomer);
                dtpClient.ArchiveTransaction(customer.FirmInstitution.FirmInstitutionName, customer.User.UserName, customer.User.UserFirstName, businessId, documentTypesToExcludeOnArchive);
            }
            catch { }

            return bOK;
        }
        private static bool ArchiveSignedMissionDocument(Upsilab.Data.Model.MissionDocument missionDoc)
        {
            bool bOK = true; //TODO

            DTPClient dtpClient = new DTPClient(missionDoc.idDictao);

            //1- Update missionDocument table
            missionDoc.Status = ReportBL.Status.Completed.ToString(); //If signed by the 2 parts and saved to coffrefort
            missionDoc.Archived = true;
            missionDoc.IsOriginal = true;

            //2- Reduice firm credit after signature + mise au coffre
            //TODO : don't archive, sign doc if credit is not sufficient
            try
            {
                CreditOperationBL.SubstractCredit(missionDoc.CustomerProspect.idFirmInstitution, CreditOperationBL.OperationType.MISE_AU_COFFRE_AUTOMATIQUE_DOCUMENT_MISSION.ToString(), missionDoc.CustomerProspect.idUserCreated, missionDoc.CustomerProspect.idCustomer);
            }
            catch (Exception ex)
            {
                Log.Log.AppendException(ex);
            }

            //3- Save signed document to the server 
            //a- CONTRACT
            ElectronicSafeDocumentBL.DocumentType docType = (missionDoc.IsLetter) ? ElectronicSafeDocumentBL.DocumentType.LM : ElectronicSafeDocumentBL.DocumentType.RM;
            string documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), missionDoc.idCustomerProspect);
            string documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), missionDoc.CustomerProspect);
            string fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

            Upsilab.Infrastructure.DictaoDTPCoreServiceReference.Document dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.CONTRACT);
            dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

            //4- Save document to ElectronicSafe table
            string missionDocLabel = (missionDoc.IsLetter) ? LanguageContentBL.Translate("lettre_de_mission") : LanguageContentBL.Translate("rapport_de_mission");
            string documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), missionDocLabel, (missionDoc.DateUpdated.HasValue) ? missionDoc.DateUpdated.Value.ToString("dd/MM/yyyy") : missionDoc.DateCreated.ToString("dd/MM/yyyy"));

            ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, missionDoc.idCustomerProspect, missionDoc.idDictao, null);

            //b- APPENDIX 1 : BS
            if (missionDoc.AttachPresentation)
            {
                docType = ElectronicSafeDocumentBL.DocumentType.BS;
                documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), missionDoc.idCustomerProspect);
                documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), missionDoc.CustomerProspect);
                fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

                dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.APPENDIX1);

                if (dtpDoc != null)
                {
                    dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

                    //Save document to ElectronicSafe table
                    documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), LanguageContentBL.Translate("presentation_de_l_etab"), (missionDoc.DateUpdated.HasValue) ? missionDoc.DateUpdated.Value.ToString("dd/MM/yyyy") : missionDoc.DateCreated.ToString("dd/MM/yyyy"));

                    ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, missionDoc.idCustomerProspect, missionDoc.idDictao, null);
                }

            }

            //c- APPENDIX 2 : FIL => DER
            if (missionDoc.AttachInformationCard)
            {
                docType = ElectronicSafeDocumentBL.DocumentType.FIL;
                documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), missionDoc.idCustomerProspect);
                documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), missionDoc.CustomerProspect);
                fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

                dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.APPENDIX2);

                if (dtpDoc != null)
                {
                    dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

                    //Save document to ElectronicSafe table
                    documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), LanguageContentBL.Translate("doc_entree_en_relation"), (missionDoc.DateUpdated.HasValue) ? missionDoc.DateUpdated.Value.ToString("dd/MM/yyyy") : missionDoc.DateCreated.ToString("dd/MM/yyyy"));

                    ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, missionDoc.idCustomerProspect, missionDoc.idDictao, null);
                }

            }

            // d- APPENDIX 3 : CRTO
            if (missionDoc.AttachConventionRTO.HasValue && missionDoc.AttachConventionRTO.Value)
            {
                docType = ElectronicSafeDocumentBL.DocumentType.CRTO;
                documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), missionDoc.idCustomerProspect);
                documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), missionDoc.CustomerProspect);
                fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

                dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.APPENDIX3);

                if (dtpDoc != null)
                {
                    dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

                    //Save document to ElectronicSafe table
                    documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), LanguageContentBL.Translate("convention_de_rto"), (missionDoc.DateUpdated.HasValue) ? missionDoc.DateUpdated.Value.ToString("dd/MM/yyyy") : missionDoc.DateCreated.ToString("dd/MM/yyyy"));

                    ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, missionDoc.idCustomerProspect, missionDoc.idDictao, null);
                }
            }

            // e- APPENDIX >= 4
            //For RM
            if (!missionDoc.IsLetter && missionDoc.MissionDocumentAppendix.Count > 0)
            {
                List<MissionDocumentAppendix> lstAppendixDocs = missionDoc.MissionDocumentAppendix.OrderBy(app => app.DateCreated).ToList();
                int appendixNum = 4;
                foreach (var appendixDoc in lstAppendixDocs)
                {
                    docType = ElectronicSafeDocumentBL.DocumentType.AX;
                    documentName = ElectronicSafeDocumentBL.BuildDocumentName(docType.ToString(), appendixDoc.idMissionDocumentAppendix);
                    documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(docType.ToString(), missionDoc.CustomerProspect);
                    fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

                    string dtpDocType = string.Format("{0}{1}", DTPClient.APPENDIX, appendixNum);
                    dtpDoc = dtpClient.GetDocumentByType(dtpDocType);

                    appendixNum++;

                    if (dtpDoc != null)
                    {
                        dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

                        //Save document to ElectronicSafe table
                        documentLabel = string.Format(LanguageContentBL.Translate("signature_doc_title_on"), appendixDoc.Designation, (missionDoc.DateUpdated.HasValue) ? missionDoc.DateUpdated.Value.ToString("dd/MM/yyyy") : missionDoc.DateCreated.ToString("dd/MM/yyyy"));

                        ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, docType.ToString(), documentLabel, documentPath, missionDoc.idCustomerProspect, missionDoc.idDictao, null, true, appendixDoc.idDocumentCategory);
                    }
                }

            }

            //5- If all is ok, finish / close transaction
            dtpClient.FinishTransaction();

            IList<string> documentTypesToExcludeOnArchive = null; //TODO

            //6- Archive transaction : TODO : asynchrone ?
            try
            {
                string businessId = string.Format("{0}-{1}", (missionDoc.IsLetter) ? MISSION_LETTER : MISSION_REPORT, missionDoc.idMissionDocument);
                dtpClient.ArchiveTransaction(missionDoc.CustomerProspect.FirmInstitution.FirmInstitutionName, missionDoc.CustomerProspect.User.UserName, missionDoc.CustomerProspect.User.UserFirstName, businessId, documentTypesToExcludeOnArchive);
            }
            catch (Exception ex)
            {
                Log.Log.AppendException(ex);
            }

            return bOK;
        }
        private static bool ArchiveReportSignedDocument(Upsilab.Data.Model.Report report)
        {
            bool bOK = true; //TODO
           
            DTPClient dtpClient = new DTPClient(report.idDictao);

            //1- Update report table
            report.Status = ReportBL.Status.Completed.ToString(); //If signed by the 2 parts and saved to coffrefort
            report.Archived = true;
            report.IsOriginal = true;

            //2- Reduice firm credit after signature + mise au coffre
            //TODO : don't archive, sign doc if credit is not sufficient
            try
            {
                CreditOperationBL.SubstractCredit(report.CustomerProspect.idFirmInstitution, CreditOperationBL.OperationType.MISE_AU_COFFRE_RECUEIL.ToString(), report.CustomerProspect.idUserCreated, report.CustomerProspect.idCustomer);
            }
            catch (Exception ex)
            {
                Log.Log.AppendException(ex);
            }

            //3- Save signed document to the server
            string documentName = ElectronicSafeDocumentBL.BuildDocumentName(ElectronicSafeDocumentBL.DocumentType.RC.ToString(), report.idCustomerProspect);
            string documentPath = ElectronicSafeDocumentBL.BuildClientDocumentPath(ElectronicSafeDocumentBL.DocumentType.RC.ToString(), report.CustomerProspect);
            string fullPath = System.IO.Path.Combine(Upsilab.Business.Utility.ConfigurationManager.CoffreFortRootPath, documentPath);

            Upsilab.Infrastructure.DictaoDTPCoreServiceReference.Document dtpDoc = dtpClient.GetDocumentByType(DTPClient.DocumentTypes.CONTRACT);
            dtpClient.SaveDocumentToFile(dtpDoc, fullPath, documentName);

            //4- Save document to ElectronicSafe table
            string documentLabel = string.Format(LanguageContentBL.Translate("signature_report_on"), (report.DateUpdated.HasValue) ? report.DateUpdated.Value.ToString("dd/MM/yyyy") : report.DateCreated.ToString("dd/MM/yyyy"));

            ElectronicSafeDocumentBL.SaveDocumentToDB(documentName, ElectronicSafeDocumentBL.DocumentType.RC.ToString(), documentLabel, documentPath, report.idCustomerProspect, report.idDictao, null);

            //5- If all is ok, finish / close transaction
            dtpClient.FinishTransaction();

            IList<string> documentTypesToExcludeOnArchive = null; //TODO

            //6- Archive transaction : TODO : asynchrone ?
            try
            {
                string businessId = string.Format("{0}-{1}", REPORT, report.idReport);
                dtpClient.ArchiveTransaction(report.CustomerProspect.FirmInstitution.FirmInstitutionName, report.CustomerProspect.User.UserName, report.CustomerProspect.User.UserFirstName, businessId, documentTypesToExcludeOnArchive);
            }
            catch { }

            return bOK;
        }