private void btnSendEnvelope_Click(object sender, EventArgs e) { visualReset(); splitContainer1.Panel2Collapsed = true; var ea = new EndpointAddress(txtEInvoiceEasyUrl.Text); var bn = new BasicHttpBinding(); var EC = new EASY.EasyClient(bn, ea); var rsp = new EASY.ContractsResponseType(); bn.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; bn.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; EC.ClientCredentials.UserName.UserName = cred.User; EC.ClientCredentials.UserName.Password = cred.Pass; try { rsp = EC.SendEnvelope(cred.VKN, UTF8Encoding.UTF8.GetBytes(richOutbound.Text)); splitContainer1.Panel2Collapsed = false; richMessage.Text += rsp.Status + "\r\n"; richMessage.Text += rsp.GIBMessage; return; } catch (Exception ex) { splitContainer1.Panel2Collapsed = false; richMessage.Text = ex.Message; } }
private void btnGetSingleEnvelope_Click(object sender, EventArgs e) { visualReset(); var ea = new EndpointAddress(txtEInvoiceEasyUrl.Text); var bn = new BasicHttpBinding(); var EC = new EASY.EasyClient(bn, ea); var rsp = new EASY.ContractsResponseType(); bn.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; bn.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; EC.ClientCredentials.UserName.UserName = cred.User; EC.ClientCredentials.UserName.Password = cred.Pass; try { rsp = EC.GetSingleEnvelope(cred.VKN); if (rsp.ByteData == null) { splitContainer1.Panel2Collapsed = false; richMessage.Text = rsp.GIBMessage; return; } var dat = ISIS.Core.Zip.Helper.DeCompressAsByte(rsp.ByteData); richInBound.Text = UTF8Encoding.UTF8.GetString(dat); ISIS.Core.Ubl.BusinessDocument.StandardBusinessDocumentHeader ubl = new Core.Ubl.BusinessDocument.StandardBusinessDocumentHeader(); ubl = (Core.Ubl.BusinessDocument.StandardBusinessDocumentHeader)UtilityLayer.ObjectToByte.XmlByteArrayToObject(ubl, dat); lblInboundUUID.Text = ubl.DocumentIdentification.InstanceIdentifier; } catch (Exception ex) { splitContainer1.Panel2Collapsed = false; richMessage.Text = ex.Message; } }
private void btnPostbox_Click(object sender, EventArgs e) { visualReset(); splitContainer1.Panel2Collapsed = true; var ea = new EndpointAddress(txtEInvoiceEasyUrl.Text); var bn = new BasicHttpBinding(); var EC = new EASY.EasyClient(bn, ea); var rsp = new EASY.ContractsResponseType(); bn.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; bn.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; EC.ClientCredentials.UserName.UserName = cred.User; EC.ClientCredentials.UserName.Password = cred.Pass; string[] aa = null; try { aa = EC.GetPostboxList(txtReceiversVKN.Text); if (aa.Length > 0) { string result = null; foreach (var item in aa) { result += item + "\r\n"; } richOutbound.Text = result; } } catch (Exception ex) { splitContainer1.Panel2Collapsed = false; richMessage.Text = ex.Message; } }