private void btnSign_Click(object sender, EventArgs e)
        {
            SAPIWSWrapper SapiWS = new SAPIWSWrapper();

            if (this.txtPDFFile.Text.Trim().Length < 3)
            {
                MessageBox.Show("Please select PDF file to Sign", "Error");
                this.txtPDFFile.Focus();
                return;
            }

            if (this.txtUsername.Text.Trim().Length < 1)
            {
                MessageBox.Show("Please Define UserName", "Error");
                this.txtUsername.Focus();
                return;
            }

            if (this.txtPassword.Text.Trim().Length < 1)
            {
                MessageBox.Show("Please define CoSign password", "Error");
                this.txtPassword.Focus();
                return;
            }

            bool res = SapiWS.SignPDFFile(txtPDFFile.Text, txtUsername.Text, txtPassword.Text, (int)nudX.Value, (int)nudY.Value,
                (int)nudWidth.Value, (int)nudHeight.Value, (int)nudPage.Value, true);

            if (!res)
                MessageBox.Show("Signing Failed", "SAPI WS Demo");
            else
                MessageBox.Show("Signature was applied successfully", "SAPI WS Demo");
        }
Ejemplo n.º 2
0
        private void ListUsers_click(object sender, EventArgs e)
        {
            if (this.AdminUser.Text.Trim().Length < 1)
            {
                MessageBox.Show("Please Define AdminUser", "Error");
                this.AdminUser.Focus();
                return;
            }

            if (this.AdminPassword.Text.Trim().Length < 1)
            {
                MessageBox.Show("Please define AdminPassword", "Error");
                this.AdminPassword.Focus();
                return;
            }

            SAPIWSWrapper SapiWS = new SAPIWSWrapper();

            SPMLSoapClient.PSOType[] Users = SapiWS.ListUsers(this.AdminUser.Text, this.AdminPassword.Text);
            if (Users != null)
            {
                for (int i = 0; i < Users.Length; i++)
                {
                    String usrs = (i + 1) + ": " + Users[i].psoID.ID + ", " + Users[i].UserRecord.UserCN +
                                  "," + Users[i].UserRecord.EmailAddress + ", " + Users[i].UserRecord.RightsMask;
                    richTextBox1.Text += (usrs + "\n");
                }
            }
        }
Ejemplo n.º 3
0
        private void addUserButton_Click(object sender, EventArgs e)
        {
            SAPIWSWrapper SapiWS = new SAPIWSWrapper();

            if (SapiWS.AddUser(AdminUser.Text, AdminPassword.Text, NewUserName.Text, NewUserPassword.Text, NewUserCN.Text, NewUserEmail.Text))
            {
                MessageBox.Show("User was added successfully", "SAPI WS Demo");
            }
        }
Ejemplo n.º 4
0
        private void btnSign_Click(object sender, EventArgs e)
        {
            SAPIWSWrapper SapiWS = new SAPIWSWrapper();

            if (this.txtPDFFile.Text.Trim().Length < 3)
            {
                MessageBox.Show("Please select PDF file to Sign", "Error");
                this.txtPDFFile.Focus();
                return;
            }

            if (this.txtUsername.Text.Trim().Length < 1)
            {
                MessageBox.Show("Please Define UserName", "Error");
                this.txtUsername.Focus();
                return;
            }

            if (this.txtPassword.Text.Trim().Length < 1)
            {
                MessageBox.Show("Please define CoSign password", "Error");
                this.txtPassword.Focus();
                return;
            }

            bool res = SapiWS.SignPDFFile(DSAtextBox.Text,
                                          txtPDFFile.Text,
                                          txtUsername.Text,
                                          txtPassword.Text,
                                          txtPdfPass.Text,
                                          txtGrSigName.Text,
                                          (int)nudX.Value,
                                          (int)nudY.Value,
                                          (int)nudWidth.Value,
                                          (int)nudHeight.Value,
                                          (int)nudPage.Value,
                                          chkIsVisible.Checked,
                                          (int)GMTOffsetNum.Value,
                                          (int)AppearanceMaskNum.Value);

            if (!res)
            {
                MessageBox.Show("Signing Failed", "SAPI WS Demo");
            }
            else
            {
                MessageBox.Show("Signature was applied successfully", "SAPI WS Demo");
            }
        }