private void botBuscar_Click(object sender, EventArgs e) { //verificar los numericos if ((!FuncionesUtiles.esNumerico(textNumero) && !FuncionesUtiles.estaVacio(textNumero))) { //hay campos numericos con valores no numericos string mensaje = "Los siguientes campos deben ser numéricos y positivos:"; if (!FuncionesUtiles.esNumerico(textNumero) && !FuncionesUtiles.estaVacio(textNumero)) { mensaje += "\n-Número"; } } else { SqlConnection con = Conexion.conectar(); con.Open(); SqlCommand com; SqlDataReader reader; string cod_rubro = ""; if (comboBoxRubro.SelectedIndex > -1) { com = new SqlCommand("select cod_rubro from ntvc.rubro where descripcion = @descripcion", con); com.Parameters.AddWithValue("@descripcion", comboBoxRubro.Items[comboBoxRubro.SelectedIndex].ToString().Trim()); reader = com.ExecuteReader(); if (reader.Read()) { cod_rubro = reader["cod_rubro"].ToString().Trim(); } reader.Close(); } string select = "select distinct b.razon_social as Razón_Social, b.dir_calle as Calle, b.dir_nro as Número, b.dir_piso as Piso, b.dir_dpto as Depto, r.descripcion as Rubro from ntvc.beneficiario b, ntvc.rubro r where b.cod_rubro = r.cod_rubro and "; if (!FuncionesUtiles.estaVacio(textCalle)) { select += "b.dir_calle like '%" + textCalle.Text + "%' and "; } if (!FuncionesUtiles.estaVacio(textDepto)) { select += "b.dir_dpto like '%" + textDepto.Text + "%' and "; } if (!FuncionesUtiles.estaVacio(textNumero)) { select += "b.dir_nro = " + textNumero.Text + " and "; } if (!FuncionesUtiles.estaVacio(textPiso)) { select += "b.dir_piso = " + textPiso.Text + " and "; } if (!FuncionesUtiles.estaVacio(textRazonSocial)) { select += "b.razon_social like '%" + textRazonSocial.Text + "%' and "; } if (comboBoxRubro.SelectedIndex > -1) { select += "r.descripcion = '" + comboBoxRubro.Items[comboBoxRubro.SelectedIndex].ToString().Trim() + "' and "; } select += "1 = 1"; FuncionesUtiles.llenarDataGridView(select, dataGridView1); con.Close(); } }
private void botBuscar_Click(object sender, EventArgs e) { if (!FuncionesUtiles.esNumerico(textDNI) && !FuncionesUtiles.estaVacio(textDNI)) { MessageBox.Show("El documento debe ser numérico.", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } else { SqlConnection con = Conexion.conectar(); con.Open(); string busqueda = "select c.nombre as Nombre, c.apellido as Apellido, c.tipo_doc as Tipo, c.doc as Documento, p.nombre as Provincia, c.mail as Mail, c.telefono as Teléfono, c.dir_calle as Calle, c.dir_nro as Número, c.dir_piso as Piso, c.dir_dpto as Depto from NTVC.Cliente c, NTVC.provincia p where c.cod_provincia = p.cod_provincia and "; if (!FuncionesUtiles.estaVacio(textApellido)) { busqueda += "c.apellido like '%" + textApellido.Text + "%' and "; } if (!FuncionesUtiles.estaVacio(textNombre)) { busqueda += "c.nombre like '%" + textNombre.Text + "%' and "; } if (!FuncionesUtiles.estaVacio(textDNI)) { busqueda += "c.doc = " + textDNI.Text + " and "; } if (comboBox1.SelectedIndex > -1) { busqueda += "p.nombre = '" + comboBox1.Items[comboBox1.SelectedIndex].ToString().Trim() + "' and "; } busqueda += "1=1"; FuncionesUtiles.llenarDataGridView(busqueda, dataGridView1); } }
private void botBuscar_Click(object sender, EventArgs e) { if (!FuncionesUtiles.esNumerico(textNumeroSerie) && !FuncionesUtiles.estaVacio(textNumeroSerie)) { MessageBox.Show("El número de serie debe ser numérico.", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } else { SqlConnection con = Conexion.conectar(); con.Open(); string busqueda = "select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where cod_postnet not in (select cod_postnet from ntvc.beneficiario_postnet) and "; if (!FuncionesUtiles.estaVacio(textMarca)) { busqueda += "Marca like '%" + textMarca.Text + "%' and "; } if (!FuncionesUtiles.estaVacio(textModelo)) { busqueda += "Modelo like '%" + textModelo.Text + "%' and "; } if (!FuncionesUtiles.estaVacio(textNumeroSerie)) { busqueda += "nro_serie = " + textNumeroSerie.Text + " and "; } busqueda += "1=1"; FuncionesUtiles.llenarDataGridView(busqueda, dataGridView1); con.Close(); } }
private void butBuscarVentas_Click(object sender, EventArgs e) { string select = "SELECT c.fecha FECHA,cli.apellido APELLIDO,cli.nombre NOMBRE,t.nro_tarjeta NRO_TARJETA,c.cod_postnet COD_POSNET,pos.marca MARCA,pos.modelo MODELO,c.monto MONTO FROM (((ntvc.beneficiario b INNER JOIN ntvc.compra c ON b.cod_beneficiario=c.cod_beneficiario) INNER JOIN ntvc.postnet pos ON pos.cod_postnet=c.cod_postnet) INNER JOIN ntvc.tarjeta t ON t.cod_tarjeta=c.cod_tarjeta) INNER JOIN ntvc.cliente cli ON cli.cod_cliente=t.cod_cliente WHERE c.pagado=0 and b.razon_social="; if (!FuncionesUtiles.estaVacio(textBeneficiario)) { select += "'" + textBeneficiario.Text + "' and "; } if (!FuncionesUtiles.estaVacio(textFechaInicio)) { select += "c.fecha between'" + textFechaInicio.Text + "' and "; } if (!FuncionesUtiles.estaVacio(textFechaFin)) { select += "'" + textFechaFin.Text + "'"; } if ((!FuncionesUtiles.estaVacio(textFechaFin)) && (!FuncionesUtiles.estaVacio(textFechaInicio)) && (!FuncionesUtiles.estaVacio(textBeneficiario))) { FuncionesUtiles.llenarDataGridView(select, dataGridView1); } else { MessageBox.Show("Debe llenar todos los campos", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } }
private void botLimpiar_Click(object sender, EventArgs e) { textMarca.Text = ""; textModelo.Text = ""; textNumeroSerie.Text = ""; FuncionesUtiles.llenarDataGridView("select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where cod_postnet = 0", dataGridView1); }
private void botLimpiar_Click(object sender, EventArgs e) { this.textCliente.Text = ""; this.textFechaAlta.Text = ""; this.textNumeroTarjeta.Text = ""; FuncionesUtiles.llenarDataGridView("select c.nombre as Nombre, c.apellido as Apellido, c.doc as Documento, t.nro_tarjeta as Número_tarjeta, t.fecha_alta as Fecha from NTVC.Cliente c, NTVC.tarjeta t where c.cod_cliente = 0 and t.cod_cliente = 0", dataGridView1); }
private void botBuscar_Click(object sender, EventArgs e) { string query = "select c.nombre as Nombre, c.apellido as Apellido, c.doc as Documento, t.nro_tarjeta as Número_tarjeta, t.fecha_alta as Fecha from NTVC.Cliente c, NTVC.tarjeta t where t.cod_cliente = c.cod_cliente and "; if (FuncionesUtiles.esNumerico(textNumeroTarjeta) || FuncionesUtiles.estaVacio(textNumeroTarjeta)) { if (!FuncionesUtiles.estaVacio(textNumeroTarjeta)) { query += "t.nro_tarjeta = " + textNumeroTarjeta.Text + " and "; } if (!FuncionesUtiles.estaVacio(textFechaAlta)) { query += "t.fecha_alta = '" + textFechaAlta.Text + "' and "; } if (!FuncionesUtiles.estaVacio(textCliente)) { query += "t.cod_cliente = " + textCliente.Text + " and "; } query += "1=1"; FuncionesUtiles.llenarDataGridView(query, dataGridView1); } else { MessageBox.Show("El número de tarjeta debe ser un valor numérico y menor a 2000000000", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } }
private void botLimpiar_Click(object sender, EventArgs e) { textNombre.Text = ""; textApellido.Text = ""; textDNI.Text = ""; comboBox1.SelectedIndex = -1; FuncionesUtiles.llenarDataGridView("select c.nombre as Nombre, c.apellido as Apellido, c.tipo_doc as Tipo, c.doc as Documento, p.nombre as Provincia, c.mail as Mail, c.telefono as Teléfono, c.dir_calle as Calle, c.dir_nro as Número, c.dir_piso as Piso, c.dir_dpto as Depto from NTVC.Cliente c, NTVC.provincia p where cod_cliente = 0 and p.cod_provincia = 0", dataGridView1); }
public InactividadTarjetas() { InitializeComponent(); this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1; string select = "SELECT * FROM NTVC.TARJETASINACTIVAS()"; FuncionesUtiles.llenarDataGridView(select, dataGridView1); }
private void botBuscar_Click(object sender, EventArgs e) { string busqueda = "select username as Username from NTVC.usuario"; if (!FuncionesUtiles.estaVacio(textUsername)) { busqueda += " where username like '" + textUsername.Text + "'"; } FuncionesUtiles.llenarDataGridView(busqueda, dataGridView1); }
private void botLimpiar_Click(object sender, EventArgs e) { textApellido.Text = ""; textCalle.Text = ""; textDepto.Text = ""; textDNI.Text = ""; textMail.Text = ""; textNombre.Text = ""; textNumero.Text = ""; textPiso.Text = ""; textTelefono.Text = ""; FuncionesUtiles.llenarDataGridView("select * from ntvc.cliente where cod_cliente = 0", dataGridView1); }
public QuitarPostNets(List <string> serials) { InitializeComponent(); this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1; string select = "select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where "; foreach (string serial in serials) { select += "nro_serie = " + serial + " or "; } select += "1=2"; FuncionesUtiles.llenarDataGridView(select, dataGridView1); }
public SeleccionCliente() { InitializeComponent(); this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1; FuncionesUtiles.llenarDataGridView("select c.nombre as Nombre, c.apellido as Apellido, c.tipo_doc as Tipo, c.doc as Documento, p.nombre as Provincia, c.mail as Mail, c.telefono as Teléfono, c.dir_calle as Calle, c.dir_nro as Número, c.dir_piso as Piso, c.dir_dpto as Depto from NTVC.Cliente c, NTVC.provincia p where cod_cliente = 0 and p.cod_provincia = 0", dataGridView1); SqlConnection con = Conexion.conectar(); con.Open(); SqlCommand com = new SqlCommand("select * from ntvc.provincia order by nombre", con); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { comboBox1.Items.Add(reader["nombre"]); } reader.Close(); con.Close(); }
public SeleccionarPostNets() { InitializeComponent(); this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1; FuncionesUtiles.llenarDataGridView("select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where cod_postnet = 0", dataGridView1); }
private void botBuscar_Click(object sender, EventArgs e) { string query = "select nombre as Nombre, apellido as Apellido, doc as Documento, mail as Mail, telefono as Teléfono, dir_Calle as Calle, dir_nro as Número, dir_piso as Piso, dir_dpto as Depto from NTVC.Cliente where "; //chequeo que los campos sean numericos if ((FuncionesUtiles.esNumerico(textDNI) || FuncionesUtiles.estaVacio(textDNI)) && (FuncionesUtiles.esNumerico(textTelefono) || FuncionesUtiles.estaVacio(textTelefono)) && (FuncionesUtiles.esNumerico(textNumero) || FuncionesUtiles.estaVacio(textNumero))) { if (textNombre.Text != "") { query += "nombre like '%" + textNombre.Text + "%' and "; } if (textApellido.Text != "") { query += "apellido like '%" + textApellido.Text + "%' and "; } if (textDNI.Text != "") { query += "DNI = " + textDNI.Text + " and "; } if (textTelefono.Text != "") { query += "telefono = " + textTelefono.Text + " and "; } if (textMail.Text != "") { query += "mail like '%" + textMail.Text + "%' and "; } if (textCalle.Text != "") { query += "dir_calle like '%" + textCalle.Text + "%' and "; } if (textNumero.Text != "") { query += "dir_nro = " + textNumero.Text + " and "; } if (textPiso.Text != "") { query += "dir_piso = " + textPiso.Text + " and "; } if (textDepto.Text != "") { query += "dir_dpto = '" + textDepto.Text + "' and "; } query += "1=1"; FuncionesUtiles.llenarDataGridView(query, dataGridView1); } else { string mensaje = "Los siguientes campos deben ser numéricos y positivos:"; if (!FuncionesUtiles.esNumerico(textDNI) && !FuncionesUtiles.estaVacio(textDNI)) { mensaje += "\n-Documento"; } if (!FuncionesUtiles.esNumerico(textTelefono) && !FuncionesUtiles.estaVacio(textTelefono)) { mensaje += "\n-Teléfono"; } if (!FuncionesUtiles.esNumerico(textNumero) && !FuncionesUtiles.estaVacio(textNumero)) { mensaje += "\n-Número"; } MessageBox.Show(mensaje, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand); } }
private void botLimpiar_Click(object sender, EventArgs e) { textUsername.Text = ""; FuncionesUtiles.llenarDataGridView("select username as Username from NTVC.usuario where cod_usuario = 0", dataGridView1); }
public SeleccionUsuario() { InitializeComponent(); this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1; FuncionesUtiles.llenarDataGridView("select username as Username from NTVC.usuario where cod_usuario = 0", dataGridView1); }
public SeleccionClienteAlta() { InitializeComponent(); this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1; FuncionesUtiles.llenarDataGridView("select * from ntvc.cliente where cod_cliente = 0", dataGridView1); }
private void botAnalizar_Click(object sender, EventArgs e) { string select = "SELECT * from NTVC.ClientePremium(" + numericUpDown1.Text + ")"; FuncionesUtiles.llenarDataGridView(select, dataGridView1); }