/// <summary>
        /// Creates a copy of a source document signed using provided signee information and X509 certificate.
        /// </summary>
        private static void SignDocument(string srcDocumentPath, string dstDocumentPath,
                                         Signee signeeInfo, string certificatePath, string certificatePassword)
        {
            Document        document = new Document(srcDocumentPath);
            DocumentBuilder builder  = new DocumentBuilder(document);

            // Configure and insert a signature line, an object in the document that will display a signature that we sign it with.
            SignatureLineOptions signatureLineOptions = new SignatureLineOptions
            {
                Signer      = signeeInfo.Name,
                SignerTitle = signeeInfo.Position
            };

            SignatureLine signatureLine = builder.InsertSignatureLine(signatureLineOptions).SignatureLine;

            signatureLine.Id = signeeInfo.PersonId;

            // First, we will save an unsigned version of our document.
            builder.Document.Save(dstDocumentPath);

            CertificateHolder certificateHolder = CertificateHolder.Create(certificatePath, certificatePassword);

            SignOptions signOptions = new SignOptions
            {
                SignatureLineId    = signeeInfo.PersonId,
                SignatureLineImage = signeeInfo.Image
            };

            // Overwrite the unsigned document we saved above with a version signed using the certificate.
            DigitalSignatureUtil.Sign(dstDocumentPath, dstDocumentPath, certificateHolder, signOptions);
        }
コード例 #2
0
        public void AddSignee(Signee s)
        {
            _signees.Add(s);

            _tracker.Subscribe(s);
            _tracker.UpdateSubscribers(this);
        }
コード例 #3
0
        public void AddSignee(Signee s)
        {
            _signees.Add(s);

            PropertyChanged += s.WatchContract;

            s.WatchContract(this, new PropertyChangedEventArgs(""));
        }
コード例 #4
0
        public void SigneeGetsPricingInfoWhenItChangesTest()
        {
            Contract c = new Contract();
            Signee s = new Signee();
            c.AddSignee(s);

            c.InitialPricingPlan = new PricingPlan { Dues = 42M };

            Assert.That(s.CurrentDues, Is.EqualTo(42));
        }
コード例 #5
0
        public static string CreateSignee_String(Signee signee)
        {
            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("InsertSignee");
            dbconn.AddParameterToList("FirstName", SqlDbType.Text, signee.FirstName);
            dbconn.AddParameterToList("LastName", SqlDbType.Text, signee.LastName);

            dbconn.SetSqlParameters();

            return(dbconn.ExecuteStoredProcedureString());
        }
コード例 #6
0
ファイル: SigneesController.cs プロジェクト: JailielW/JCIApi
 public string UpdateSignee(Signee signee)
 {
     if (SigneeServices.UpdateSignee_String(signee).ToLower() == "Successful".ToLower())
     {
         return("Successfully Updated!");
     }
     else
     {
         return(SigneeServices.UpdateSignee_String(signee));
     }
 }
コード例 #7
0
        public void AddSignature(string filename, string signature, Signee signee)
        {
            var font = SignatureFont;
            var document = PdfReader.Open(filename, PdfDocumentOpenMode.Modify);
            var gfx = XGraphics.FromPdfPage(document.Pages[0]);
            var rect = new XRect(Margin, SignatureY[signee] - SectionPadding, PageWidth - Margin /*Don't omit long fields*/, font.GetHeight());
            CheckWidth(gfx, font, rect, signature);

            CreateTextFormatter(gfx).DrawString(signature, font, TextBrush, rect, XStringFormats.TopLeft);
            document.Save(filename);
        }
コード例 #8
0
    public static void Main(string[] args)
    {
        // Jump to the exe path:
        // - This is so all paths are relative to wherever the exe is.
        Directory.SetCurrentDirectory(
            Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
            );

        // Setup args:
        Arguments.Load(args);

        // Which location are we going to send the request to?
        string endpoint = Arguments.Require("endpoint", "It's, for example, 'bank.opentrans.fr'");

        // Which method are we going to use?
        string method = Arguments.Require("function", "It's, for example, 'commodity/list'");

        // Get the JSON payload if there is one (optional):
        string request = Arguments.Get("request");

        // Parse the request (it's simply null if the request is):
        JSObject json = JSON.Parse(request);

        // Next, the signer - that's who's going to sign our request (if one is needed).
        Signee signer = null;

        if (json != null)
        {
            // Signer is only needed if there's a payload to sign.

            // We're sending a payload. We'll need someone to sign the request - who?
            // It essentially authenticates the requester.
            string signeeFile = Arguments.Require("signee", "It's the path to a JSON file containing auth info");

            // Load the signer:
            signer = Signee.LoadFromFile(signeeFile);
        }

        // Create the API object and grab our endpoint as a location:
        Api api = new Api();

        // Get the location:
        Location location = api.GetAt(endpoint);

        // Send the request:
        JSObject result = location.Run(method, json, signer);

        // Write the JSON response to the console:
        Console.WriteLine(JSON.Stringify(result));
    }
コード例 #9
0
        public void ValidPricingInfoTransferredToSigneesAfterOneIsAddedTest()
        {
            Contract c = new Contract
            {
                InitialPricingPlan = new PricingPlan
                {
                    Dues = 42M
                }
            };

            Signee s = new Signee();
            c.AddSignee(s);

            Assert.That(s.CurrentDues, Is.EqualTo(42M));
        }
コード例 #10
0
        static void Main(string[] args)
        {
            //Steep 3
            Signee artist1  = new Signee(Picasso);
            Signee artist2  = JamesDelegate.David;
            Signee vangough = new Program().Vangough;

            //Step 4 invocking delegate
            artist1();
            artist2();
            artist1 += new Program().Vangough;
            artist1();
            Console.WriteLine("**************");
            artist1 += vangough;

            artist1 += () => Console.WriteLine("Done by unknown");
        }
コード例 #11
0
        public static Signee GetSigneeByID_Signee(int signeeID)
        {
            Signee newSignee = new Signee();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetSigneeByID");
            dbconn.AddParameterToList("SigneeID", SqlDbType.Int, signeeID);
            dbconn.SetSqlParameters();

            foreach (DataRow signeeDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                newSignee = new Signee(signeeID, signeeDR["FirstName"].ToString(),
                                       signeeDR["LastName"].ToString());
            }

            return(newSignee);
        }
コード例 #12
0
        public static List <Signee> GetSignees_ListSignee()
        {
            List <Signee> SigneeList = new List <Signee>();
            Signee        newSignee  = new Signee();

            dbconn = new DBConnectionServices("JCIConnection");
            dbconn.SetSqlCommandStoredProcedure("GetSignees");

            foreach (DataRow signeeDR in dbconn.ExecuteStoredProcedureDataTable().Rows)
            {
                newSignee = new Signee((int)signeeDR["SigneeID"], signeeDR["FirstName"].ToString(),
                                       signeeDR["LastName"].ToString());

                SigneeList.Add(newSignee);
            }

            return(SigneeList);
        }
        public static void Sign()
        {
            string signeeName          = "Ron Williams";
            string srcDocumentPath     = MyDir + "Document.docx";
            string dstDocumentPath     = ArtifactsDir + "SignDocumentCustom.Sign.docx";
            string certificatePath     = MyDir + "morzal.pfx";
            string certificatePassword = "******";

            CreateSignees();

            Signee signeeInfo = mSignees.Find(c => c.Name == signeeName);

            if (signeeInfo != null)
            {
                SignDocument(srcDocumentPath, dstDocumentPath, signeeInfo, certificatePath, certificatePassword);
            }
            else
            {
                Assert.Fail("Signee does not exist.");
            }
        }
コード例 #14
0
        public static async Task <Signee> RunNotifiySigneeActivity([ActivityTrigger] Signee signee, ILogger log)
        {
            log.LogInformation($"---DUMMY-SEND-EMAIL---> Notifying signee via email {signee.Email}");

            return(signee);
        }
コード例 #15
0
        public static async Task <(string signeeId, string documentName)> RunGenerateDocumentForSigee([ActivityTrigger] Signee signee, ILogger log)
        {
            log.LogInformation($"---DUMMY-GEN-DOC---> Generating document for {signee.Id}");

            return(signeeId : signee.Id, documentName : $"{Guid.NewGuid()}.pdf");
        }