コード例 #1
0
        /// <summary>
        /// Calculates all the inputs and set the class properties
        /// to be displayed in the DisplayQuote.
        /// </summary>
        public void CalculateQuote()
        {
            // Gettomg the Desk and DeskQuote properties
            Desk      desk      = new Desk();
            DeskQuote deskQuote = new DeskQuote();

            // Getting the values from NumericUpDown control and ComboBox
            int drawers = (int)deskDrawers.Value;

            int material = (int)cmbMat.SelectedValue;

            int rushDays = (int)cmbRushDays.SelectedValue;

            //Setting the Customer property
            deskQuote.CustomerName = txtName.Text;

            Customer = deskQuote.CustomerName;

            // Making all the calculations and setting other properties
            desk.CalcArea((int)deskWidth.Value, (int)deskDepth.Value);

            DeskWidth = desk.DeskWidth;

            DeskDepth = desk.DeskDepth;

            AreaCost = deskQuote.CalcAreaCost(desk.DeskArea);

            DrawerCost = deskQuote.CalcDrawerCost(drawers);

            DeskDrawer = desk.DeskDrawer;

            MaterialCost = deskQuote.CalcSufCost(material);

            MaterialType = deskQuote.MaterialTypeDef(material);

            RushDaysCost = deskQuote.CalcAdditionalCost(rushDays, desk.DeskArea);

            Total = deskQuote.CalcDeskQuote(deskQuote.AreaCost, deskQuote.SufMatCost, deskQuote.DrawerCost, deskQuote.AdditionalCost);

            // Estamite the delivery date
            deskQuote.CurrentDate = DateTime.Now;

            deskQuote.EstimateShip = deskQuote.CurrentDate.AddDays(rushDays);

            deskQuote.DisplayDate = deskQuote.EstimateShip.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("en-US"));

            Estimated = deskQuote.DisplayDate;
        }