Пример #1
0
        private void requestQuote_Click(object sender, EventArgs e)
        {
            DisplayQuote DisplayNewQuoteForm = new DisplayQuote();

            DisplayNewQuoteForm.Tag = this;
            DisplayNewQuoteForm.Show(this);
            Hide();
        }
Пример #2
0
        private void requestQuote_Click(object sender, EventArgs e)
        {
            var desk = new Desk
            {
                Depth   = (decimal)depth.Value,
                Width   = (decimal)width.Value,
                Drawers = (int)drawers.Value
            };

            //This will need to change to a combo box
            //SurfaceMaterial = desktopMaterialComboBox.Value
            switch (desktopMaterialComboBox.Text.ToLower())
            {
            case "laminate":
                desk.SurfaceMaterial = Desk.SurfaceMaterials.Laminate;
                break;

            case "oak":
                desk.SurfaceMaterial = Desk.SurfaceMaterials.Oak;
                break;

            case "pine":
                desk.SurfaceMaterial = Desk.SurfaceMaterials.Pine;
                break;

            case "rosewood":
                desk.SurfaceMaterial = Desk.SurfaceMaterials.Rosewood;
                break;

            case "veneer":
                desk.SurfaceMaterial = Desk.SurfaceMaterials.Veneer;
                break;
            }

            var deskQuote = new DeskQuote();


            deskQuote.CustomerName = customerName.Text;
            deskQuote.Desk         = desk;
            deskQuote.CurrentDate  = DateTime.Now;
            deskQuote.SurfaceArea  = deskQuote.GetSurfaceArea();
            //Get cost of Material
            //Get cost of delivery
            deskQuote.FinalQuote = deskQuote.GetFinalQuote();


            switch (rushOrderComboBox.Text.ToLower())
            {
            case "rush_3_day":
                deskQuote.RushOrder = DeskQuote.Delivery.rush_3_day;
                break;

            case "rush_5_day":
                deskQuote.RushOrder = DeskQuote.Delivery.rush_5_day;
                break;

            case "rush_7_day":
                deskQuote.RushOrder = DeskQuote.Delivery.rush_7_day;
                break;

            case "no_rush":
                deskQuote.RushOrder = DeskQuote.Delivery.no_rush;
                break;
            }

            try
            {
                //Get the quote Amount
                deskQuote.FinalQuote = deskQuote.GetFinalQuote();

                //Write it to the file
                AddQuoteToFile(deskQuote);
                //Send infor to the display quote form

                /* THIS WAS FROM BROTHER THAYNE
                 * DisplayQuote frmNewQuote = new DisplayQuote(deskQuote);
                 * frmNewQuote.Show();
                 * Hide();*/

                DisplayQuote DisplayNewQuoteForm = new DisplayQuote(deskQuote);
                DisplayNewQuoteForm.Tag = this;
                DisplayNewQuoteForm.Show(this);
                Hide();
            }
            catch (Exception)
            {
                MessageBox.Show("An error has occured");
            }


            //private void createTxt()
            // {
            //StreamWriter writer;
            //writer = new StreamWriter("test.txt");

            //}
        }