private void button1_Click(object sender, EventArgs e) { string resp; string [] arrip; //string ip=string.Empty; //string puerto=string.Empty; //string trama=string.Empty; //int puertoCOM; try { button1.Enabled = false; Envio oEnvio = new Envio(); //if (String.IsNullOrEmpty(txtip.Text) == false) //{ // arrip = this.txtip.Text.Split(':'); // ip = arrip[0].PadRight(15, ' '); // puerto = arrip[1].PadRight(6, ' '); // trama = txtreq.Text; //} //if (String.IsNullOrEmpty(txtruta.Text)) //{ // trama = trama + ip + puerto; //} //resp = oEnvio.Envio_requerimiento(null, 9, 30000, "RA000000000000001000000000000000000000001000000000000000 00000114241520130603 12131415000000000328464030613 ", "C:\\Users\\farmijos\\Desktop\\PinPad\\NRLibreriaserial\\Fuentes\\Net\\BINES.txt", 1); // resp = oEnvio.Envio_requerimientoPinpad(this.txtip.Text, Convert.ToInt16(comboBox1.SelectedItem.ToString().Length == 4 ? comboBox1.SelectedItem.ToString().Substring(3, 1) : comboBox1.SelectedItem.ToString().Substring(3, 2)), Convert.ToInt32(this.txttimeout.Text), this.txtreq.Text, txtruta.Text, this.chkgrabalog.Checked == true ? 1 : 0); //puertoCOM = Convert.ToInt32(comboBox1.SelectedItem.ToString().Length == 4 ? comboBox1.SelectedItem.ToString().Substring(3, 1) : comboBox1.SelectedItem.ToString().Substring(3, 2)); //resp = oEnvio.Envio_requerimientoPinpad(this.txtip.Text, 1, Convert.ToInt32(this.txttimeout.Text), this.txtreq.Text, txtruta.Text, this.chkgrabalog.Checked == true ? 1 : 0); // oEnvio.Envio_requerimientoPinpad("192.168.1.75", 3030, Convert.ToInt32("30000"), "LT", "1", 1); //oEnvio.Envio_requerimientoPinpad("192.168.1.75:3030", 3, 30000, "LT", "1", "1"); object puertoCom = comboBox1.SelectedItem; string puertoCom1 = puertoCom.ToString(); puertoCom1 = puertoCom1.Substring(puertoCom1.Length - 1, 1); int puertofinal = Convert.ToInt32(puertoCom1); resp = oEnvio.Envio_requerimientoPinpad(txtip.Text, puertofinal, Convert.ToInt32(this.txttimeout.Text), this.txtreq.Text, null, this.chkgrabalog.Checked == true ? 1 : 0); //FUNCIONANDO // resp = oEnvio.Envio_requerimientoPinpad(null, puertofinal, 30000, "PP01200 000000002000000000000000000000001000000000000100000000000500000000000300 12324420140701 00000000000000200000001", null, 1); //Autorizacion //resp = "RA000200AUTORIZACION OK. 0010220000251249022014010403943812131415000000328464 0000 476173XXXXXX010 VISA/ELECTRON 03VISA ACQUIRER TEST CARD 18 VISA CREDIT "; //Anulacion // resp = "RA000200AUTORIZACION OK. 0010270000251249022014010402811212131415000000328464 0000 VISA/ELECTRON 03VISA ACQUIRER TEST CARD 18 VISA CREDIT "; txtresp.Text = resp; // txtresp.AppendText(resp + "\r" + "\n"); /*if (resp.Length > 10) * { * * if ((txtreq.Text.Substring(2, 2) == "01" || txtreq.Text.Substring(2, 2) == "02" || txtreq.Text.Substring(2, 2) == "05") && (resp.Substring(2, 2) == "00")) * { * imprimir(resp); * } * * if (txtreq.Text.Substring(2, 2) == "03" && (resp.Substring(2, 2) == "00")) * { * imprimir(resp); * } * }*/ button1.Enabled = true; //txtresp.AppendText(resp + "\r" + "\n"); } catch (Exception ex) { this.txtresp.AppendText(ex.Message); throw; } }