Ejemplo n.º 1
0
        private void displayQuoteForm_Click(object sender, EventArgs e)
        {
            try
            {
                quote.FirstName   = firstNameField.Text;
                quote.LastName    = lastNameField.Text;
                desk.Width        = (int)selectWidthField.Value;
                desk.Depth        = (int)selectDepthField.Value;
                desk.DrawerNum    = (int)selectDrawersField.Value;
                desk.MaterialType = deskMaterialField.SelectedItem.ToString();
                rush = RushOrderField.SelectedItem.ToString();
            }
            catch (Exception exc)
            {
                MessageBox.Show("Your input wasn't just right.");
            }
            deskArea        = quote.buildDesk(desk.Width, desk.Depth);
            quote.TotalCost = quote.calcCost(deskArea, desk.DrawerNum, desk.MaterialType);

            if (rush != "no rush")
            {
                if (rush == "3 Days")
                {
                    quote.RushCost = quote.calcRush(deskArea, 3);
                }
                else if (rush == "5 Days")
                {
                    quote.RushCost = quote.calcRush(deskArea, 5);
                }
                else // 7 days
                {
                    quote.RushCost = quote.calcRush(deskArea, 7);
                }
                quote.TotalCost += quote.RushCost;
            }

            quote.saveQuote();

            if (displayQuoteView == null)
            {
                displayQuoteView = new DisplayQuote();
            }
            Hide();
            displayQuoteView.Show();
        }