예제 #1
0
 public override int GetHashCode() => BreadType.GetHashCode() ^
 CheeseType.GetHashCode() ^
 HasMayo.GetHashCode() ^
 HasMustard.GetHashCode() ^
 IsToasted.GetHashCode() ^
 MeatType.GetHashCode() ^
 Vegetables.GetHashCode();
예제 #2
0
        public Bread(BreadType type)
        {
            switch (type)
            {
            case BreadType.Beyaz:
                this.Price = 1.0;
                this.Gram  = Gramaj.Yuz;
                break;

            case BreadType.Kepek:
                this.Price = 1.0;
                this.Gram  = Gramaj.Yuz;
                break;

            case BreadType.Bugday:
                this.Price = 1.0;
                this.Gram  = Gramaj.Yuz;
                break;

            case BreadType.Odun:
                this.Price = 2.0;
                this.Gram  = Gramaj.IkiYuz;
                break;

            case BreadType.AltinEkmek:
                this.Price = 1.5;
                this.Gram  = Gramaj.YuzYirmiBes;
                break;

            default:
                break;
            }
        }
        ///
        /// This methods adds a new sandwich. The name of the sandwich must be unique.
        /// When this is not the case, the method should return false and the sandwich
        /// will not be added. Otherwhises, the method return true and the sandwich is
        /// added to the list of sandwiches.
        ///
        private void btAddBread_Click(object sender, EventArgs e)
        {
            try
            {
                string name;
                if (string.IsNullOrWhiteSpace(removeWhiteSpaces(name = this.tbName.Text.ToString())))
                {
                    MessageBox.Show("Change the Name field");
                }
                else
                {
                    if (this.cbBreadTypes.SelectedIndex > -1)
                    {
                        BreadType breadType = (BreadType)this.cbBreadTypes.SelectedItem;
                        Bread     bread     = new Bread("description", breadType, 2.00);

                        this.sandwich = new Sandwich(name, bread);
                        MessageBox.Show("You successfully added a sandwitch!");
                    }
                    else
                    {
                        MessageBox.Show("Please, select from the combobox!");
                    }
                }
            }
            catch (Exception)
            {
                System.Console.WriteLine("Input sandwitch");
                throw;
            }
        }
예제 #4
0
 public void PrepareRecipe(BreadType breadType, CheeseType cheeseType)
 {
     _sandwichRecipe.ChooseBread(breadType);
     _sandwichRecipe.AddProtein();
     _sandwichRecipe.AddCheese(cheeseType);
     _sandwichRecipe.AddVegetables();
     _sandwichRecipe.AddSauces();
 }
예제 #5
0
 public Sandwich(BreadType bread, CheeseType cheese, bool hasMayo, bool istoasted, bool HasMustard, List <string> vegetables)
 {
     this.Bread      = bread;
     this.Cheese     = cheese;
     this.HasMayo    = hasMayo;
     this.IsToasted  = IsToasted;
     this.HasMustard = HasMustard;
     this.Vegetables = vegetables;
 }
예제 #6
0
 public Sandwich(BreadType bread, CheeseType cheese, bool hasMayo, bool istoasted, bool HasMustard, List<string> vegetables)
 {
     this.Bread = bread;
     this.Cheese = cheese;
     this.HasMayo = hasMayo;
     this.IsToasted = IsToasted;
     this.HasMustard = HasMustard;
     this.Vegetables = vegetables;
 }
예제 #7
0
 public Sandwich(BreadType breadType, bool isToasted, CheeseType cheeseType, MeatType meatType, bool hasMustard, bool hasMayo, List <string> vegetables)
 {
     BreadType  = breadType;
     IsToasted  = isToasted;
     CheeseType = cheeseType;
     MeatType   = meatType;
     HasMustard = hasMustard;
     HasMayo    = hasMayo;
     Vegetables = vegetables;
 }
예제 #8
0
 public Sandwich1(BreadType breadType, bool isToasted, CheesType cheesType, MeatType meatType, bool hasMustard, bool hasMayo, List <string> vegetables)
 {
     this.breadType  = breadType;
     this.isToasted  = isToasted;
     this.cheesType  = cheesType;
     this.meatType   = meatType;
     this.hasMustard = hasMustard;
     this.hasMayo    = hasMayo;
     this.vegetables = vegetables;
 }
예제 #9
0
 public Sandwich(BreadType breadType, bool isToasted, CheeseType cheeseType, MeatType meatType, bool hasMustard,
                 bool hasMayo, List <string> vegetables)
 {
     _breadType  = breadType;
     _isToasted  = isToasted;
     _cheeseType = cheeseType;
     _meatType   = meatType;
     _hasMustard = hasMustard;
     _hasMayo    = hasMayo;
     _vegetables = vegetables;
 }
예제 #10
0
 public Sandwich_Original(BreadType breadType, bool isToasted, CheeseType cheeseType,
                          MeatType meatType, bool hasMustard, bool hasMayo, List <string> vegetables)
 {
     _BreadType  = breadType;
     _IsToasted  = isToasted;
     _CheeseType = cheeseType;
     _MeatType   = meatType;
     _HasMustard = hasMustard;
     _HasMayo    = hasMayo;
     _Vegetables = vegetables;
 }
예제 #11
0
        public Bread(
            int id,
            double price,
            BreadType type)
        {
            switch (type)
            {
            case BreadType.White:
                Price  = 1.0;
                Weight = Weight.Hundred;
                break;

            case BreadType.Wheat:
                Price  = 2.0;
                Weight = Weight.OneHundredTwentyFive;
                break;

            case BreadType.WholeGrain:
                Price  = 3.0;
                Weight = Weight.TwoHundred;
                break;
            }
        }
예제 #12
0
        public static BreadMaker MakeBread(BreadType breadType)
        {
            BreadMaker breadMaker = null;

            switch (breadType)
            {
            case BreadType.BlackBread:
                breadMaker = new BlackBread();
                break;

            case BreadType.HoneyBread:
                breadMaker = new HoneyBread();
                break;

            case BreadType.WhiteBread:
                breadMaker = new WhiteBread();
                break;

            case BreadType.HoneyWhiteBread:
                breadMaker = new HoneyWhiteBread();
                break;
            }
            return(breadMaker);
        }
예제 #13
0
 public SandwichRecipeBuilder InBread(BreadType breadType)
 {
     _sandwich.Bread = breadType;
     return(this);
 }
예제 #14
0
 //smell - possibility of more than one constructor to deal with different possibilities
 //But hard to know which constructor
 public Sandwich(BreadType breadType, bool isToasted, CheeseType cheeseType)
 {
     BreadType  = breadType;
     IsToasted  = isToasted;
     CheeseType = cheeseType;
 }
예제 #15
0
 public void setBreadType(BreadType breadType)
 {
     this.breadType = breadType;
 }
예제 #16
0
 public abstract void ChooseBread(BreadType breadType);
예제 #17
0
 public override void ChooseBread(BreadType breadType)
 {
     _sandwichRecipe.Bread = breadType;
 }
예제 #18
0
 public Bread(string name, decimal price, string dealer, Stamp stamp, BreadType breadType = BreadType.White)
     : base(name, price, dealer, stamp)
 {
     this.BreadType = breadType;
 }
예제 #19
0
 public HamburgerBuilder AddBread(BreadType type)
 {
     return(this);
 }