Ejemplo n.º 1
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            decimal total   = 0;
            int     totalc  = 0;
            Reserva reserva = new Reserva();

            reserva = (Reserva)ViewState["Reserva"];
            reserva.AgregarDetalle(0, Utils.ToInt(IDTexBox.Text), NombreTextBox.Text, Utils.ToInt(NumeroMesaDropdownList.SelectedValue), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDateTime(FechaLabel.Text));
            ViewState["Reserva"] = reserva;
            this.BindGrid();



            foreach (var item in reserva.Detalle)
            {
                total += item.Precio;
            }
            TotalTextBox.Text = total.ToString();

            foreach (var item in reserva.Detalle)
            {
                totalc += item.Cantidad;
            }
            CntTextBox.Text = totalc.ToString();
        }