예제 #1
0
        private void btnSmlLookup_Click(object sender, EventArgs e)
        {
            bool bRet = false;

            net.xledger.peppolclient.AccessPointClientServiceClient ApClient = new net.xledger.peppolclient.AccessPointClientServiceClient();

            string sUBLVersionID    = UBLVersionID;
            string sCustomizationID = CustomizationID;

            string sDocumentID = DocumentID(xd.DocumentElement, CustomizationID, UBLVersionID);

            string sEndpointID = "";

            string sError    = "";
            string sEndpoint = "";
            string sResult   = string.Empty;

            try
            {
                bRet = ApClient.SmlLookup(RecipientID, sDocumentID, out sError, out sEndpoint);
                if (bRet)
                {
                    sResult = string.Format("SmlLookup: {0}:{1}", bRet, sEndpoint);
                }
                else
                {
                    sResult = string.Format("SmlLookup: {0}:{1}", bRet, sError);
                };
            }
            catch (Exception ex)
            {
                sResult += string.Format(" ERROR: {0}", ex.Message);
            }
            txtResult.Text += sResult;
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string    sError = string.Empty;
            XDocument xd     = XDocument.Load(txtDocument.Text);

            // No need to validate attachments. Remove them to save time.
            var comparison = StringComparison.InvariantCultureIgnoreCase;
            var elements   = xd.Descendants()
                             .Where(x => x.Name.LocalName.IndexOf("Attachment", comparison) != -1);

            elements.Remove();

            string sFile = xd.ToString();

            net.xledger.peppolclient.AccessPointClientServiceClient ap = new net.xledger.peppolclient.AccessPointClientServiceClient();
            bool bRet = ap.VefaValidation(sFile, out sError);

            if (bRet)
            {
                txtResult.Text = "Validation OK";
            }
            else
            {
                txtResult.Text = sError;
            }
        }
예제 #3
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("You are about to send this document out on the PEPPOL production network. Do you want to continue", "WARNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.OK)
            {
                // Creat AP Reference
                net.xledger.peppolclient.AccessPointClientServiceClient ap = new net.xledger.peppolclient.AccessPointClientServiceClient();

                XmlDocument body = new XmlDocument();
                body.Load(txtDocument.Text);
                string sXmlBody = body.OuterXml;

                if (rbDocumentTypeInvoice.Checked)
                {
                    lRsEdocType = 37501;
                }
                else if (rbDocumentTypeCreditNote.Checked)
                {
                    lRsEdocType = 37502;
                }
                else
                {
                    lRsEdocType = -1;
                }

                string sDocumentID = DocumentID(xd.DocumentElement, CustomizationID, UBLVersionID);


                // Send
                long   lRet = 1;
                string sErrorInfo;

                try
                {
                    lRet = ap.SendMessage(SenderID, RecipientID, sDocumentID, ProfileID, sXmlBody, out sErrorInfo);
                    if (lRet == 0)
                    {
                        txtResult.Text = "Document successfully sent!";
                    }
                }
                catch (Exception ex)
                {
                    txtResult.Text = ex.Message;

                    if (lRet == 0)
                    {
                        lRet = 1; // Give it an error code
                    }
                }
            }
            else
            {
                txtResult.Text = "Document NOT sent!";
            }
        }