Beispiel #1
0
        private void loadProducto(int idProducto)
        {
            var task = Task.Run(() => LogicaProducto.getAllProductxId(idProducto));

            task.Wait();
            _infoPro = task.Result;
        }
Beispiel #2
0
        private void updateProducto()
        {
            try
            {
                TBL_PRODUCTO _infoPro = new TBL_PRODUCTO();
                var          task     = Task.Run(() => LogicaProducto.getAllProductxId(int.Parse(lblId.Text)));
                task.Wait();
                _infoPro = task.Result;
                if (_infoPro != null)
                {
                    _infoPro.PRO_ID          = int.Parse(lblId.Text);
                    _infoPro.CAT_ID          = Convert.ToInt32(UC_CAT1.DropDownList.SelectedValue);
                    _infoPro.PRO_CODIGO      = txtCod.Text;
                    _infoPro.PRO_DESCRIPCION = txtDes.Text;
                    _infoPro.PRO_NOMBRE      = txtNom.Text;
                    var d = fuimagen;
                    if (fuimagen.HasFile)
                    {
                        fuimagen.SaveAs(Server.MapPath("~/img") + "//" + fuimagen.FileName);
                        _infoPro.PRO_IMAGEN = "~/img/" + fuimagen.FileName;
                    }

                    _infoPro.PRO_PRECIO_COMPRA = Convert.ToDecimal(txtPC.Text);
                    _infoPro.PRO_PRECIO_VENTA  = Convert.ToDecimal(txtPV.Text);
                    _infoPro.PRO_STOCK_MINIMO  = Convert.ToInt32(txtSMin.Text);
                    _infoPro.PRO_STOCK_MAXIMO  = Convert.ToInt32(txtSMax.Text);

                    Task <bool> _taskSave = Task.Run(() => LogicaProducto.updateProduct(_infoPro));
                    _taskSave.Wait();
                    var resultado = _taskSave.Result;
                    if (resultado)
                    {
                        lblMessage.Text = "Registro guardado";
                        Response.Redirect("WfmProductoNuevo.aspx?cod=" + _infoPro.PRO_ID, true);
                    }
                    else
                    {
                        lblMessage.Text = "No se guardado";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message + "linea: " + ex.Source;
            }
        }
Beispiel #3
0
        private void loadProducto(int idProducto)
        {
            TBL_PRODUCTO _infoProducto = new TBL_PRODUCTO();
            var          task          = Task.Run(() => LogicaProducto.getAllProductxId(idProducto));

            task.Wait();
            _infoProducto = task.Result;
            if (_infoProducto != null)
            {
                lblId.Text  = _infoProducto.PRO_ID.ToString();
                lblImg.Text = _infoProducto.PRO_IMAGEN.ToString();
                UC_CAT1.DropDownList.SelectedValue = _infoProducto.CAT_ID.ToString();
                txtNom.Text  = _infoProducto.PRO_NOMBRE;
                txtDes.Text  = _infoProducto.PRO_DESCRIPCION;
                txtPC.Text   = _infoProducto.PRO_PRECIO_COMPRA.ToString();
                txtPV.Text   = _infoProducto.PRO_PRECIO_VENTA.ToString();
                txtCod.Text  = _infoProducto.PRO_CODIGO.ToString();
                txtSMin.Text = _infoProducto.PRO_STOCK_MINIMO.ToString();
                txtSMax.Text = _infoProducto.PRO_STOCK_MAXIMO.ToString();
            }
        }
Beispiel #4
0
        protected void ImageButton4_Click1(object sender, EventArgs e)
        {
            LinkButton objImage = (LinkButton)sender;

            string[]     commandArgs = objImage.CommandArgument.ToString().Split(new char[] { ',' });
            int          idProducto  = Convert.ToInt32(commandArgs[0]);
            TBL_PRODUCTO _infoPro    = new TBL_PRODUCTO();
            var          task        = Task.Run(() => LogicaProducto.getAllProductxId(idProducto));

            task.Wait();
            _infoPro = task.Result;

            List <Cart> _listCart = new List <Cart>();

            _listCart = (List <Cart>)Session["Cart"];

            Cart _addCart = Cart.intanciaCartXProducto(_infoPro, "1");

            Session["Cart"] = Cart.addCart(_listCart, _addCart);

            Response.Redirect("Principal.aspx", true);
        }