Пример #1
0
        /// <summary>
        /// Provide document to sign
        /// </summary>
        public void ProvideDocument(string docLabel, string docDescription, string docPathFilename, string docType, List<SignatureParameter> signatureParameters)
        {
            try
            {
                //#2- Fourniture d'un contrat                
                byte[] content = System.IO.File.ReadAllBytes(docPathFilename);

                Document doc = new Document()
                {
                    filename = docPathFilename.Split(new char[] { '/', '\\' }).Last<string>(),
                    mimetype = "application/pdf",
                    content = content,
                    label = docLabel,
                    description = docDescription,
                    signatureField = BuildSignatureFields(signatureParameters).ToArray(),                    
                };

                putDocument putDocument = new putDocument()
                {
                    document = doc,
                    transactionId = TransactionId,
                    type = docType,                                       
                };

                _DocumentPortClient.putDocument(putDocument);

                //Sign documents ?            
                signDocuments signDocuments = new signDocuments()
                {
                    transactionId = TransactionId,
                    signatureRequest = BuildSignatureRequests(docType).ToArray()
                };
                
                _DocumentPortClient.signDocuments(signDocuments);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #2
0
        /// <summary>
        /// Provide document to sign
        /// </summary>
        public void ProvideDocument(string docLabel, string docDescription, string docPathFilename, string docType, SignatureParameters signatureParameters)
        {
            try
            {
                //#2- Fourniture d'un contrat                
                byte[] content = System.IO.File.ReadAllBytes(docPathFilename);

                Document doc = new Document()
                {
                    filename = docPathFilename.Split(new char[] { '/', '\\' }).Last<string>(),
                    mimetype = "application/pdf",
                    content = content,
                    label = docLabel,
                    description = docDescription,
                    signatures = BuildSignatures(signatureParameters)
                };

                putDocument putDocument = new putDocument()
                {
                    document = doc,
                    service = _Scenario.Service,
                    transactionId = TransactionId,
                    type = docType,
                };

                _DocumentPortCli.putDocument(putDocument);
            }
            catch (Exception ex)
            {
                //this.CancelTransaction();

                throw new Exception(ex.Message);
            }
        }