Example #1
0
 public void UpdateCostAndPrintError(DecoratorClass decorations, String Addons)
 {
     if (decorations != null)
     {
         decorations.Initial_car_cost();
         if (!decorations.Error.Equals(""))
         {
             MessageBox.Show(decorations.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             decorations.Error = "";
         }
         else
         {
             complete_info = complete_info + Addons + " ";
             textBox1.Text = car.Cost.ToString();
         }
     }
 }
Example #2
0
        public void ComputeCost(String Addons)
        {
            DecoratorClass decorations = null;

            if (Addons == "V-8 Engine")
            {
                decorations = new V8Engine(car);
            }
            else if (Addons == "V-12 Engine")
            {
                decorations = new V12Engine(car);
            }
            else if (Addons == "Sun Roof")
            {
                decorations = new SunRoof(car);
            }
            else if (Addons == "Towing Package")
            {
                decorations = new TowingPackage(car);
            }
            else if (Addons == "OverSized Gas Tank")
            {
                decorations = new OverSizedGasTank(car);
            }
            else if (Addons == "Puma Skin Seats")
            {
                decorations = new PumaSkinSeats(car);
            }
            else if (Addons == "Seal Skin Seats")
            {
                decorations = new SealSkinSeats(car);
            }
            else if (Addons == "Komodo Dragon Skin Seats")
            {
                decorations = new komodoDragonSkinSeats(car);
            }
            else if (Addons == "32 oz Cup Holders")
            {
                decorations = new CupHolder(car);
            }
            else if (Addons == "Blaupunkt New York 800 Radio")
            {
                decorations = new Radio(car);
            }

            else if (Addons == "Spare Tire")
            {
                decorations = new SpareTire(car);
            }
            else if (Addons == "Free First Oil Change")
            {
                decorations = new FirstFreeOilChange(car);
            }
            if (decorations != null)
            {
                decorations.Initial_car_cost();
                if (!decorations.Error.Equals(""))
                {
                    MessageBox.Show(decorations.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    decorations.Error = "";
                }
                else
                {
                    complete_info = complete_info + "\n" + Addons + " ";
                    textBox1.Text = car.Cost.ToString();
                }
            }
        }