Exemplo n.º 1
0
        private void Buscar_Click(object sender, EventArgs e)
        {
            try
            {
                string condicion = "";
                if (txtCod.Text.Length > 0)
                {
                    condicion      = "Where Codigo = '" + txtCod.Text + "'";
                    txtNombre.Text = "";
                    condicion      = condicionMarcas(condicion);
                }
                else if (txtNombre.Text.Length > 0)
                {
                    condicion   = "Where Nombre Like '%" + txtNombre.Text + "%'";
                    txtCod.Text = "";
                    condicion   = condicionMarcas(condicion);
                }
                else if (Marcacheck.Checked == true || CategoriaCheck.Checked == true)
                {
                    condicion = "Where ";
                    condicion = condicionMarcas(condicion);
                }

                Negocios.Negocio negocio = new Negocios.Negocio();
                idataTable                      = negocio.ObtenerDataTable(true, condicion, "Select id, codigo as 'Codigo',nombre as 'Nombre',descripcion as 'Descripcion',(Select descripcion from MARCAS where id=idmarca) as 'Marca',(Select descripcion from CATEGORIAS where id=idcategoria) as 'Categoria', precio as 'Precio' from Articulos");
                iDataGrid.DataSource            = idataTable.DefaultView;
                iDataGrid.Columns["id"].Visible = false;
                negocio = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 private void Producto_Buscar_Load(object sender, EventArgs e)
 {
     Negocios.Negocio negocio = new Negocios.Negocio();
     negocio.ObtenerComboBoxes(boxMarca, "marcas");
     negocio.ObtenerComboBoxes(boxCategoria, "Categorias");
     negocio = null;
 }
Exemplo n.º 3
0
 private void Listar_Producto_Load(object sender, EventArgs e)
 {
     try
     {
         string           query      = "Select codigo as 'Codigo',nombre as 'Nombre',descripcion as 'Descripcion',(Select descripcion from MARCAS where id=idmarca) as 'Marca',(Select descripcion from CATEGORIAS where id=idcategoria) as 'Categoria', precio as 'Precio' from Articulos";
         DataTable        idataTable = new DataTable();
         Negocios.Negocio negocio    = new Negocios.Negocio();
         idataTable           = negocio.ObtenerDataTable(false, "", query);
         iDataGrid.DataSource = idataTable.DefaultView;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 4
0
 private void Eliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (iDataGrid.DataSource != null && iDataGrid.CurrentCell != null)
         {
             DialogResult dialogResult = MessageBox.Show("¿Desea Eliminar el producto?", "Keruministrador - Eliminar Producto", MessageBoxButtons.YesNo);
             if (dialogResult == DialogResult.Yes)
             {
                 Negocios.Negocio negocio = new Negocios.Negocio();
                 negocio.Borrar(int.Parse(iDataGrid.Rows[iDataGrid.CurrentCell.RowIndex].Cells["id"].Value.ToString()));
                 iDataGrid.Refresh();
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }