private void buscar_db() { sqlCommands sql = new sqlCommands(); helperFunctions help = new helperFunctions(); //Orden de las operaciones al momento de buscar la base de datos. El orden es el siguiente: ID, codSap, catalogo, descripcion if (!(string.IsNullOrWhiteSpace(this.txt_ID.Text))) { this.dg_Buscado.DataSource = null; this.dg_Buscado.Rows.Clear(); clsMaterial material = new clsMaterial(); if (!help.mensajeAdvInt(this.txt_ID.Text, "el ID del material. Solo se aceptan numeros enteros.").boolean) { return; } ; long id = Int64.Parse(this.txt_ID.Text); material = sql.buscarID(id); this.dg_Buscado.Rows.Add("1", id, material.catalogo, material.codsap, material.descripcion, material.marca, material.familia); this.resizeGrid(); dg_Buscado.Focus(); } else if (!(string.IsNullOrWhiteSpace(this.txt_SAP.Text))) { this.dg_Buscado.DataSource = null; this.dg_Buscado.Rows.Clear(); clsMaterial material = new clsMaterial(); if (!help.mensajeAdvInt(this.txt_SAP.Text, "el codigo SAP del material. Solo se aceptan numeros enteros.").boolean) { return; } ; long codsap = Int64.Parse(this.txt_SAP.Text); material = sql.buscarPorCodigoSAP(codsap); this.dg_Buscado.Rows.Add("1", material.id, material.catalogo, material.codsap, material.descripcion, material.marca, material.familia); this.resizeGrid(); dg_Buscado.Focus(); } else if (!(string.IsNullOrWhiteSpace(this.txt_Catalogo.Text))) { this.dg_Buscado.DataSource = null; this.dg_Buscado.Rows.Clear(); string catalogo = this.txt_Catalogo.Text; sql.buscarDB(this.txt_Catalogo.Text, this.dg_Buscado); this.resizeGrid(); dg_Buscado.Focus(); } else { List <long> marcas = this.listSelectedMarcas(); List <long> familias = this.listSelectedFamilias(); sql.buscarDBFiltrado(this.txt_Descripcion.Text, familias, marcas, this.dg_Buscado); this.resizeGrid(); dg_Buscado.Focus(); } }
private void BtnAceptar_Click(object sender, EventArgs e) { this.ultimaFila = this.txt_UltimaFila.Text; this.nombreHoja = this.cmbListado.Text; helperFunctions help = new helperFunctions(); bool null_ultimaFila = string.IsNullOrWhiteSpace(this.txt_UltimaFila.Text); bool null_nombreHoja = string.IsNullOrWhiteSpace(this.cmbListado.Text); if (help.mensajeAdvEmpty(null_nombreHoja, "el nombre de la hoja.")) { return; } else if (help.mensajeAdvEmpty(null_ultimaFila, "la ultima fila del corrido de materiales.")) { return; } else if (!help.mensajeAdvInt(this.txt_UltimaFila.Text, "la ultima fila del corrido de materiales. Solo se aceptan numeros enteros.").boolean) { return; } this.DialogResult = DialogResult.OK; this.Close(); }