protected void dgvInsumos_RowEditing(object sender, GridViewEditEventArgs e)
        {
            dgvInsumos.EditIndex = e.NewEditIndex;
            Cargardgv();
            MedidaNegocio MedidaNeg  = new MedidaNegocio();
            InsumoNegocio insNegocio = new InsumoNegocio();
            Insumo        In         = new Insumo();

            //int id = Convert.ToInt32(dgvInsumos.SelectedDataKey.Value.ToString());
            // Convert.ToInt64(((DropDownList)dgvInsumos.Rows[e.NewEditIndex].FindControl("ddlMedida")).DataValueField);
            ((DropDownList)dgvInsumos.Rows[e.NewEditIndex].FindControl("ddlMedida")).DataValueField = "nombre";
            ((DropDownList)dgvInsumos.Rows[e.NewEditIndex].FindControl("ddlMedida")).DataTextField  = "nombre";
            ((DropDownList)dgvInsumos.Rows[e.NewEditIndex].FindControl("ddlMedida")).DataSource     = MedidaNeg.Listar();
            ((DropDownList)dgvInsumos.Rows[e.NewEditIndex].FindControl("ddlMedida")).DataBind();
            In = (insNegocio.listar(e.NewEditIndex + 1))[0];
            ((DropDownList)dgvInsumos.Rows[e.NewEditIndex].FindControl("ddlMedida")).Items.FindByValue(In.Medida).Selected = true;
        }
        public void CargarDGV()
        {
            List <Formula> lista = new List <Formula>();

            dgvFormulas.DataSource = lista;
            dgvFormulas.DataBind();
            InsumoNegocio insNeg = new InsumoNegocio();

            ddlInsumos.DataSource     = insNeg.listar();
            ddlInsumos.DataTextField  = "Nombre";
            ddlInsumos.DataValueField = "id";
            ddlInsumos.DataBind();
            ddlProductos.DataSource     = new ProductoNegocio().Listar();
            ddlProductos.DataTextField  = "Nombre";
            ddlProductos.DataValueField = "id";
            ddlProductos.DataBind();
            //lblMedida.Text = insNeg.BuscarMedida(ddlInsumos.SelectedValue.ToString());
            //lblMedida.DataBind();
            txbFecha.Text = DateTime.Now.ToString("dd/MM/yyyy");
        }
Beispiel #3
0
        protected void dgvFormulas_RowEditing(object sender, GridViewEditEventArgs e)
        {
            try
            {
                dgvFormulas.EditIndex = e.NewEditIndex;
                cargardgv();

                //((TextBox)dgvFormulas.Rows[e.NewEditIndex].FindControl("txbInsumos")).Text = dgvFormulas.Rows[e.NewEditIndex].Cells[1].Text.ToString();
                FormulaNegocio formulaNeg = new FormulaNegocio();
                InsumoNegocio  insNeg     = new InsumoNegocio();
                ((DropDownList)dgvFormulas.Rows[e.NewEditIndex].FindControl("ddlInsumos")).DataSource     = insNeg.listar();
                ((DropDownList)dgvFormulas.Rows[e.NewEditIndex].FindControl("ddlInsumos")).DataValueField = "id";
                ((DropDownList)dgvFormulas.Rows[e.NewEditIndex].FindControl("ddlInsumos")).DataTextField  = "nombre";
                ((DropDownList)dgvFormulas.Rows[e.NewEditIndex].FindControl("ddlInsumos")).DataBind();
                //Insumo insumo = new Insumo();
                //insumo.nombre = ((Label)dgvFormulas.Rows[e.NewEditIndex].FindControl("lblInsumo")).Text;
                int     idFormu = Convert.ToInt32((dgvFormulas.Rows[e.NewEditIndex].FindControl("lblId") as Label).Text);
                Formula formu   = (formulaNeg.ListarXidFormula(idFormu));
                ((DropDownList)dgvFormulas.Rows[e.NewEditIndex].FindControl("ddlInsumos")).Items.FindByValue(formu.insumo.id.ToString()).Selected = true;
            }
            catch (Exception ex)
            {
                lblIncorrecto.Text = ex.ToString();
            }
        }
Beispiel #4
0
        void cargardgv()
        {
            int            algo  = Convert.ToInt32(Session["idProducto"]);
            List <Formula> lista = (new FormulaNegocio().Listar(algo));

            dgvFormulas.DataSource = lista;
            dgvFormulas.DataBind();
            ((TextBox)dgvFormulas.FooterRow.FindControl("txbProductosFooter")).Text = cboBuscar.SelectedItem.ToString();
            InsumoNegocio insNeg = new InsumoNegocio();

            ((DropDownList)dgvFormulas.FooterRow.FindControl("ddlInsumosFooter")).DataSource     = insNeg.listar();
            ((DropDownList)dgvFormulas.FooterRow.FindControl("ddlInsumosFooter")).DataValueField = "id";
            ((DropDownList)dgvFormulas.FooterRow.FindControl("ddlInsumosFooter")).DataTextField  = "nombre";
            ((DropDownList)dgvFormulas.FooterRow.FindControl("ddlInsumosFooter")).DataBind();
        }
Beispiel #5
0
        protected void dgvDetalles_RowEditing(object sender, GridViewEditEventArgs e)
        {
            dgvDetalles.EditIndex = e.NewEditIndex;
            CargarDetalle(Convert.ToInt32(Session["idCompra"]));
            InsumoNegocio        insNeg = new InsumoNegocio();
            DetalleCompraNegocio detNeg = new DetalleCompraNegocio();

            ((DropDownList)dgvDetalles.Rows[e.NewEditIndex].FindControl("ddlInsumo")).DataSource     = insNeg.listar();
            ((DropDownList)dgvDetalles.Rows[e.NewEditIndex].FindControl("ddlInsumo")).DataValueField = "id";
            ((DropDownList)dgvDetalles.Rows[e.NewEditIndex].FindControl("ddlInsumo")).DataTextField  = "nombre";
            ((DropDownList)dgvDetalles.Rows[e.NewEditIndex].FindControl("ddlInsumo")).DataBind();
            Detallecompra det = (detNeg.Listar(e.NewEditIndex + 1))[0];

            ((DropDownList)dgvDetalles.Rows[e.NewEditIndex].FindControl("ddlInsumo")).Items.FindByValue(det.insumo.id.ToString()).Selected = true;
        }