Exemple #1
0
 private void submitButton_Click(object sender, EventArgs e)
 {
     try
     {
         width           = Convert.ToDouble(widthInput.Text);
         depth           = Convert.ToDouble(depthInput.Text);
         numDrawers      = Convert.ToInt32(drawersInput.Value);
         rushDays        = Convert.ToInt32(rushDaysInput.Value);
         surfaceMaterial = surfaceMaterialInput.Text;
         firstName       = firstNameInput.Text;
         lastName        = lastNameInput.Text;
         desk.SetDepth(depth);
         desk.SetNumDrawers(numDrawers);
         desk.SetWidth(width);
         desk.SetSurfaceMaterial(surfaceMaterial);
         deskQuote.SetDesk(desk);
         deskQuote.SetRushOrderDays(rushDays);
         deskQuote.SetCustomerFirstName(firstName);
         deskQuote.SetCustomerLastName(lastName);
         if (deskQuote.CheckValidInputs() == true)
         {
             double totalPrice = deskQuote.GetTotalPrice();
             data = deskQuote.QuoteToString();
             DatabaseHandler.StoreJsonQuote(deskQuote);
             DisplayQuote displayQuote = new DisplayQuote(
                 width,
                 depth,
                 numDrawers,
                 rushDays,
                 surfaceMaterial,
                 firstName,
                 lastName
                 );
             displayQuote.Show();
             this.Hide();
         }
         else
         {
             errorLabel.Text = "Error with your dimensions. Please see key. Thank you.";
         }
     }
     catch (IOException er)
     {
         errorLabel.Text = "Error with submission" + er.Message;
     }
     catch (FormatException fr)
     {
         errorLabel.Text = "Error with submission" + fr.Message;
     }
 }