예제 #1
0
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            Articulos articulo = new Articulos();

            ObtenerValores(articulo);
            if (ArticuloIdTextBox.Text == "")
            {
                Response.Write("<script>alert('Debe insertar un Id')</script>");
            }
            else
            {
                if (articulo.Buscar(articulo.ArticuloId))
                {
                    if (articulo.Eliminar())
                    {
                        Response.Write("<script>alert('Eliminado correctamente')</script>");
                        Limpiar();
                    }
                    else
                    {
                        Response.Write("<script>alert('Error al eliminar')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('Id no encontrado')</script>");
                    Limpiar();
                }
            }
        }
예제 #2
0
        protected void SearchButton_Click(object sender, EventArgs e)
        {
            Articulos art = new Articulos();
            int       id  = 0;

            int.TryParse(IdTextBox.Text, out id);
            art.Buscar(id);
            LlenaCampos(art);
        }
        protected void DdLstArticulos_SelectedIndexChanged(object sender, EventArgs e)
        {
            Articulos art = new Articulos();

            if (art.Buscar(Convert.ToInt32(DdLstArticulos.SelectedValue)))
            {
                TxBxExistencia.Text = art.Existencia.ToString();
                txtPrecio.Text      = art.Precio.ToString();
                HidDescArtic.Value  = art.Descripcion;
            }
        }
예제 #4
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            Articulos a = new Articulos();

            a.Buscar(Convert.ToInt32(IdTextBox.Text));

            if (a.Eliminar())
            {
                Utilitarios.ShowToastr(this, "Eliminado", "Mensaje", "success");
                Limpiar();
            }
        }
 protected void BuscarButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         mensajes("Introdusca el ID");
     }
     else
     if (IdTextBox.Text.Length != 0)
     {
         if (articulo.Buscar(IdTextBox.Text.Length))
         {
             LlenarCampos();
         }
         else
         {
             mensajes("Id no exite");
         }
     }
     else
     {
         mensajes("Id no encontrado");
     }
 }
예제 #6
0
        protected void AgregarButton_Click(object sender, EventArgs e)
        {
            VentasDetalle ventaDetalle = new VentasDetalle();
            Articulos     articulo     = new Articulos();

            if (ArticuloDropDownList.SelectedIndex != 0)
            {
                ControlDeBotones(1);
                articulo.ArticuloId = ArticuloDropDownList.SelectedIndex;
                articulo.Buscar(articulo.ArticuloId);
                if (articulo.Existencia > ConvertirValor(CantidadTextBox.Text))
                {
                    Ventas venta;
                    if (Session["Venta"] == null)
                    {
                        Session["Venta"] = new Ventas();
                    }

                    venta = (Ventas)Session["Venta"];
                    venta.AgregarArticulo(articulo.ArticuloId, ConvertirValor(CantidadTextBox.Text), articulo.Precio);

                    ventaDetalle.Descripcion = articulo.Descripcion;
                    ventaDetalle.Cantidad    = ConvertirValor(CantidadTextBox.Text);
                    ventaDetalle.Precio      = articulo.Precio;


                    venta.AgregarCantidadArticulo(articulo.Existencia - ventaDetalle.Cantidad, articulo.ArticuloId);
                    Session["Venta"] = venta;

                    GuardatLista(ventaDetalle);
                    DetalleGridView.DataSource = ObtenerLista();
                    DetalleGridView.DataBind();

                    venta.Monto    += articulo.Precio * ventaDetalle.Cantidad;
                    MontoLabel.Text = venta.Monto.ToString();

                    ArticuloDropDownList.SelectedIndex = 0;
                    CantidadTextBox.Text = "";
                }
                else
                {
                    Mensaje("Usted a sobrepasado la cantidad maxima de este articulo");
                }
            }
            else
            {
                Mensaje("Seleccione un articulo");
            }
        }
예제 #7
0
        protected void LlenarClase(Ventas v)
        {
            Articulos a = new Articulos();

            v.Fecha = FechaTextBox.Text;
            v.Monto = Convert.ToSingle(MontoTextBox.Text);


            foreach (GridViewRow g in ArtGridView.Rows)
            {
                v.AgregarArticulos(v.VentaId, Convert.ToInt32(g.Cells[0].Text), Convert.ToInt32(g.Cells[2].Text), Convert.ToSingle(g.Cells[3].Text));
                a.Buscar(Convert.ToInt32(g.Cells[0].Text));
                a.EditarExistencia(Convert.ToInt32(g.Cells[0].Text), Convert.ToInt32(g.Cells[2].Text), true);
            }
        }
예제 #8
0
        protected void AddButton_Click(object sender, EventArgs e)
        {
            Articulos art = new Articulos();
            DataTable dt  = (DataTable)ViewState["Detalle"];

            art.Buscar(Convert.ToInt32(ArticulosDropDownList.SelectedValue));
            aux = (float)ViewState["Monto"];
            dt.Rows.Add(art.ArticuloId, art.Descripcion, cantTextBox.Text, art.Precio);
            ViewState["Detalle"]   = dt;
            ArtGridView.DataSource = (DataTable)ViewState["Detalle"];
            ArtGridView.DataBind();
            aux += art.Precio * Convert.ToInt32(cantTextBox.Text);
            ViewState["Monto"] = aux;
            MontoTextBox.Text  = ViewState["Monto"].ToString();
            cantTextBox.Text   = "";
        }
예제 #9
0
        protected void RepArticulos_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            txtId.Text = e.CommandName;
            Utilitarios.ShowToastr(this, "Clickaste", "Informacion", "info");

            if (e.CommandName == "cmdSel")
            {
                LimpiaCampos();
                Articulos art = new Articulos();

                art.Buscar(Convert.ToInt32(e.CommandArgument));
                TxBxDescripcion.Text = art.Descripcion;
                txtExistencia.Text   = art.Existencia.ToString();
                txtPrecio.Text       = art.Precio.ToString();
            }
        }
예제 #10
0
        protected void buscarArticuloButton_Click(object sender, EventArgs e)
        {
            Articulos articulo = new Articulos();
            int       id       = 0;

            int.TryParse(ArticuloIdTextBox.Text, out id);
            if (id > 0)
            {
                if (articulo.Buscar(id))
                {
                    DevolverDatosArticulos(articulo);
                }
                else
                {
                    Utility.ShowToastr(this, "Id no Existe", "MESSAGE", "Warning");
                }
            }
        }
예제 #11
0
        protected void btnBuscarArticulos_Click(object sender, EventArgs e)
        {
            LimpiaCampos();
            Articulos art = new Articulos();

            if (txtId.Text != string.Empty)
            {
                if (art.Buscar(Convert.ToInt32(txtId.Text)))
                {
                    TxBxDescripcion.Text = art.Descripcion;
                    txtExistencia.Text   = art.Existencia.ToString();
                    txtPrecio.Text       = art.Precio.ToString();
                }
                else
                {
                    Utilitarios.ShowToastr(this, "No Existe dicho registro", "ERROR", "error");
                }
            }
        }
예제 #12
0
        protected void BuscarButton_Click(object sender, EventArgs e)
        {
            Articulos articulos = new Articulos();

            articulos.ArticuloId = int.Parse(ArticuloIdTextBox.Text);


            if (articulos.ArticuloId > 0)
            {
                articulos.Buscar(articulos.ArticuloId);
                MostrarCampos(articulos);
                Response.Write("Id  encontrado");
            }
            else
            {
                Response.Write("Id no encontrado");
                Limpiar();
            }
        }
예제 #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["IdArticulo"] != null)
         {
             EliminarButton.Visible = true;
             articulos.IdArticulo   = int.Parse(Request.QueryString["IdArticulo"]);
             if (articulos.Buscar())
             {
                 IdArticuloTextBox.Text  = articulos.IdArticulo.ToString();
                 DescripcionTextBox.Text = articulos.Descripcion;
                 TipoDropDown.Text       = articulos.Tipo;
                 ExistenciaTextBox.Text  = articulos.Existencia.ToString();
                 CostoTextBox.Text       = articulos.Costo.ToString();
                 PrecioTextBox.Text      = articulos.Precio.ToString();
             }
         }
     }
 }
예제 #14
0
        protected void LlenaCampos(Ventas v)
        {
            VentasDetalle vd  = new VentasDetalle();
            Articulos     art = new Articulos();

            IdTextBox.Text    = v.VentaId.ToString();
            FechaTextBox.Text = v.Fecha;
            MontoTextBox.Text = v.Monto.ToString();



            foreach (var a in v.Detalle)
            {
                art.Buscar(a.ArticuloId);
                DataTable det = (DataTable)ViewState["Detalle"];
                det.Rows.Add(a.ArticuloId, art.Descripcion, a.Cantidad, a.Precio);
                ViewState["Detalle"]   = det;
                ArtGridView.DataSource = (DataTable)ViewState["Detalle"];
                ArtGridView.DataBind();
            }
        }
예제 #15
0
        protected void DeleteButton_Click(object sender, EventArgs e)
        {
            Ventas        v   = new Ventas();
            Articulos     art = new Articulos();
            VentasDetalle vd  = new VentasDetalle();
            int           id  = 0;

            int.TryParse(IdTextBox.Text, out id);
            v.Buscar(id);

            foreach (var a in v.Detalle)
            {
                art.Buscar(a.ArticuloId);
                art.EditarExistencia(art.ArticuloId, a.Cantidad, false);
            }


            if (v.Eliminar())
            {
                Utilitarios.ShowToastr(this, "Eliminado con exito", "Mensaje", "success");
                Limpiar();
            }
        }