Esempio n. 1
0
 public Books()
 {
     InitializeComponent();
     db = new db_lab4Entities();
     listGenre = new List<Genre>();
     listAuthor = new List<Author>();
 }
Esempio n. 2
0
 private void Search_Load(object sender, EventArgs e)
 {
     using (db_lab4Entities db = new db_lab4Entities())
     {
         foreach (User user in db.Users)
         {
             bool flag = false;
             foreach (User u in listUser)
             {
                 if (u.firstname.Equals(user.firstname))
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 comboBox1.Items.Add(user.firstname);
                 listUser.Add(user);
             }
           
         }
         
     }
 }
Esempio n. 3
0
 private void AddUser_Load(object sender, EventArgs e)
 {
     using (db_lab4Entities db = new db_lab4Entities())
     {
         foreach (Book book in db.Books)
         {
             comboBox1.Items.Add(book.name);
             listBook.Add(book);
         }
     }
 }
Esempio n. 4
0
 private void AddBooks_Load(object sender, EventArgs e)
 {
     using (db_lab4Entities db = new db_lab4Entities())
     {
         foreach (Genre genre in db.Genres)
         {
             comboBox1.Items.Add(genre.genre1);
             listGenre.Add(genre);
         }
         foreach (Author author in db.Authors)
         {
             comboBox2.Items.Add(author.firstname);
             listAuthor.Add(author);
         }
     }
 }
Esempio n. 5
0
 private void button1_Click(object sender, EventArgs e)
 {
     listBox1.Items.Clear();
     using (db_lab4Entities db = new db_lab4Entities())
     {
         foreach (User user in db.Users)
         {
             if (user.firstname == comboBox1.SelectedItem.ToString())
             {
                 foreach (Book book in db.Books)
                 {
                     if (user.id_book == book.id_book)
                         listBox1.Items.Add(book.name);
                 }
             }
             
         }
     }
 }
Esempio n. 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddUser addUser = new AddUser();
            DialogResult result = addUser.ShowDialog(this);

            User user = new User();
            if (result == DialogResult.Cancel)
                Hide();
            if (result == DialogResult.OK)
            {

                user.firstname = addUser.textBox1.Text;
                user.name = addUser.textBox2.Text;
                user.lastname = addUser.textBox3.Text;
                user.id_book = listBook.Find(ob => ob.name == addUser.comboBox1.Text).id_book;
                db_lab4Entities db = new db_lab4Entities();
                db.Users.Add(user);
                db.SaveChanges();

                dataGridView1.Refresh();
                Refresh();
                MessageBox.Show("Добавлена новая книга!");
            }
        }
Esempio n. 7
0
 public Users()
 {
     InitializeComponent();
     db = new db_lab4Entities();
     listBook = new List<Book>();
 }
Esempio n. 8
0
        public SettingsGenre()
        {
            InitializeComponent();
            db = new db_lab4Entities();

        }