//Finalizing the trade-in item protected void btnAddTradeIN_Click(object sender, EventArgs e) { //Grabbing the values of the trade-in item int sku = idu.tradeInSku(storeLocation); double cost = Convert.ToDouble(txtCost.Text); int brandID = Convert.ToInt32(ddlBrand.SelectedValue); int modelID = Convert.ToInt32(ddlModel.SelectedValue); int quant = Convert.ToInt32(txtQuantity.Text); string clubType = txtClubType.Text; string shaft = txtShaft.Text; string clubSpec = txtClubSpec.Text; string shaftFlex = txtShaftFlex.Text; string numOfClubs = txtNumberofClubs.Text; string shaftSpec = txtShaftSpec.Text; string dext = txtDexterity.Text; string comments = txtComments.Text; bool used = true; //Set to true because a trade-in item is used //Creating a new club Clubs tradeIN = new Clubs(sku, brandID, modelID, 1, clubType, shaft, numOfClubs, 0, cost, 0, quant, clubSpec, shaftSpec, shaftFlex, dext, used, comments); //Trade in club to be displayed Clubs tradeINDisplay = new Clubs(sku, brandID, modelID, 1, clubType, shaft, numOfClubs, 0, 0, (cost * (-1)), quant, clubSpec, shaftSpec, shaftFlex, dext, used, comments); //Adding the trade-in item to the trade-in storage idu.addTradeInItem(tradeIN); //Adding trade-in item to cart List <Cart> itemsInCart; itemsInCart = (List <Cart>)Session["ItemsInCart"]; o = tradeINDisplay as Object; itemsInCart.Add(idu.addingToCart(o)); Session["UpdateTheCart"] = true; //Closing the trade in information window string redirect = "<script>window.close('TradeINEntry.aspx');</script>"; Response.Write(redirect); }
protected void grdInventorySearched_RowCommand(object sender, GridViewCommandEventArgs e) { bool bolAdded = false; if (Session["ItemsInCart"] != null) { itemsInCart = (List <Cart>)Session["ItemsInCart"]; } int itemKey = Convert.ToInt32(e.CommandArgument.ToString()); if (e.CommandName == "AddItem") { foreach (var cart in itemsInCart) { if (cart.sku == itemKey && !bolAdded) { cart.quantity = cart.quantity + 1; bolAdded = true; } } //int locationID = Convert.ToInt32(lblLocationID.Text); int locationID = 0; //Finding the min and max range for trade ins int[] range = idu.tradeInSkuRange(locationID); //If the itemKey is between or equal to the ranges, do trade in if (itemKey >= range[0] && itemKey < range[1]) { //Trade In Sku to add in SK string redirect = "<script>window.open('TradeINEntry.aspx');</script>"; Response.Write(redirect); } else if (itemsInCart.Count == 0 || !bolAdded) { Clubs c = ssm.singleItemLookUp(itemKey); Clothing cl = ssm.getClothing(itemKey); Accessories ac = ssm.getAccessory(itemKey); if (c.sku != 0) { o = c as Object; } else if (cl.sku != 0) { o = cl as Object; } else if (ac.sku != 0) { o = ac as Object; } itemsInCart.Add(idu.addingToCart(o)); } } Session["ItemsInCart"] = itemsInCart; grdCartItems.DataSource = itemsInCart; grdCartItems.DataBind(); List <Items> nullGrid = new List <Items>(); nullGrid = null; grdInventorySearched.DataSource = nullGrid; grdInventorySearched.DataBind(); lblSubtotalDisplay.Text = "$ " + ssm.returnSubtotalAmount(itemsInCart).ToString("#.00"); }