Ejemplo n.º 1
0
        private void reserve_Click(object sender, EventArgs e)
        {
            if (userLevel == "Library_Staff")
            {
                levelUser = connection.getUserState(user_text.Text);
            }
            else
            {
                levelUser = userLevel;
            }
            alowed = connection.usrAdminChk(levelUser);
            dr     = connection.usrReservChk(user_text.Text);
            dr.Read();
            userbook = Convert.ToInt32(dr[5].ToString());
            resrv    = Convert.ToInt32(dr[6].ToString());

            dr = connection.BookChk(title_text.Text);
            dr.Read();
            book   = Convert.ToInt32(dr[3].ToString());
            issued = Convert.ToInt32(dr[4].ToString());
            if (resrv + userbook <= alowed)
            {
                if (book == issued)
                {
                    connection.setReserv(user_text.Text, title_text.Text);
                    MessageBox.Show("Book is reserved.");
                }
                else
                {
                    MessageBox.Show("Book is available in the library");
                }
            }
            else
            {
                MessageBox.Show("User can't reserve any more books");
            }
        }
Ejemplo n.º 2
0
 public String usertype(String username)
 {
     return(connection.getUserState(username));
 }