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 button5_Click(object sender, EventArgs e) { if (txtPassword.Text.Trim() == "" || txtUsername.Text.Trim() == "") { MessageBox.Show("Deve especificar os dados de acesso e valor", "Geração de referência"); } else { decimal valor = -1; try { if (comboBoxValor2.SelectedItem.ToString() == "(other)") valor = Convert.ToDecimal(txtValor2.Text); else valor = Convert.ToDecimal(comboBoxValor2.SelectedItem.ToString()); } catch { MessageBox.Show("The amount specified is invalid.", "Create reference"); return; } var ws = new CompraFacilPS(); string origem = txtOrigem2.Text; string informacao = "teste do programa " + DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); string referencia = ""; string dataLimitePagamento = ""; decimal valorOut = 0; string error = ""; int userBackoffice = -1; bool res = ws.SaveCompraToBDValor1(origem, txtUsername.Text, txtPassword.Text, valor, informacao, userBackoffice, out referencia, out dataLimitePagamento, out valorOut, out error); if (res) { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Chamada ao WebService (SaveCompraToBDValor1) [PS] executada COM sucesso.\n\n"; txtResultado.Text += "\r\nreferencia: " + referencia; txtResultado.Text += "\r\ndataLimitePagamento: " + dataLimitePagamento; txtResultado.Text += "\r\nvalorOut: " + valorOut; txtResultado.Text += "\r\nerror: " + error; } else { txtResultado.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "\r\n Chamada ao WebService (SaveCompraToBDValor1) [PS] executada SEM sucesso.\r\n"; txtResultado.Text += "\r\nerror: " + error; } } }