Exemplo n.º 1
0
 // constructor
 public Desk(int deskWidth, int deskDepth, int drawerNumber, DesktopMaterials material)
 {
     this.deskWidth    = deskWidth;
     this.deskDepth    = deskDepth;
     this.drawerNumber = drawerNumber;
     this.material     = material;
 }
Exemplo n.º 2
0
 public Desk(decimal width       = 24,
             decimal depth       = 12,
             int numberOfDrawers = 0,
             DesktopMaterials desktopMaterial = DesktopMaterials.Pine)
 {
     _width           = width;
     _depth           = depth;
     _numberOfDrawers = numberOfDrawers;
     _desktopMaterial = desktopMaterial;
 }
        private bool checkForm()
        {
            try
            {
                // verify all fields are filled out
                if (String.IsNullOrEmpty(inputCustomerName.Text) ||
                    String.IsNullOrEmpty(inputDeskWidth.Text) ||
                    String.IsNullOrEmpty(inputDeskDepth.Text) ||
                    String.IsNullOrEmpty(inputDrawerNumber.Text))
                {
                    throw(new Exception());
                }
                else
                {
                    // set variables and return true
                    customerName = inputCustomerName.Text;
                    deskWidth    = int.Parse(inputDeskWidth.Text);
                    deskDepth    = int.Parse(inputDeskDepth.Text);
                    drawerNumber = int.Parse(inputDrawerNumber.Text);

                    // convert to DesktopMaterial
                    switch (inputMaterialType.Text)
                    {
                    case "laminate":
                        material = DesktopMaterials.laminate;
                        break;

                    case "oak":
                        material = DesktopMaterials.oak;
                        break;

                    case "rosewood":
                        material = DesktopMaterials.rosewood;
                        break;

                    case "veneer":
                        material = DesktopMaterials.veneer;
                        break;

                    case "pine":
                        material = DesktopMaterials.pine;
                        break;
                    }

                    // convert to int
                    switch (inputRushOrder.Text)
                    {
                    case "Regular":
                        rushDays = 14;
                        break;

                    case "7 Day":
                        rushDays = 7;
                        break;

                    case "5 Day":
                        rushDays = 5;
                        break;

                    case "3 Day":
                        rushDays = 3;
                        break;
                    }

                    return(true);
                }
            }
            catch (Exception)
            {
                // send user message about incomplete form, return false
                MessageBox.Show("INCOMPLETE: Please fill out all fields before submitting.");
                return(false);
            }
        }
Exemplo n.º 4
0
        public DeskQuote(string theCustomer, DateTime quoteDate, double Width, double Depth, int drawers, DesktopMaterials surfaceMaterials, int rushOrderDays)
        {
            customerName          = theCustomer;
            QuoteDate             = quoteDate;
            Desk.Width            = Width;
            Desk.Depth            = Depth;
            Desk.NumberDrawer     = drawers;
            Desk.DesktopMaterials = surfaceMaterials;
            RushOrderDays         = rushOrderDays;

            Desk.DeskArea = Desk.Width * Desk.Depth;
        }