Example #1
0
        private void txtcodpro_Validating(object sender, CancelEventArgs e)
        {
            // fill customer data in validate method
            EProducto producto = new EProducto();

            // if txt codigo is empty go out
            if (txtcodpro.Text != string.Empty)
            {
                producto.Idproveedor = Convert.ToInt32(this.txtcodpro.Text.Trim());
            }
            else
            {
                return;
            }
            DataSet ds = new DataSet();

            ds = bus_producto.FilterbyID(producto);
            // if the dataset is filled, it means that there are data and we have to fill the fields
            // if not empty the fields
            if (utilites_presentation.isdataset_empty(ds) != true)
            {
                this.txtcodpro.Text  = ds.Tables[0].Rows[0]["idproducto"].ToString();
                this.txtnompro.Text  = ds.Tables[0].Rows[0]["nombre"].ToString();
                this.txtprevent.Text = ds.Tables[0].Rows[0]["precio"].ToString();
            }
            else
            {
                this.txtnompro.Text   = string.Empty;
                this.txtprevent.Text  = string.Empty;
                this.txtcantvent.Text = string.Empty;
            }
        }