protected void Cargar_Tabla()
        {
            GestionProductos gestion = new GestionProductos();

            grd_SelProductos.DataSource = gestion.ObtenerTodosLosProductos();
            grd_SelProductos.DataBind();
        }
Ejemplo n.º 2
0
        protected void CargarTabla()
        {
            GestionProductos gProductos = new GestionProductos();

            grd_Productos.DataSource = gProductos.ObtenerTodosLosProductos();
            grd_Productos.DataBind();
        }
Ejemplo n.º 3
0
        protected void grd_Productos_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string lbl_id = ((Label)grd_Productos.Rows[e.RowIndex].FindControl("lbl_it_prod")).Text;

            Producto prod = new Producto();

            prod.ID = Convert.ToInt32(lbl_id);

            GestionProductos gProductos = new GestionProductos();

            gProductos.EliminarProductos(prod);

            CargarTabla();
        }
Ejemplo n.º 4
0
        protected void grd_Productos_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //Busco los datos del edit template

            string lbl_id      = ((Label)grd_Productos.Rows[e.RowIndex].FindControl("lbl_eit_IdProducto")).Text;
            string lbl_NomProd = ((TextBox)grd_Productos.Rows[e.RowIndex].FindControl("tb_eit_NombreProducto")).Text;
            string lbl_cant    = ((TextBox)grd_Productos.Rows[e.RowIndex].FindControl("tb_eit_CantidadxUnidad")).Text;
            string lbl_preUni  = ((TextBox)grd_Productos.Rows[e.RowIndex].FindControl("tb_eit_PrecioUnitario")).Text;

            Producto prod = new Producto();

            prod.ID             = Convert.ToInt32(lbl_id);
            prod.Nombre         = lbl_NomProd;
            prod.CantidadUnidad = lbl_cant;
            prod.PrecioUnidad   = Convert.ToDecimal(lbl_preUni);

            GestionProductos gProductos = new GestionProductos();

            gProductos.ActualizarProductos(prod);

            grd_Productos.EditIndex = -1;
            CargarTabla();
        }