예제 #1
0
        private void AddQuoteButton_Click(object sender, EventArgs e)
        {
            AddQuote addQuote = new AddQuote();

            addQuote.Tag = this;
            addQuote.Show(this);
            this.Hide();
        }
예제 #2
0
        private void getQuote_Click(object sender, EventArgs e)
        {
            bool isValid = true;

            if (CustomerName.Text == "")
            {
                isValid           = false;
                nameError.Visible = true;
            }

            if (DeskDepth.Text != "")
            {
                int depth = int.Parse(DeskDepth.Text);
                if (depth < 12 || depth > 48)
                {
                    depthError.Visible = true;
                    isValid            = false;
                }
            }

            if (DeskDepth.Text == "")
            {
                depthError.Visible = true;
                isValid            = false;
            }

            if (deskWidth.Text != "")
            {
                int width = int.Parse(deskWidth.Text);
                if (width < 24 || width > 96)
                {
                    widthError.Visible = true;
                    isValid            = false;
                }
            }

            if (deskWidth.Text == "")
            {
                widthError.Visible = true;
                isValid            = false;
            }

            if (drawers.SelectedIndex < 0)
            {
                drawerError.Visible = true;
                isValid             = false;
            }

            if (materialBox.SelectedIndex < 0)
            {
                materialError.Visible = true;
                isValid = false;
            }

            if (shipping.SelectedIndex < 0)
            {
                shippingError.Visible = true;
                isValid = false;
            }

            if (isValid)
            {
                //String qName = CustomerName.Text;
                int             qDepth    = int.Parse(DeskDepth.Text);
                int             qWidth    = int.Parse(deskWidth.Text);
                int             qDrawer   = drawers.SelectedIndex;
                DesktopMaterial qMaterial = (DesktopMaterial)materialBox.SelectedIndex;

                String qName     = CustomerName.Text;
                Desk   qDesk     = new Desk(qDepth, qWidth, qDrawer, qMaterial);
                int    qShipping = 0;


                switch (shipping.SelectedIndex)
                {
                case 0:
                    qShipping = 14;
                    break;

                case 1:
                    qShipping = 7;
                    break;

                case 2:
                    qShipping = 5;
                    break;

                case 3:
                    qShipping = 3;
                    break;

                default:
                    break;
                }

                DeskQuote deskQuote = new DeskQuote(qName, qDesk, qShipping);

                AddQuote addQuote = new AddQuote();
                addQuote.Tag = this;
                addQuote.Show(this);
                this.Close();
            }
        }