private bool check_book_exist(string bookname)
        {
            string sql = "select * from Book where BookName =";

            sql += "'" + bookname + "'";
            DataTable dt   = SQLServer.ExecuteQuery(sql);
            string    sql1 = "select * from bookUserWanted1 where bookname =";

            sql1 += "'" + bookname + "'";
            DataTable dt1 = SQLServer.ExecuteQuery(sql1);

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("该书在图书库中已存在");
                return(true);
            }
            else if (dt1.Rows.Count > 0)
            {
                MessageBox.Show("该书已经被登记过");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        private void 新书通报ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string    sql       = "select BookName,BookAuthor,BookPress,Edition,ISBN from NBook";
            DataTable dataTable = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource          = dataTable;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.Columns[0].Visible  = true;
            label1.Visible              = false;
            label2.Visible              = false;
            txt_bookname.Visible        = false;
            txt_press.Visible           = false;
            借阅ToolStripMenuItem.Visible = false;
            dataGridView1.Columns["BookName"].HeaderText   = "书名";
            dataGridView1.Columns["BookAuthor"].HeaderText = "作者";
            dataGridView1.Columns["BookPress"].HeaderText  = "出版社";
            dataGridView1.Columns["Edition"].HeaderText    = "版次";
            dataGridView1.Columns["ISBN"].HeaderText       = "ISBN号";
            // dataGridView1.Columns[0].Width = 80;//设置列宽度
            dataGridView1.Columns["BookName"].Width   = 20; //设置列宽度
            dataGridView1.Columns["BookAuthor"].Width = 20; //设置列宽度
            dataGridView1.Columns["BookPress"].Width  = 20; //设置列宽度
            dataGridView1.Columns["Edition"].Width    = 20; //设置列宽度
            dataGridView1.Columns["ISBN"].Width       = 20; //设置列宽度
        }
Exemplo n.º 3
0
        private void loadData()
        {
            string    sql1 = "select UserName ,BookNum from bookReturning1";
            DataTable dt1  = SQLServer.ExecuteQuery(sql1);

            dataGridView1.DataSource          = dt1;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Exemplo n.º 4
0
        private void load_data()
        {
            string    sql = "select * from bookUserWanted1";
            DataTable dt  = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource          = dt;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
        private void 查询ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            string    sql       = "select [User].UserName,[User].ID,[User].CardID,ReaderType.UserType from [User],ReaderType where ReaderType.UserName=[User].UserName and ReaderType.UserType='读者'";
            DataTable dataTable = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource          = dataTable;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Exemplo n.º 6
0
        private void FormAdminBookInfo_Load_1(object sender, EventArgs e)
        {
            string    sql = "select * from Book";
            DataTable dt  = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource          = dt;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Exemplo n.º 7
0
        private void 管理借书信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            还书.Visible = false;
            string    sql = "select ordertable.UserName ,ordertable.OrderNum,ordertable.OrderBookName from ordertable";
            DataTable dt  = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource          = dt;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Exemplo n.º 8
0
        private string get_user_borrowed_num(string username)
        {
            string sql5 = "select Number from [User] where UserName="******"'" + username + "'";
            DataTable dt     = SQLServer.ExecuteQuery(sql5);
            string    number = dt.Rows[0]["Number"].ToString();

            return(number);
        }
        private void load_data()
        {
            string sql = "select ordertable.UserName,ordertable.OrderNum,ordertable.OrderBookName from ordertable where  ordertable.UserName ="******"'" + username + "'";

            DataTable dt = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource          = dt;
            dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
        }
Exemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "update message set Reply=";

            sql += "'" + textBox1.Text.ToString() + "'";
            sql += "where UserMessage=";
            sql += "'" + message + "'";
            DataTable dataTable = SQLServer.ExecuteQuery(sql);

            MessageBox.Show("回复成功!", "提示");
        }
Exemplo n.º 11
0
        /// <summary>
        /// 检测密码是否合法
        /// </summary>
        /// <param name="password"></param>
        /// <param name="password1"></param>
        /// <param name="password2"></param>
        /// <returns></returns>
        private bool check_pass(string password, string password1, string password2)
        {
            if (password == "")
            {
                MessageBox.Show("原始密码不能为空");
                return(false);
            }
            else if (password1 == "")
            {
                MessageBox.Show("新密码不能为空");
                return(false);
            }
            else if (password2 == "")
            {
                MessageBox.Show("重复密码不能为空");
                return(false);
            }
            else
            {
                if (password1 != password2)
                {
                    MessageBox.Show("两次输入的密码不同");
                    return(false);
                }
                else
                {
                    if (password == password1)
                    {
                        MessageBox.Show("新密码不能与原始密码相同");
                        return(false);
                    }
                    else
                    {
                        string sql = "select * from [User] where UserName ="******"'" + username + "'";
                        sql += "and Code= ";
                        sql += "'" + password + "'";

                        DataTable dt = SQLServer.ExecuteQuery(sql);
                        if (dt.Rows.Count > 0)
                        {
                            return(true);
                        }
                        else
                        {
                            MessageBox.Show("原始密码输入错误");
                            return(false);
                        }
                    }
                }
            }
        }
Exemplo n.º 12
0
        private bool check_pass(string username, string username1, string username2)
        {
            if (username == "")
            {
                MessageBox.Show("原始用户名不能为空");
                return(false);
            }
            else if (username1 == "")
            {
                MessageBox.Show("新用户名不能为空");
                return(false);
            }
            else if (username2 == "")
            {
                MessageBox.Show("重复新用户名不能为空");
                return(false);
            }
            else
            {
                if (username1 != username2)
                {
                    MessageBox.Show("两次输入的用户名不同");
                    return(false);
                }
                else
                {
                    if (username == username1)
                    {
                        MessageBox.Show("新密码不能与原始密码相同");
                        return(false);
                    }
                    else
                    {
                        string sql = "select * from [User] where UserName ="******"'" + username + "'";

                        DataTable dt = SQLServer.ExecuteQuery(sql);
                        if (dt.Rows.Count > 0)
                        {
                            return(true);
                        }
                        else
                        {
                            MessageBox.Show("原始用户名输入错误");
                            return(false);
                        }
                    }
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 检查学生信息是否绑定过其他用户
        /// </summary>
        /// <param name="studentno"></param>
        /// <returns></returns>
        private bool checkStudentsticked(string cardid)
        {
            string sql = "select * from [User] where CardID =";

            sql += "'" + cardid + "'";
            DataTable dt = SQLServer.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 14
0
        private bool check_pass(string bookid)
        {
            string sql = "select * from Book where BookNum =";

            sql += "'" + bookid + "'";

            DataTable dt = SQLServer.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 15
0
        private void 用户角色管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormChangeReaderType formChangeReaderType = new FormChangeReaderType(username);

            Visible = false;
            formChangeReaderType.ShowDialog();
            Visible = true;
            string sql = "select UserName from ReaderType where UserName="******"'" + username + "'";
            sql += "and UserType='管理员'";
            DataTable dataTable = SQLServer.ExecuteQuery(sql);

            if (dataTable.Rows.Count == 0)
            {
                this.Close();
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 检测用户名是否已存在
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        private bool check_user_exist(string username)
        {
            string sql = "select UserName , Code from [User] where UserName ="******"'" + username + "'";

            DataTable dt = SQLServer.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                MessageBox.Show("用户名被占用");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 17
0
        private bool check_book_user_exist(string username, string bookid)
        {
            string sql = "select * from ordertable where UserName = "******"'" + username + "'";
            sql += "and OrderNum = ";
            sql += "'" + bookid + "'";
            DataTable dt = SQLServer.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 检测是否已绑定个人信息
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        private bool check_is_binded(string username)
        {
            string sql = "select * from [User] where UserName ="******"'" + username + "'";
            sql += "and CardID =''";
            sql += "and ID=''";
            DataTable dt = SQLServer.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemplo n.º 19
0
        private void FormUserMain_Load(object sender, EventArgs e)
        {
            string    sql       = "select BookNum,BookName,BookAuthor,BookPress,ISBN from Book ";
            DataTable dataTable = SQLServer.ExecuteQuery(sql);

            dataGridView1.DataSource                       = dataTable;
            dataGridView1.AutoSizeColumnsMode              = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.Columns["BookNum"].HeaderText    = "书目号";
            dataGridView1.Columns["BookName"].HeaderText   = "书名";
            dataGridView1.Columns["BookAuthor"].HeaderText = "作者";
            dataGridView1.Columns["BookPress"].HeaderText  = "出版社";
            dataGridView1.Columns["ISBN"].HeaderText       = "ISBN号";
            // dataGridView1.Columns[0].Width = 80;//设置列宽度
            dataGridView1.Columns["BookNum"].Width    = 40; //设置列宽度
            dataGridView1.Columns["BookName"].Width   = 40; //设置列宽度
            dataGridView1.Columns["BookAuthor"].Width = 40; //设置列宽度
            dataGridView1.Columns["BookPress"].Width  = 40; //设置列宽度
            dataGridView1.Columns["ISBN"].Width       = 40; //设置列宽度
        }
Exemplo n.º 20
0
        /// <summary>
        /// 检查读者的用户名,密码,以及身份
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        private bool check_password(string username, string password)
        {
            string sql = "select * from [User] where Code =";

            sql += "'" + password + "'";
            sql += "and UserName in(select UserName from ReaderType where Username="******"'" + username + "'";
            sql += "and UserType='读者')";

            DataTable dt = SQLServer.ExecuteQuery(sql);

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 21
0
 private void 查询ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     label1.Visible              = true;
     label2.Visible              = true;
     txt_bookname.Visible        = true;
     txt_press.Visible           = true;
     借阅ToolStripMenuItem.Visible = true;
     if (txt_bookname.Text == "" && txt_press.Text == "")
     {
         string    sql       = "select BookNum,BookName,BookAuthor,BookPress,ISBN from Book  ";
         DataTable dataTable = SQLServer.ExecuteQuery(sql);
         dataGridView1.DataSource          = dataTable;
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     }
     else
     {
         string sql = "select BookNum,BookName,BookAuthor,BookPress,ISBN from Book  where ";
         if (txt_bookname.Text != "")
         {
             sql += "BookName like ";
             sql += "'%" + txt_bookname.Text.Trim() + "%'";
             if (txt_press.Text != "")
             {
                 sql += "and BookAuthor like";
                 sql += "'%" + txt_press.Text.Trim() + "%'";
             }
         }
         else
         {
             sql += "BookAuthor like";
             sql += "'%" + txt_press.Text.Trim() + "%'";
         }
         DataTable dataTable = SQLServer.ExecuteQuery(sql);
         if (dataTable.Rows.Count == 0)
         {
             MessageBox.Show("没有符合条件的书");
         }
         dataGridView1.DataSource          = dataTable;
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     }
 }
 private void 查询ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (textBox_UserName.Text == "" && textBox_CardID.Text == "")
     {
         string    sql       = "select [User].UserName,[User].ID,[User].CardID,ReaderType.UserType from [User],ReaderType where ReaderType.UserName=[User].UserName";
         DataTable dataTable = SQLServer.ExecuteQuery(sql);
         dataGridView1.DataSource          = dataTable;
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     }
     else
     {
         string sql = "select [User].UserName,[User].ID,[User].CardID,ReaderType.UserType from [User],ReaderType where ";
         if (textBox_UserName.Text != "")
         {
             sql += "[User].UserName like ";
             sql += "'%" + textBox_UserName.Text.Trim() + "%'";
             sql += "and ReaderType.UserName like ";
             sql += "'%" + textBox_UserName.Text.Trim() + "%'";
             sql += "and ReaderType.UserName=[User].UserName ";
             if (textBox_CardID.Text != "")
             {
                 sql += "and [User].CardID like";
                 sql += "'%" + textBox_CardID.Text.Trim() + "%'";
             }
         }
         else
         {
             sql += "[User].CardID like";
             sql += "'%" + textBox_CardID.Text.Trim() + "%'";
             sql += "and ReaderType.UserName=[User].UserName ";
         }
         DataTable dataTable = SQLServer.ExecuteQuery(sql);
         if (dataTable.Rows.Count == 0)
         {
             MessageBox.Show("没有符合条件的读者");
         }
         dataGridView1.DataSource          = dataTable;
         dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     }
 }