Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SaleTier    theTier  = new SaleTier();
            List <Sale> saleList = theTier.getAllItems();

            grvSale.DataSource = saleList;
            grvSale.DataBind();
        }
Пример #2
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            List <Item> cart;

            if (Session["cart"] == null)
            {
                cart = new List <Item>();
            }
            else
            {
                cart = (List <Item>)Session["cart"];
            }

            Session["cart"] = null;

            foreach (Item buy in cart)
            {
                Sale sale = new Sale();
                sale.SKU   = buy.SKU;
                sale.price = buy.price;
                //1 qty at a time for now
                sale.qty_sold = 1;


                Users me = (Users)Session["UserID"];
                sale.user_id = me.user_id;

                //add sale to table
                SaleTier add = new SaleTier();
                add.addSale(sale);

                //decrease item from inventory
                ItemTier dec = new ItemTier();
                dec.decreaseItem(buy.SKU);


                sale = null;
            }

            Session["cart"] = cart;

            cart.Clear();

            Response.Redirect("Purchases.aspx");

            total = 0;
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserID"] != null)
            {
                Users me = (Users)Session["UserID"];

                SaleTier    theTier = new SaleTier();
                List <Sale> sales   = theTier.getUserPurchase(me.user_id);
                if (sales == null)
                {
                    lblPurch.Text = "No items to display.";
                }
                else
                {
                    lblPurch.Text = " ";
                    Table theTable = null;
                    foreach (Sale order in sales)
                    {
                        Sale s = new Sale();
                        s.sales_no             = order.sales_no;
                        s.SKU                  = order.SKU;
                        s.user_id              = order.user_id;
                        Session["MyPurchases"] = s;

                        ItemTier aTier = new ItemTier();
                        Item     items = aTier.getItemByID(s.SKU);

                        //foreach (Item item in items)
                        //{
                        theTable = getItemTable(items);
                        pnlOut.Controls.Add(theTable);
                        //}
                    }
                }
            }
            else
            {
                Response.Redirect("UserProductList.aspx");
            }
        }