private void ViewQuotes_Click(object sender, EventArgs e) { DisplayQuote displayQuoteForm = new DisplayQuote(); displayQuoteForm.Tag = this; displayQuoteForm.Show(this); Hide(); }
private void AddDeskButton_Click(object sender, EventArgs e) { //MaterialString = surfaceMaterialCB.SelectedItem.ToString(); //Material materialValue = (Material)Enum.Parse(typeof(Material), MaterialString); //Input try { CustomerName = customerNameTB.Text; DeskWidth = int.Parse(deskWidthTB.Text); DeskDepth = int.Parse(deskDepthTB.Text); Drawers = int.Parse(drawerNumCB.SelectedItem.ToString()); string MaterialString = surfaceMaterialCB.SelectedItem.ToString(); Enum.TryParse(MaterialString, out Material); //MaterialString = surfaceMaterialCB.SelectedItem.ToString(); //Material materialValue = (Material)Enum.Parse(typeof(Material), MaterialString); //get rush order selection if (rushThreeRadio.Checked) { RushOrderDays = 3; } else if (rushFiveRadio.Checked) { RushOrderDays = 5; } else if (rushSevenRadio.Checked) { RushOrderDays = 7; } //Create new DeskQuote object and calculate total DeskQuote NewQuote = new DeskQuote(DeskWidth, DeskDepth, Drawers, Material, RushOrderDays); DeskQuoteTotal = NewQuote.CalculateQuoteTotal(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Check input methods."); throw; } try { //build output string csv var DeskRecord = CustomerName + ", " + DateTime.Now + ", " + DeskWidth + ", " + DeskDepth + ", " + Drawers + ", " + Material + ", " + RushOrderDays + ", " + DeskQuoteTotal; string cFile = @"quotes.txt"; if (!File.Exists(cFile)) { StreamWriter sw = File.CreateText("quotes.txt"); } using (StreamWriter sw = File.AppendText("quotes.txt")) { sw.WriteLine(DeskRecord); } } catch { MessageBox.Show("Did not save."); } #region Display To Screen // Show confirmation page on new screen named DeskQuoteView var MainMenu = (MainMenu)Tag; // need to bring along a reference tag to the main menu form DisplayQuote newOrderView = new DisplayQuote(CustomerName, DateTime.Now.Date, DeskWidth, DeskDepth, Drawers, Material, RushOrderDays, DeskQuoteTotal) { Tag = MainMenu }; newOrderView.Show(); this.Close(); #endregion }