Exemple #1
0
 private void SearchUsers()
 {
     if (textBox1.Text != "")
     {
         lItems = false;
         List <User>        users    = con.GetUsers(textBox1.Text);
         List <UserControl> controls = new List <UserControl>();
         ClearPanel();
         if (users.Count > 0)
         {
             foreach (var u in users)
             {
                 CUser cUser = new CUser();
                 cUser.SetInstance(u);
                 controls.Add(cUser);
                 panel.Controls.Add(cUser);
             }
         }
         else
         {
             var d = new CDefault();
             d.Default = "We didn't find any user with that name.";
             controls.Add(d);
             panel.Controls.Add(d);
         }
         AddToStack(controls);
     }
     textBox1.Text = "";
 }
Exemple #2
0
        public void CreateFriends()
        {
            List <User> users = con.GetFriends();

            ClearPanel();
            if (users.Count > 0)
            {
                friends = new List <UserControl>();
                foreach (var u in users)
                {
                    CUser cUser = new CUser();
                    cUser.SetInstance(u);
                    friends.Add(cUser);
                    panel.Controls.Add(cUser);
                }
                AddToStack(friends);
            }
            else
            {
                List <UserControl> controls = new List <UserControl>();
                var d = new CDefault();
                d.Default = "You don't have friends. Please add some.";
                controls.Add(d);
                panel.Controls.Add(d);
                AddToStack(controls);
            }
        }
Exemple #3
0
        public void UpdateBooks()
        {
            List <UserControl> controls = new List <UserControl>();

            Main.main.ClearPanel();
            if (Main.lUser.Equals(this.GetInstance()))
            {
                List <Book> books = Main.con.GetBooks(Main.lUser);
                if (books.Count > 0)
                {
                    foreach (Book b in books)
                    {
                        CBooks cBooks = new CBooks();
                        cBooks.SetInstance(b);
                        cBooks.SetVisibleEdit();
                        controls.Add(cBooks);
                        Main.panel.Controls.Add(cBooks);
                    }
                }
                else
                {
                    var d = new CDefault();
                    d.Default = "You don't have books.";
                    controls.Add(d);
                    Main.panel.Controls.Add(d);
                }
                Main.main.AddToStack(controls);
            }
            else
            {
                List <Book> books = Main.con.GetBooks(Main.tmpUser);
                if (books.Count > 0)
                {
                    foreach (Book b in books)
                    {
                        if (!b.Private)
                        {
                            CBooks cBooks = new CBooks();
                            cBooks.SetInstance(b);
                            controls.Add(cBooks);
                            Main.panel.Controls.Add(cBooks);
                        }
                    }
                }
                else
                {
                    var d = new CDefault();
                    d.Default = "This user don't have books.";
                    controls.Add(d);
                    Main.panel.Controls.Add(d);
                }
                Main.main.AddToStack(controls);
            }
        }
Exemple #4
0
        public void UpdateSeries()
        {
            List <UserControl> controls = new List <UserControl>();

            Main.main.ClearPanel();
            if (Main.lUser.Equals(this.GetInstance()))
            {
                List <Series> series = Main.con.GetSeries(Main.lUser);
                if (series.Count > 0)
                {
                    foreach (Series s in series)
                    {
                        CSeries cSeries = new CSeries();
                        cSeries.SetInstance(s);
                        cSeries.SetVisibleEdit();
                        controls.Add(cSeries);
                        Main.panel.Controls.Add(cSeries);
                    }
                }
                else
                {
                    var d = new CDefault();
                    d.Default = "You don't have series.";
                    controls.Add(d);
                    Main.panel.Controls.Add(d);
                }
            }
            else
            {
                List <Series> series = Main.con.GetSeries(Main.tmpUser);
                if (series.Count > 0)
                {
                    foreach (Series s in series)
                    {
                        if (!s.Private)
                        {
                            CSeries cSeries = new CSeries();
                            cSeries.SetInstance(s);
                            controls.Add(cSeries);
                            Main.panel.Controls.Add(cSeries);
                        }
                    }
                }
                else
                {
                    var d = new CDefault();
                    d.Default = "This user don't have series.";
                    controls.Add(d);
                    Main.panel.Controls.Add(d);
                }
            }
            Main.main.AddToStack(controls);
        }
Exemple #5
0
        public void UpdateMovies()
        {
            List <UserControl> controls = new List <UserControl>();

            Main.main.ClearPanel();
            if (Main.lUser.Equals(this.GetInstance()))
            {
                List <Movie> movies = Main.con.GetMovies(Main.lUser);
                if (movies.Count > 0)
                {
                    foreach (Movie m in movies)
                    {
                        CMovie cMovie = new CMovie();
                        cMovie.SetInstance(m);
                        cMovie.SetVisibleEdit();
                        controls.Add(cMovie);
                        Main.panel.Controls.Add(cMovie);
                    }
                }
                else
                {
                    var d = new CDefault();
                    d.Default = "You don't have movies.";
                    controls.Add(d);
                    Main.panel.Controls.Add(d);
                }
            }
            else
            {
                List <Movie> movies = Main.con.GetMovies(Main.tmpUser);
                if (movies.Count > 0)
                {
                    foreach (Movie m in movies)
                    {
                        if (!m.Private)
                        {
                            CMovie cMovie = new CMovie();
                            cMovie.SetInstance(m);
                            controls.Add(cMovie);
                            Main.panel.Controls.Add(cMovie);
                        }
                    }
                }
                else
                {
                    var d = new CDefault();
                    d.Default = "This user don't have movies.";
                    controls.Add(d);
                    Main.panel.Controls.Add(d);
                }
            }
            Main.main.AddToStack(controls);
        }