示例#1
0
        public MenuDecorator PrepareBurger(Burger burger, Drink drink, MenuSize menuSize)
        {
            try
            {
                Menu menu = new Menu();
                menu.AddItem(burger);
                menu.AddItem(drink);

                switch (menuSize)
                {
                case MenuSize.SMALL:
                default:
                    return(new SmallDecorator(menu));

                case MenuSize.NORMAL:
                    return(new NormalDecorator(menu));

                case MenuSize.BIG:
                    return(new BigDecorator(menu));
                }
            }
            catch (Exception e)
            {
                LoggerSingleton.Logger.LogError(e);
                return(null);
            }
        }
        public static string ToText(this MenuSize size)
        {
            if (size.IsNullOrDefault())
            {
                return("size-110");
            }

            switch (size)
            {
            case MenuSize.Size100:
                return("size-100");

            case MenuSize.Size110:
                return("size-110");

            case MenuSize.Size125:
                return("size-125");

            case MenuSize.Size150:
                return("size-150");

            case MenuSize.Size175:
                return("size-175");

            case MenuSize.Size200:
                return("size-200");
            }

            return("size-110");
        }
示例#3
0
        public async Task <MenuSize> Add(MenuSize model)
        {
            var entity = _menuSizeRepository.Add(model);
            await _menuSizeRepository.SaveChangeAsync();

            return(model);
        }
示例#4
0
        public async Task <bool> Put(MenuSize model)
        {
            var result = false;

            if (ModelState.IsValid)
            {
                result = await _menuSizeBusiness.Update(model);
            }
            return(result);
        }
示例#5
0
        public async Task <int> Post(MenuSize model)
        {
            var result = 0;

            if (ModelState.IsValid)
            {
                model.Status = 1;
                var modelInsert = await _menuSizeBusiness.Add(model);

                result = modelInsert.Id;
            }
            return(result);
        }
示例#6
0
 public Menu(
     string title          = "MenuV",
     string subtitle       = "",
     MenuPosition position = MenuPosition.TopLeft,
     int red           = 0,
     int green         = 0,
     int blue          = 255,
     MenuSize size     = MenuSize.Size110,
     string texture    = "default",
     string dictionary = "menuv")
     : this(title, subtitle, position, Color.FromArgb(red, green, blue), size, texture, dictionary)
 {
 }
        private void AddToOrder_Click(object sender, RoutedEventArgs e)
        {
            DrinkType  drinkType  = (DrinkType)Convert.ToInt32(SelectedDrinkType.SelectedValue);
            BurgerType burgerType = (BurgerType)Convert.ToInt32(SelectedBurgerType.SelectedValue);
            MenuSize   menuSize   = (MenuSize)Convert.ToInt32(SelectedMenuSize.SelectedValue);

            IMenuFactory menuFactory = new MenuFactory();

            var menu = builder.PrepareBurger(menuFactory.GetBurger(burgerType), menuFactory.GetDrink(drinkType), menuSize);

            currentOrder.AddMenu(menu);

            ReinitOrderSource();
        }
示例#8
0
        public async Task <bool> Update(MenuSize model)
        {
            var result = false;
            var record = await _menuSizeRepository.Repo.FirstOrDefaultAsync(c => c.Id == model.Id);

            if (record != null)
            {
                record.Name = model.Name;

                await _menuSizeRepository.SaveChangeAsync();

                result = true;
            }
            return(result);
        }
示例#9
0
 public Menu(
     string title          = "MenuV",
     string subtitle       = "",
     MenuPosition position = MenuPosition.TopLeft,
     Color color           = new Color(),
     MenuSize size         = MenuSize.Size110,
     string texture        = "default",
     string dictionary     = "menuv")
 {
     this.IsOpen     = false;
     this.UUID       = Guid.NewGuid();
     this.Title      = title;
     this.Subtitle   = subtitle;
     this.Position   = position;
     this.Color      = color.IsNullOrDefault() ? Color.FromArgb(0, 0, 255) : color;
     this.Size       = size;
     this.Texture    = string.IsNullOrWhiteSpace(texture) ? "default" : texture;
     this.Dictionary = string.IsNullOrWhiteSpace(dictionary) ? "menuv" : dictionary;
 }
示例#10
0
        public static IMenu CreateMenu(
            string title          = "MenuV",
            string subtitle       = "",
            MenuPosition position = MenuPosition.TopLeft,
            int red           = 0,
            int green         = 0,
            int blue          = 255,
            MenuSize size     = MenuSize.Size110,
            string texture    = "default",
            string dictionary = "menuv")
        {
            var menu = new Menu(title, subtitle, position, red, green, blue, size, texture, dictionary);

            if (Main.Menus.ContainsKey(menu.UUID))
            {
                Main.Menus[menu.UUID] = menu;
            }
            else
            {
                Main.Menus.Add(menu.UUID, menu);
            }

            return(menu);
        }