Example #1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string usName = textBox1.Text;

            Library.User us       = new Library.User(usName);
            string       bkName   = textBox2.Text;
            string       bkAuthor = textBox3.Text;
            string       bkTheme  = textBox4.Text;

            Library.Book bk = new Library.Book(bkName, bkAuthor, bkTheme, true);
            if (Lib.users.Contains(us) && Lib.books.ContainsKey(bk) && bk.inLib)
            {
                us.myBooks.Add(bk);
                Lib.books.Remove(bk);
                Lib.books.Add(bk, false);
                Hide();
                MessageBox.Show("Book have been succesfully returned");
            }
            else if (!Lib.users.Contains(us))
            {
                label4.Visible = true;
            }
            else if (!Lib.books.ContainsKey(bk))
            {
                label3.Visible = true;
            }
        }
Example #2
0
        private void Button5_Click(object sender, EventArgs e)
        {
            string name = textBox1.Text;
            string ath  = textBox2.Text;
            string th   = textBox4.Text;

            Library.Book bk = new Library.Book(name, ath, th, true);
            bk.inLib = true;
            if (!lib.themes.Contains(th))
            {
                lib.themes.Add(th);
            }
            if (!lib.authors.Contains(ath))
            {
                lib.authors.Add(ath);
            }
            if (!lib.books.ContainsKey(bk))
            {
                lib.books.Add(bk, true);
            }
        }