/// <summary> /// Adds an individual item to to purchase /// </summary> protected void btnAddItemToPurchase_Click(object sender, EventArgs e) { if (ddlIngredientPurchase.SelectedIndex>-1) { if (ddlChooseItemForPurchase.SelectedIndex == 0) { if (Session["drinklist"] == null) { drinkPurchase = new List<IngredientPurchaseHistory>(); } else { drinkPurchase = (List<IngredientPurchaseHistory>)Session["drinklist"]; } IngredientPurchaseHistory dph = new IngredientPurchaseHistory();//This is the purchase history object dph.IngredientPurchaseHistoryPrice = System.Convert.ToDecimal(txtPrice.Text);//add price to iph = convert string to decimal dph.IngredientPurchaseHistoryQty = short.Parse(txtQty.Text);//add qty = convert to short/int16 dph.IngredientID = Convert.ToSByte(ddlIngredientPurchase.SelectedValue); drinkPurchase.Add(dph); gvshowIngredientPurchases.Visible = false; Session["drinklist"] = drinkPurchase; } else { if (Session["ingredientlist"] == null) { purchase = new List<IngredientPurchaseHistory>(); } else { purchase = (List<IngredientPurchaseHistory>)Session["ingredientlist"]; } IngredientPurchaseHistory iph = new IngredientPurchaseHistory();//This is the purchase history object iph.IngredientPurchaseHistoryPrice = System.Convert.ToDecimal(txtPrice.Text);//add price to iph = convert string to decimal iph.IngredientPurchaseHistoryQty = short.Parse(txtQty.Text);//add qty = convert to short/int16 iph.IngredientID = Convert.ToSByte(ddlIngredientPurchase.SelectedValue); purchase.Add(iph); gvshowIngredientPurchases.DataSource = purchase; gvshowIngredientPurchases.DataBind(); gvshowIngredientPurchases.Visible = true; Session["ingredientlist"] = purchase; } btnSubmitPurchase.Visible = true; //reset fields for new item to be added txtQty.Text = ""; txtPrice.Text = ""; btnManageCategories.Enabled = false; btnManageMenuItems.Enabled = false; btnEnterPurchase.Enabled = false; btnIngredients.Enabled = false; btnClear.Visible = true; } }
private void detach_IngredientPurchaseHistories(IngredientPurchaseHistory entity) { this.SendPropertyChanging(); entity.Ingredient = null; }
partial void UpdateIngredientPurchaseHistory(IngredientPurchaseHistory instance);
partial void DeleteIngredientPurchaseHistory(IngredientPurchaseHistory instance);
partial void InsertIngredientPurchaseHistory(IngredientPurchaseHistory instance);