//Agrega Productos a la orden
        protected void ProductosGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Select")
            {
                int index = Convert.ToInt32(e.CommandArgument);

                Expression <Func <Productos, bool> > filtro      = p => true;
                RepositorioBase <Productos>          repositorio = new RepositorioBase <Productos>();
                var lista = repositorio.GetList(c => true);

                Ventas ventas    = new Ventas();
                var    productos = repositorio.Buscar(lista[index].ProductoId);

                if (CarritodeProductosGridView.Rows.Count != 0)
                {
                    ventas.DetalleProducto = (List <VentaProductosDetalle>)ViewState["VentaProductosDetalle"];
                }

                ventas.DetalleProducto.Add(new VentaProductosDetalle(productos.NombreProducto, productos.TipoProducto, productos.Precio, productos.Descripcion));

                Decimal.TryParse(TotalTextBox.Text, out decimal calculo);
                calculo           = calculo + productos.Precio;
                TotalTextBox.Text = calculo.ToString();

                ViewState["VentaProductosDetalle"]    = ventas.DetalleProducto;
                CarritodeProductosGridView.DataSource = ViewState["VentaProductosDetalle"];
                CarritodeProductosGridView.DataBind();
            }
        }
        protected void LimpiaOrden()
        {
            CarritodeProductosGridView.DataSource = null;
            CarritodeProductosGridView.DataBind();

            CarritodeCombosGridView.DataSource = null;
            CarritodeCombosGridView.DataBind();
        }
 protected void CarritodeProductosGridView_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     //Removiendo Producto y restando el precio del producto removido
     if (e.CommandName == "Select")
     {
         int index = Convert.ToInt32(e.CommandArgument);
         //List<VentaProductosDetalle> detalle = new List<VentaProductosDetalle>();
         //List<CombosDetalle> detalle2 = new List<CombosDetalle>();
         Expression <Func <Productos, bool> > filtro      = p => true;
         RepositorioBase <Productos>          repositorio = new RepositorioBase <Productos>();
         var     lista     = repositorio.GetList(c => true);
         var     productos = repositorio.Buscar(lista[index].ProductoId);
         decimal Total     = 0;
         Total             = Convert.ToDecimal(TotalTextBox.Text);
         Total            -= productos.Precio;
         TotalTextBox.Text = Total.ToString();
         ((List <VentaProductosDetalle>)ViewState["VentaProductosDetalle"]).RemoveAt(index);
         CarritodeProductosGridView.DataSource = ViewState["VentaProductosDetalle"];
         CarritodeProductosGridView.DataBind();
     }
 }
 //Refescando el grid con los productos eliminados
 protected void CarritodeProductosGridView_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     CarritodeProductosGridView.DataSource = ViewState["VentaProductosDetalle"];
     CarritodeProductosGridView.PageIndex  = e.NewPageIndex;
     CarritodeProductosGridView.DataBind();
 }