protected void BtnAddToCartClick(object sender, EventArgs e)
        {
            Int32 productId = Convert.ToInt32(Request.Params.Get("productId"));
            Int32 cant      = Convert.ToInt32(listaCantidades.SelectedValue);

            SessionManager.AddToShoppingCart(productId, cant);
            string message = GetLocalResourceObject("message.Text").ToString();

            Response.Write("<script language=javascript>alert('" + message + "'); location.href='/Pages/MainPage.aspx';</script>");
        }
        protected void gvProductsTag_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            GridViewRow row              = gvProductsTag.Rows[e.NewSelectedIndex];
            long        idProduct        = Convert.ToInt32(row.Cells[4].Text);
            int         numberOfElements = 1;
            int         units            = Convert.ToInt32(row.Cells[3].Text);
            string      name             = row.Cells[0].Text;

            if (units == 0)
            {
                lblNoUnits.Visible = true;
            }
            else
            {
                lblNoUnits.Visible = false;
                SessionManager.AddToShoppingCart(idProduct, numberOfElements);
                Response.Redirect(Request.RawUrl.ToString());
            }
        }
        protected void gvProductsResult_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            GridViewRow row              = gvProductsResult.Rows[e.NewSelectedIndex];
            long        idProduct        = Convert.ToInt32(row.Cells[4].Text);
            int         numberOfElements = 1;
            int         units            = Convert.ToInt32(row.Cells[3].Text);
            string      name             = row.Cells[0].Text;

            if (units == 0)
            {
                lblNoUnits.Visible = true;
            }
            else
            {
                lblNoUnits.Visible = false;
                SessionManager.AddToShoppingCart(idProduct, numberOfElements);
                Response.Redirect(Request.RawUrl.ToString());
                //Response.Write("<script language=javascript>if(confirm('Desea imprimir el reporte?')==true){ location.href=Request.RawUrl.ToString();}else { location.href=Request.RawUrl.ToString();}</script>");
            }
        }
Ejemplo n.º 4
0
        protected void BtnAddCartClick(object sender, EventArgs e)
        {
            try
            {
                Button button = (Button)sender;
                long   id     = long.Parse(button.Attributes["pId"]);

                SessionManager.AddToShoppingCart(Context, id, 1, false);

                Response.Redirect(
                    Response.ApplyAppPathModifier("~/Pages/Shopping/Cart.aspx"));
            }
            catch (StockEmptyException ex)
            {
                int    index = ex.Message.LastIndexOf('|');
                string men   = ex.Message.Substring(index + 15);

                lblAmountError.Text   += men;
                lblAmountError.Visible = true;
            }
        }
        protected void BtnAddCartClick(object sender, EventArgs e)
        {
            try
            {
                long id     = long.Parse(Request.Params.Get("product"));
                int  amount = Convert.ToInt32(txtAmount.Text);

                SessionManager.AddToShoppingCart(Context, id, amount, checkGift.Checked);

                Response.Redirect(
                    Response.ApplyAppPathModifier("~/Pages/Shopping/Cart.aspx"));
            }
            catch (StockEmptyException ex)
            {
                int    index = ex.Message.LastIndexOf('|');
                string men   = ex.Message.Substring(index + 15);

                lblAmountError.Text   += men;
                lblAmountError.Visible = true;
            }
        }