public DisplayQuote(DeskQuote deskQuote) { InitializeComponent(); _deskQuote = deskQuote; txtCustomerName.Text = _deskQuote.CustomerName; numUpDownDrawers.Value = _deskQuote.getDesk.numOfDrawers; widthNumericUpDown.Value = _deskQuote.getDesk.width; depthNumericUpDown.Value = _deskQuote.getDesk.depth; cmbDesktopMaterial.Text = _deskQuote.getDesk.DesktopMaterial.ToString(); cmbRush.Text = _deskQuote.rushOrder; lblShowTotalCost.Text = _deskQuote.price.ToString(); }
private void btnGetQuote_Click(object sender, EventArgs e) { // Check form completness if (txtCustomerName.Text == "" || cmbRush.Text == "") { MessageBox.Show("Please fill out all the values", "Form Incomplete", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Desk megaDesk = new Desk(); megaDesk.width = widthNumericUpDown.Value; megaDesk.depth = depthNumericUpDown.Value; megaDesk.numOfDrawers = (int)numUpDownDrawers.Value; megaDesk.DesktopMaterial = (Desk.Desktop)cmbDesktopMaterial.SelectedValue; DeskQuote megaDeskQuote = new DeskQuote(); DateTime today = DateTime.Now; megaDeskQuote.todaysDate = today; megaDeskQuote.CustomerName = txtCustomerName.Text; megaDeskQuote.rushOrder = cmbRush.Text; megaDeskQuote.getDesk = megaDesk; megaDeskQuote.price = megaDeskQuote.GetQuote(); AddQuoteToJson(megaDeskQuote); // Take the json file and convert it to a list // add new quotes that are being created to the list // Convert the list into a json file try { //Show Display Quote DisplayQuote DisplayQuote = new DisplayQuote(megaDeskQuote); DisplayQuote.Show(); Hide(); } catch (Exception err) { MessageBox.Show("There was an error creating the quote. {0}", err.Message); } }