/*
         * Default constructor that initializes all xml and sqlite files.
         */
        public AdminController()
        {
            restaurantMenu       = new List <MenuItem>();
            restaurantCategories = new List <string>();
            XmlSerializer xml = new XmlSerializer(typeof(Items));
            FileStream    fs  = new FileStream("XmlSerialization.xml", FileMode.Open);

            itemList       = new Items();
            itemList       = (Items)xml.Deserialize(fs);
            restaurantMenu = itemList.ItemsList;
            foreach (MenuItem item in restaurantMenu)
            {
                restaurantCategories.Add(item.categoryAtt);
            }
            restaurantCategories = restaurantCategories.Distinct().ToList();
            fs.Close();

            history = new AdminHistory(restaurantMenu);
        }
Exemplo n.º 2
0
 // ----------------------------------------------------------
 // Constructor sets itemRemoved and calls the base class.
 // ----------------------------------------------------------
 public RemoveCommand(List <MenuItem> items, MenuItem item, AdminHistory history) : base(items, history)
 {
     itemRemoved = item;
 }
Exemplo n.º 3
0
 // ----------------------------------------------------------
 // Sets itemAdded and calls the base class
 //  with the list.
 // ----------------------------------------------------------
 public UpdateCommand(List <MenuItem> items, MenuItem item, AdminHistory history) : base(items, history)
 {
     itemAdded = item;
 }
Exemplo n.º 4
0
 public Command(List <MenuItem> items, AdminHistory history)
 {
     this.history = history;
     history.menu = items;
 }