Ejemplo n.º 1
0
        protected void agregarLinkButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                List <FacturasDetalles> listDetalle = new List <FacturasDetalles>();

                Facturas facturas = new Facturas();


                DateTime date     = DateTime.Now.Date;
                int      cantidad = Utils.ToInt(cantidadTextBox.Text);
                int      precio   = Utils.ToInt(precioTextBox.Text);
                int      importe  = Utils.ToInt(importeTextBox.Text);

                //var dat = new DateTime(2019, 03, 15);
                int    ropaId      = Utils.ToIntObjetos(RopaDropDownList.SelectedValue);
                string descripcion = Heramientas.Descripcion(ropaId);

                if (detalleGridView.Rows.Count != 0)
                {
                    facturas.Detalles = (List <FacturasDetalles>)ViewState["FacturaDetalle"];
                }
                Valores(importe);
                totalTextBox.Text = importe.ToString();

                facturas.Detalles.Add(new FacturasDetalles(0, Utils.ToInt(FacturaIdTextbox.Text), ropaId, descripcion, cantidad, precio, importe));



                ViewState["FacturaDetalle"] = facturas.Detalles;
                detalleGridView.DataSource  = ViewState["FacturaDetalle"];
                detalleGridView.DataBind();
            }
        }
Ejemplo n.º 2
0
 public void LlenarCampos(Facturas factura)
 {
     FechaTextBox.Text = factura.Fecha.ToString("yyyy-MM-dd");
     ClienteDropDownList.SelectedValue = factura.ClienteId.ToString();
     detalleGridView.DataSource        = Heramientas.ListaDetalle(Utils.ToInt(FacturaIdTextbox.Text));
     detalleGridView.DataBind();
     itbisTextBox.Text    = factura.Itbis.ToString();
     subtotalTextBox.Text = factura.SubTotal.ToString();
     totalTextBox.Text    = factura.Total.ToString();
 }