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 FrmVerMaterial_Load(object sender, EventArgs e) { sqlCommands sql = new sqlCommands(); clsMaterial = sql.buscarID(clsMaterial.id); this.txt_Id.Text = clsMaterial.id.ToString(); this.txt_Familia.Text = clsMaterial.familia; this.txt_Marca.Text = clsMaterial.marca; this.txt_Catalogo.Text = clsMaterial.catalogo; this.txt_Comentarios.Text = clsMaterial.comentario; this.txt_Descripcion.Text = clsMaterial.descripcion; this.txt_SAP.Text = clsMaterial.codsap.ToString(); this.txt_specCatalogo.Text = clsMaterial.speccatalogo; this.txt_specEnercom.Text = clsMaterial.specenercom; this.txt_specTexto.Text = clsMaterial.spectexto; this.txt_specUl.Text = clsMaterial.specul; this.txt_specVarias.Text = clsMaterial.specvarias; }