public Form1() { InitializeComponent(); comboBoxValor.SelectedIndex = 0; comboBoxValor1.SelectedIndex = 0; comboBoxValor2.SelectedIndex = 0; comboBoxValor3.SelectedIndex = 0; txtOrigemV5.Text = "test from program " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); try { var ws = new CompraFacilWS.CompraFacilWS(); txtWSInfo.Text = "V5: " + ws.Url + txtWSInfo.Text; ws.Dispose(); } catch { txtWSInfo.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + " Unable to access WebService (V5)."; } txtOrigem.Text = "test from program " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); try { var ws = new clicksmsV4(); txtWSInfo.Text += Environment.NewLine + "V4: " + ws.Url; ws.Dispose(); } catch { txtWSInfo.Text += Environment.NewLine + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + " Unable to access WebService (V4)."; } txtOrigem2.Text = "test from program " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); try { var ps = new CompraFacilPS(); txtWSInfo.Text += Environment.NewLine + "V4: " + ps.Url; ps.Dispose(); } catch { txtWSInfo.Text += Environment.NewLine + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + " Unable to access WebService (V4-PS)."; } }
private void button7_Click(object sender, EventArgs e) { if (txtPassword.Text.Trim() == "" || txtUsername.Text.Trim() == "") { MessageBox.Show("You must insert user details.", "Get Info reference"); } else { bool res = false; string error = ""; string ids = ""; string refs = ""; if (radioV4_1.Checked) { var ws = new clicksmsV4(); res = ws.getInfo(txtUsername.Text, txtPassword.Text, txtStartDate.Text, txtEndDate.Text, txtType.Text, out ids, out refs, out error); } else { var ws = new CompraFacilWS.CompraFacilWS(); res = ws.getInfo(txtUsername.Text, txtPassword.Text, txtStartDate.Text, txtEndDate.Text, txtType.Text, out ids, out refs, out error); } txtResultado.Text = ""; if (res) { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getInfo) executed OK.\n\n"; txtResultado.Text += "\r\nIDs: " + ids; txtResultado.Text += "\r\nReferences: " + refs; txtResultado.Text += "\r\nerror: " + error; //if (dataUltimoPagamento.Trim() != "") //{ // IFormatProvider culture = new System.Globalization.CultureInfo("pt-PT", true); // DateTime d = Convert.ToDateTime(dataUltimoPagamento, culture); // // txtResultado.Text += "\r\nData passando por dateTime:" + d.ToString("dd-MM-yyyy HH:mm:ss"); //} } else { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getInfo) executed NOT OK.\r\n"; txtResultado.Text += "\r\nerror: " + error; } } }
private void button6_Click(object sender, EventArgs e) { const int userBackoffice = -1; if (txtPassword.Text.Trim() == "" || txtUsername.Text.Trim() == "") { MessageBox.Show("You must insert user details and value.", "Create reference"); } else { decimal valor = -1; int validade = 0; try { valor = Convert.ToDecimal(comboBoxValorV5.SelectedItem.ToString() == "(other)" ? txtValorV5.Text : comboBoxValorV5.SelectedItem.ToString()); } catch { MessageBox.Show("The amount specified is invalid.", "Create reference"); return; } try { validade = Convert.ToInt32(txtValidadeV5.Text); } catch { MessageBox.Show("Time limit is invalid.", "Create reference"); return; } var ws = new CompraFacilWS.CompraFacilWS(); string origin = txtOrigem.Text; string info = "test from program " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); string reference = ""; decimal valorOut = 0; string error = ""; bool sendEmailBuyer = (radioEmailYES.Checked); if (radioMB.Checked) { string entity = ""; bool res = ws.getReferenceMB(origin, txtUsername.Text, txtPassword.Text, valor, info, "name - test", "address - test", "postCode - test", "city - test", "0000000", "", "123456789", txtEmail.Text, userBackoffice, validade, sendEmailBuyer, out reference, out entity, out valorOut, out error); if (res) { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getReferenceMB - Multibanco) executed OK.\n\n"; txtResultado.Text += "\r\nreference: " + reference; txtResultado.Text += "\r\nentity: " + entity; txtResultado.Text += "\r\nvalueOut: " + valorOut; txtResultado.Text += "\r\nerror: " + error; } else { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getReferenceMB- Multibanco) executed NOT OK.\r\n"; txtResultado.Text += "\r\nerror: " + error; } } else { string limitePagamento = ""; bool res = ws.getReferencePS(origin, txtUsername.Text, txtPassword.Text, valor, info, "name - test", "address - test", "postCode - test", "city - test", "0000000", "", "123456789", txtEmail.Text, userBackoffice, sendEmailBuyer, out reference, out limitePagamento, out valorOut, out error); if (res) { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getReferencePS - Payshop) executed OK.\n\n"; txtResultado.Text += "\r\nreference: " + reference; txtResultado.Text += "\r\ndeadline for payment: " + limitePagamento; txtResultado.Text += "\r\nvalueOut: " + valorOut; txtResultado.Text += "\r\nerror: " + error; } else { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getReferencePS - Payshop) executed NOT OK.\r\n"; txtResultado.Text += "\r\nerror: " + error; } } } }
private void button2_Click(object sender, EventArgs e) { if (txtPassword.Text.Trim() == "" || txtUsername.Text.Trim() == "" || txtReferencia.Text.Trim() == "") { MessageBox.Show("You must insert user details and reference", "Get Info reference"); } else { bool res; bool pago; var estado = ""; var error = ""; string dataUltimoPagamento; int totalPagamentos; if (radioV4.Checked) { var ws = new clicksmsV4(); res = ws.getInfoCompra(txtReferencia.Text, txtUsername.Text, txtPassword.Text, out pago, out estado, out dataUltimoPagamento, out totalPagamentos, out error); } else { var ws = new CompraFacilWS.CompraFacilWS(); res = ws.getInfoReference(txtReferencia.Text, txtUsername.Text, txtPassword.Text, out pago, out estado, out dataUltimoPagamento, out totalPagamentos, out error); } txtResultado.Text = ""; if (res) { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (" + (radioV4.Checked ? "getInfoCompra" : "getInfoReference") + ") executed OK.\n\n"; txtResultado.Text += "\r\npaid: " + pago; txtResultado.Text += "\r\nstate: " + estado; txtResultado.Text += "\r\nLast payment: " + dataUltimoPagamento; txtResultado.Text += "\r\nTotal payments: " + totalPagamentos; txtResultado.Text += "\r\nerror: " + error; //if (dataUltimoPagamento.Trim() != "") //{ // IFormatProvider culture = new System.Globalization.CultureInfo("pt-PT", true); // DateTime d = Convert.ToDateTime(dataUltimoPagamento, culture); // // txtResultado.Text += "\r\nData passando por dateTime:" + d.ToString("dd-MM-yyyy HH:mm:ss"); //} } else { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Call to webservice (getInfoCompra) executed NOT OK.\r\n"; txtResultado.Text += "\r\nerror: " + error; } } }