Ejemplo n.º 1
0
        private void AddNewDish()
        {
            Console.WriteLine("More food!\nWhat is type of your dish");
            Page add_dish = new Page();

            add_dish.Add("It's dish only for me", () => Group.Create_personal_dish());
            add_dish.Add("it's dish for all", () => Group.Create_communal_dish());
            add_dish.Display();
        }
Ejemplo n.º 2
0
        private Page Create_welcome_Page()
        {
            Page welcome = new Page();

            welcome.Add("New day, new group", () => CreateGroup());
            welcome.Add("Find my group", () => FindGroup());
            welcome.Add("Delete group", () => DeleteGroup());
            welcome.Add("Delete all gruops", () => DeleteAll());
            welcome.Add("Exit", () => exit = true);
            return(welcome);
        }
Ejemplo n.º 3
0
        public void FindGroup()
        {
            Group check;

            using (var db = new LiteDatabase(@"MyData.db"))
            {
                var col = db.GetCollection <Group>("group");
                check = col.FindOne(Query.All());
            }
            if (check == null)
            {
                Console.WriteLine("Hmmm.. . My memory's not what it was earlier. I can't remember some group\n(Create some group befor finding)\n");
                CreateGroup();
            }
            else
            {
                using (var db = new LiteDatabase(@"MyData.db"))
                {
                    Page findPage = new Page();
                    var  col      = db.GetCollection <Group>("group");
                    var  groupAll = col.FindAll();

                    foreach (Group g in groupAll)
                    {
                        findPage.Add(g.Name, () => SetCurrent(db, g));
                    }
                    findPage.Display();
                }
            }
        }
Ejemplo n.º 4
0
 public void Create_personal_dish()
 {
     Console.WriteLine("Choose friend:\n");
     Menu.Page personalDish = new Menu.Page();
     foreach (Friend f in Friends)
     {
         personalDish.Add(f.Name, () => f.Add_dish(ComposeDish(false)));
     }
     personalDish.Display();
 }
Ejemplo n.º 5
0
        private void DeleteFriend()
        {
            Page deleteFriend = new Page();

            foreach (Friend f in Group.Friends)
            {
                deleteFriend.Add(f.Name, () => group.DeleteFriend(f));
            }
            deleteFriend.Display();
            //Сохраняем изменения в базу данных
            UpdateGroup();
        }
Ejemplo n.º 6
0
 private void DeleteGroup()
 {
     using (var db = new LiteDatabase(@"MyData.db"))
     {
         Page deletePage = new Page();
         var  col        = db.GetCollection <Group>("group");
         var  groupAll   = col.FindAll();
         foreach (Group g in groupAll)
         {
             deletePage.Add(g.Name, () => Delete(g, db));
         }
         deletePage.Display();
     }
 }