Пример #1
0
        private void btnSaveQuote_Click(object sender, EventArgs e)
        {
            var desk = new Desk();

            desk.Width = numWidth.Value;

            var deskQuote = new DeskQuote();

            //set customername equal to use input
            deskQuote.CustomerName = txtCustomerName.Text;

            deskQuote.QuotePrice = deskQuote.GetQuotePrice();
        }
Пример #2
0
        private void btnSaveQuote_Click(object sender, EventArgs e)
        {
            var desk = new Desk
            {
                Depth           = numDeskDepth.Value,
                Width           = numDeskWidth.Value,
                NumberOfDrawers = (int)numNumberOfDrawers.Value,
                Material        = (Desk.DesktopMaterial)comSurfaceMaterial.SelectedValue
            };

            var deskQuote = new DeskQuote
            {
                Desk         = desk,
                CustomerName = txtCustomerName.Text,
                QuoteDate    = DateTime.Now,
                DeliveryType = (DeskQuote.Delivery)comDelivery.SelectedValue
            };

            try
            {
                // get quote amount
                var price = deskQuote.GetQuotePrice();

                // add amount to quote
                deskQuote.QuotePrice = price;

                // add quote to file
                AddQuoteToFile(deskQuote);

                // show 'DisplayQuote' form
                DisplayQuote frmDisplayQuote = new DisplayQuote(_mainMenu, deskQuote);
                frmDisplayQuote.Show();
                Hide();
            }
            catch (Exception err)
            {
                MessageBox.Show("There was an error creating the quote. {0}", err.InnerException.ToString());
            }
        }
Пример #3
0
        private void btnAddQuote_Click(object sender, EventArgs e)
        {
            // create desk class
            Desk desk = new Desk();

            desk.Width           = (int)this.widthUpDown.Value;
            desk.Depth           = (int)this.depthUpDown.Value;
            desk.NumberOfDrawers = (int)this.drawersUpDown.Value;
            desk.SurfaceMaterial = (DesktopMaterial)this.cmbSurfaceMaterial.SelectedItem;

            // create desk quote class
            DeskQuote deskQuote = new DeskQuote();

            deskQuote.CustomerName = this.txtboxName.Text;
            deskQuote.Desk         = desk;
            deskQuote.QuoteDate    = DateTime.Now;
            deskQuote.Delievery    = (Delivery)this.cmbDelivery.SelectedItem;
            deskQuote.QuotePrice   = deskQuote.GetQuotePrice();

            try
            {
                // add quote to file
                addQuoteToFile(deskQuote);
                //addQuoteToFile(deskQuote);
            }
            catch (Exception err)
            {
                MessageBox.Show("There is an error when you create a quote. {0}",
                                err.InnerException.ToString());
            }

            var displayQuote = new DisplayQuotes();

            displayQuote.Tag = this;
            displayQuote.Show();
            //displayQuote.DisplayQuote(deskQuote);
            this.Hide();
        }