// Reset Button Currency private void ResetButton_Click(object sender, RoutedEventArgs e) { //Buy Buttons BuyAlchemy.Clear(); BuyAlt.Clear(); BuyAncient.Clear(); BuyAnnulment.Clear(); BuyAugmentation.Clear(); BuyBauble.Clear(); BuyBinding.Clear(); BuyBlessed.Clear(); BuyChance.Clear(); BuyChisel.Clear(); BuyChromatic.Clear(); BuyDivine.Clear(); BuyEngineers.Clear(); BuyEx.Clear(); BuyFusing.Clear(); BuyGCP.Clear(); BuyHarbinger.Clear(); BuyHorizons.Clear(); BuyJeweller.Clear(); BuyPerandus.Clear(); BuyPortal.Clear(); BuyRegal.Clear(); BuyRegret.Clear(); BuySimple_Sextant.Clear(); BuyScouring.Clear(); BuyScrap.Clear(); BuySilver.Clear(); BuyTransmute.Clear(); BuyVaal.Clear(); BuyWhetstone.Clear(); BuyWisdom.Clear(); BuyPrime_Sextant.Clear(); BuyAwakened_Sextant.Clear(); BuyMirror.Clear(); BuyHunter.Clear(); BuyWarlord.Clear(); BuyRedeemer.Clear(); BuyCrusader.Clear(); //Sell Buttons SellAlchemy.Clear(); SellAlt.Clear(); SellAncient.Clear(); SellAnnulment.Clear(); SellAugmentation.Clear(); SellBauble.Clear(); SellBinding.Clear(); SellBlessed.Clear(); SellChance.Clear(); SellChisel.Clear(); SellChromatic.Clear(); SellDivine.Clear(); SellEngineers.Clear(); SellEx.Clear(); SellFusing.Clear(); SellGCP.Clear(); SellHarbinger.Clear(); SellHorizons.Clear(); SellJeweller.Clear(); SellPerandus.Clear(); SellPortal.Clear(); SellRegal.Clear(); SellRegret.Clear(); SellSimple_Sextant.Clear(); SellScouring.Clear(); SellScrap.Clear(); SellSilver.Clear(); SellTransmute.Clear(); SellVaal.Clear(); SellWhetstone.Clear(); SellWisdom.Clear(); SellPrime_Sextant.Clear(); SellAwakened_Sextant.Clear(); SellMirror.Clear(); SellHunter.Clear(); SellWarlord.Clear(); SellRedeemer.Clear(); SellCrusader.Clear(); //Profit TextBoxes ProfitAlchemy.Clear(); ProfitAlt.Clear(); ProfitAncient.Clear(); ProfitAnnulment.Clear(); ProfitAugmentation.Clear(); ProfitBauble.Clear(); ProfitBinding.Clear(); ProfitBlessed.Clear(); ProfitChance.Clear(); ProfitChisel.Clear(); ProfitChromatic.Clear(); ProfitDivine.Clear(); ProfitEngineers.Clear(); ProfitEx.Clear(); ProfitFusing.Clear(); ProfitGCP.Clear(); ProfitHarbinger.Clear(); ProfitHorizons.Clear(); ProfitJeweller.Clear(); ProfitPerandus.Clear(); ProfitPortal.Clear(); ProfitRegal.Clear(); ProfitRegret.Clear(); ProfitSimple_Sextant.Clear(); ProfitScouring.Clear(); ProfitScrap.Clear(); ProfitSilver.Clear(); ProfitTransmute.Clear(); ProfitVaal.Clear(); ProfitWhetstone.Clear(); ProfitWisdom.Clear(); ProfitPrime_Sextant.Clear(); ProfitAwakened_Sextant.Clear(); ProfitMirror.Clear(); ProfitHunter.Clear(); ProfitWarlord.Clear(); ProfitRedeemer.Clear(); ProfitCrusader.Clear(); //Quantbox QuantBox.Clear(); }
private void SubmitButton_Click(object sender, EventArgs e) { // TODO: Implement regular expressions to handle input // TODO: Ensure that the user enters text string name, type, expDate; int maxID; Food food; // get all values from textboxes name = NameBox.Text; type = TypeBox.Text; expDate = ExpDateBox.Value.ToShortDateString(); Int32.TryParse(QuantBox.Text, out int quantity); // grab max food id maxID = ManagerHome.mainDatabaseReference.Foods.Max(p => p.Food_ID); maxID++; // check for duplicate names if (!HasDupe(name)) { food = new Food(); try { // add food to database food.Food_ID = maxID; food.Food_Name = name; food.Food_Type = type; food.Quantity = quantity; food.Shelf_Number = Int32.Parse(ShelfComboBox.Text); food.Exp_Date = expDate; ManagerHome.mainDatabaseReference.Foods.Add(food); } catch (Exception exc) { ManagerHome.mainDatabaseReference.Foods.Remove(food); MessageBox.Show("Failed to add new food"); } try { ManagerHome.mainDatabaseReference.SaveChanges(); } catch (Exception exc) { MessageBox.Show("Unable to save changes"); } } else { MessageBox.Show("That food is already in the database!"); } // clear all fields NameBox.Clear(); TypeBox.Text = ""; QuantBox.Clear(); ExpDateBox.ResetText(); ShelfComboBox.Text = ""; }