using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using iTextSharp.text; using iTextSharp.text.pdf; using System.IO; using Image = iTextSharp.text.Image; using System.Data.SQLite; using System.Net; using System.Text.RegularExpressions; namespace CKUERA { public partial class Vendedores : Form { public Vendedores() { InitializeComponent(); } private void Vendedores_Load(object sender, EventArgs e) { //this.Width = 200;// haciendo en Activatet button5.Left = 3000; DataG1.Width = 586; DataG1.Height = 195; DataG1.Left = 27; DataG1.Top = TextBox1.Top + TextBox1.Height + 1; { string name = "iconos\\registrar.png"; try { Button1.Image = System.Drawing.Image.FromFile(name); } catch (Exception) { } } { string name = "iconos\\modificar.png"; try { button4.Image = System.Drawing.Image.FromFile(name); } catch (Exception) { } } { string name = "iconos\\limpiar.png"; try { Button2.Image = System.Drawing.Image.FromFile(name); } catch (Exception) { } } { string name = "iconos\\eliminar.png"; try { Button3.Image = System.Drawing.Image.FromFile(name); } catch (Exception) { } } } private void Vendedores_Resize(object sender, EventArgs e) { this.BackColor = Global.ColorSistema; Button1.BackColor = this.BackColor = Global.ColorSistema;// Button2.BackColor = this.BackColor = Global.ColorSistema;// Button3.BackColor = this.BackColor = Global.ColorSistema;// button4.BackColor = this.BackColor = Global.ColorSistema;// panel1.Left = this.Width / 2 - panel1.Width / 2; panel1.Top = this.Height / 2 - panel1.Height / 2; Btn_Cerrar.Top = 0; Btn_Cerrar.Left = panel1.Width - Btn_Cerrar.Width; Lb_Titulo.Top = 0; Lb_Titulo.Left = 0; Lb_Titulo.Text = this.Text; } public void REEMPLZAR() { TextBox1.Text = TextBox1.Text.ToUpper().Trim().Replace("'", "´"); TextBox2.Text = TextBox2.Text.ToUpper().Trim().Replace("'", "´"); TextBox3.Text = TextBox3.Text.ToUpper().Trim().Replace("'", "´"); TextBox4.Text = TextBox4.Text.ToUpper().Trim().Replace("'", "´"); TextBox5.Text = TextBox5.Text.ToUpper().Trim().Replace("'", "´"); TextBox1.SelectionStart = TextBox1.Text.Length + 1; TextBox2.SelectionStart = TextBox2.Text.Length + 1; TextBox3.SelectionStart = TextBox3.Text.Length + 1; TextBox4.SelectionStart = TextBox4.Text.Length + 1; TextBox5.SelectionStart = TextBox5.Text.Length + 1; } public void LIMPIAR() { // LIMPIA TODO TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; Comi.Text = ""; No_Buscar.Checked = false; TextBox1.Select(); } private void TextBox1_TextChanged(object sender, EventArgs e) { if (RadioButton1.Checked == false) { if (RadioButton2.Checked == false) { MessageBox.Show("Selecciones una opción de lo que desea hacer; ''Registrar nuevo'' o ''Modificar''", "!Atención!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } if (TextBox1.Text.Length > 20) { MessageBox.Show("La longitud de caracteres no puede ser más que 20.", "¡Atención!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TextBox1.Text = TextBox1.Text.Substring(0, 20); TextBox1.Select(); return; } if (TextBox1.Text == "") { LIMPIAR(); } TextBox1.ReadOnly = false; if (No_Buscar.Checked == true) return; // NO BUSCAR SI YA ENCONTRÓ if (RadioButton2.Checked == true) // SI ES MODIFICAR { if (No_Buscar.Checked == true) { REEMPLZAR(); } HttpWebRequest rq = (HttpWebRequest)WebRequest.Create("http://" + Global._host + "/ecv/vendedores_consultar.php"); rq.Method = "POST"; byte[] byteArray = Encoding.UTF8.GetBytes(string.Format("nu={0}▼", TextBox1.Text)); rq.ContentType = "application/x-www-form-urlencoded"; rq.ContentLength = byteArray.Length; Stream stream = rq.GetRequestStream(); stream.Write(byteArray, 0, byteArray.Length); stream.Close(); // WebResponse response = rq.GetResponse(); stream = response.GetResponseStream(); StreamReader reader = new StreamReader(stream); string devuelve = reader.ReadToEnd(); reader.Close(); stream.Close(); response.Close(); string resultado = devuelve.ToUpper(); bool re; re = resultado.Contains("