Exemplo n.º 1
0
 public void buscar()
 {
     try
     {
         this.dataGridViewProduct.DataSource = Lproducto.BuscarP(this.txtbuscar.Text);
     }
     catch (Exception ex)
     {
         mesajerror(ex.Message);
     }
 }
Exemplo n.º 2
0
 public void mostrar()
 {
     try
     {
         this.Dock = DockStyle.Fill;
         this.dataGridViewProduct.DataSource         = Lproducto.MostrarP();
         this.dataGridViewProduct.Columns[0].Visible = false;
     }
     catch (Exception ex)
     {
         mesajerror(ex.Message);
     }
 }
Exemplo n.º 3
0
        private void btnguardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rsp = "";

                if (this.txtnombreProduco.Text == string.Empty || this.txtStock.Text == string.Empty)
                {
                    MensajeError("No puede dejar nombre de campo vacío");
                    erroricono.SetError(txtnombreProduco, "Debe ingresar nombre Producto");
                }
                else
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    pximagen.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

                    byte[] imagen = ms.GetBuffer();


                    if (this.isnuevo)
                    {
                        rsp = Lproducto.InsertarP(Convert.ToInt32(this.txtidProveed.Text), Convert.ToInt32(this.txtidcategoria.Text), this.PLMay(this.txtnombreProduco.Text), Convert.ToDecimal(this.txtPrecCompra.Text), Convert.ToDecimal(this.txtPrecUnit.Text), Convert.ToDecimal(this.txtStock.Text), Convert.ToDecimal(this.txtPuntReposicion.Text), this.PLMay(this.txtMarca.Text), this.PLMay(this.txtestadoP.Text), imagen, Convert.ToDateTime(this.dtpikerVencimiento.Text), (this.cbxUniMedid.Text), this.txtdescripProd.Text);
                    }
                    //Convert.ToDateTime(this.dtpikeringreso.Text), Convert.ToDateTime(this.dtpikegreso.Text)

                    if (rsp.Equals("Y"))
                    {
                        this.mesajeok("Se registró con exito");

                        _owner.mostrar();

                        this.Close();
                    }
                    else
                    {
                        this.MensajeError(rsp);
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }