protected void Page_Load(object sender, EventArgs e) { OrderTier theTier = new OrderTier(); List <Orders> orders = (List <Orders>)Session["Pending"]; orders = theTier.getPendingOrders(); if (orders == null) { lblOrd.Text = "No items to display."; } else { lblOrd.Text = " "; Table theTable = null; foreach (Orders order in orders) { orderno = order.order_no; qty = order.qty_ordered; } ItemTier aTier = new ItemTier(); List <Item> items = aTier.getIncomingItems(); foreach (Item item in items) { theTable = getItemTable(item); pnlOut.Controls.Add(theTable); } } }
protected void ordClick(Object Sender, EventArgs e) { //whichever button is clicked with id = SKU Button theButton = (Button)Sender; int id = int.Parse(theButton.ID); Session["OrderInfo"] = new Orders(); Orders ord = (Orders)Session["OrderInfo"]; ord.SKU = id; Session["OrderInfo"] = ord; List <Item> items = (List <Item>)Session["Incoming"]; ItemTier theTier = new ItemTier(); items = theTier.getIncomingItems(); Session["Incoming"] = items; bool exists = false; if (items != null) { for (int i = 0; i < items.Count(); i++) { if (items[i].SKU == id) { exists = true; } } if (exists == true) { Response.Write("<script>alert('Item has already been ordered. Check Pending orders page.')</script>"); } else { Response.Redirect("OrderConf.aspx"); } } else { Response.Redirect("OrderConf.aspx"); } }