Ejemplo n.º 1
0
        private void btnAddQuote_Click(object sender, EventArgs e)
        {
            try
            {
                //Get all the variables from the form and add to the DeskQuote object
                DeskQuote newQuote = new DeskQuote();
                newQuote.CustomerName = txtCustName.Text;
                newQuote.Width        = numWidth.Value;
                newQuote.Depth        = numDepth.Value;
                newQuote.NumDrawers   = numDrawers.Value;
                newQuote.MaterialType = (DeskQuote.DesktopMaterial)cmbMaterialType.SelectedItem;
                newQuote.ShippingDays = (DeskQuote.ShippingDay)cmbShipping.SelectedItem;

                //Open the display quote form? Or is this supposed to be saved as a result of viewing the quote?
                var displayQuoteForm = new DisplayQuote(MainMenuTag);
                displayQuoteForm.currQuote = newQuote;
                displayQuoteForm.Tag       = this;

                displayQuoteForm.Show();
                Hide();
            }
            catch (Exception ex)
            {
                //catch to make sure that all the fields are filled in
                Console.WriteLine(ex.Message);
                MessageBox.Show("There was an error displaying the quote. Make sure all fields are correct.", "Error", MessageBoxButtons.OK);
            }
        }
        private void btnSubmitOrder_Click(object sender, EventArgs e)
        {
            //check all fields are filled out (use try catch?)
            if (checkForm())
            {
                //create desk and desk quote objects
                Desk desk = new Desk(deskWidth, deskDepth, drawerNumber, material);
                quote = new DeskQuote(desk, customerName, rushDays);

                //send to and open Display Quote Form, close Add Quote Form
                DisplayQuote displayQuote = new DisplayQuote(quote);
                displayQuote.Tag = this;
                displayQuote.Show(this);
                Hide();
            }
        }