示例#1
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (Userhelp.Lend_num() > 0)
     {
         if (Bookhelp.Have_book(click_book))
         {
             if (Bookhelp.LendBook(click_book) && Userhelp.User_lend())
             {
                 MessageBox.Show("借书成功!");
                 Userhelp.Record_Lend(click_book);
             }
             else
             {
                 MessageBox.Show("借书失败!");
             }
         }
         else
         {
             MessageBox.Show("此书余量不足!");
         }
     }
     else
     {
         MessageBox.Show("可借次数不足!");
     }
 }
示例#2
0
        public Form_My_Information()
        {
            InitializeComponent();
            admin_id.Text = Userhelp.ruid;
            SqlDataReader sqlDataReader = Userhelp.ExistsID(Userhelp.ruid);

            while (sqlDataReader.Read())
            {
                name.Text   = sqlDataReader.GetString(1);
                birth.Value = (DateTime)sqlDataReader["birth"];
                if (((string)sqlDataReader["sex"]).Equals("男"))
                {
                    sex_man.Checked = true;
                }
                else
                {
                    sex_woman.Checked = true;
                }
                reader_id.Text = Userhelp.ruid;
                address.Text   = (string)sqlDataReader["address"];
                tel.Text       = (string)sqlDataReader["tel"];
                //password.Text = (string)sqlDataReader["password"];
            }
            sqlDataReader.Close();
        }
示例#3
0
 public Back_Book()
 {
     InitializeComponent();
     init_grid();
     count         = Userhelp.Lend_num();
     name.Text     = Userhelp.ruid;
     lend_num.Text = count.ToString();
 }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string uid = admin_id.Text.ToString().Trim();
            string pwd = password.Text.ToString().Trim();

            if (uid.Equals("") && pwd.Equals(""))
            {
                MessageBox.Show("账号密码不能为空!");
            }
            else if (uid.Equals(""))
            {
                MessageBox.Show("账号不能为空!");
            }
            else if (pwd.Equals(""))
            {
                MessageBox.Show("密码不能为空!");
            }
            else
            {
                if (user_type.SelectedItem.ToString().Trim().Equals("用户"))
                {
                    Userhelp.reuid(uid);
                    SqlDataReader sqlDataReader;
                    sqlDataReader = Userhelp.Password(uid, pwd);
                    if (sqlDataReader.Read())
                    {
                        Form_main form = new Form_main(false);
                        form.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("密码错误!");
                    }
                    sqlDataReader.Close();
                }
                else
                {
                    Userhelp.reuid(uid);
                    SqlDataReader sqlDataReader;
                    sqlDataReader = Userhelp.adminPassword(uid, pwd);
                    if (sqlDataReader.Read())
                    {
                        Form_main form = new Form_main(true);
                        form.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("密码错误!");
                    }
                    sqlDataReader.Close();
                }
            }
        }
示例#5
0
 //delete reader
 private void button3_Click(object sender, EventArgs e)
 {
     if (Userhelp.deleteReader(reader_id.Text.ToString()))
     {
         MessageBox.Show("已注销该用户");
         init_grid();
     }
     else
     {
         MessageBox.Show("不存在此用户");
     }
 }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string uid   = reader_id.Text.ToString().Trim();
            string uname = name.Text.ToString().Trim();
            string sex;

            if (sex_man.Checked)
            {
                sex = "男";
            }
            else
            {
                sex = "女";
            }
            string birth_date = birth.Value.ToShortDateString();
            string addr       = address.Text.ToString().Trim();
            string telphone   = tel.Text.ToString().Trim();
            string pwd        = password.Text.ToString().Trim();
            string rpwd       = makesure_password.Text.ToString().Trim();

            if (uid.Equals("") || uname.Equals("") || birth_date.Equals("") ||
                addr.Equals("") || telphone.Equals("") || pwd.Equals("") || rpwd.Equals(""))
            {
                MessageBox.Show("请完善你的信息!");
            }
            else
            {
                if (!pwd.Equals(rpwd))
                {
                    MessageBox.Show("两次输入的密码不同!");
                }
                else
                {
                    string sql = "INSERT INTO reader_info(reader_id,name,sex,birth,address,tel,password)" +
                                 "VALUES(" + "'" + uid + "','" + uname + "','" + sex + "','" + birth_date + "','"
                                 + addr + "','" + telphone + "','" + pwd + "')";
                    if (Userhelp.register(sql))
                    {
                        MessageBox.Show("注册成功!");
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("注册失败!");
                    }
                }
            }
        }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            string p1 = new_password.Text.ToString().Trim();
            string p2 = makesure_new_password.Text.ToString().Trim();

            if (p1.Equals("") || p2.Equals(""))
            {
                MessageBox.Show("密码不能为空!");
            }
            else
            {
                if (!p1.Equals(p2))
                {
                    MessageBox.Show("两次密码必须相同!");
                }
                else
                {
                    if (!admin)
                    {
                        if (Userhelp.ChangePassword(Userhelp.ruid, p1))
                        {
                            MessageBox.Show("更改密码成功!");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("更改密码失败!");
                        }
                    }
                    else
                    {
                        if (Userhelp.adminChangePassword(Userhelp.ruid, p1))
                        {
                            MessageBox.Show("更改密码成功!");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("更改密码失败!");
                        }
                    }
                }
            }
        }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            admin_id.ReadOnly  = true;
            name.ReadOnly      = true;
            birth.Enabled      = false;
            tel.ReadOnly       = true;
            reader_id.ReadOnly = true;
            sex_man.Enabled    = false;
            sex_woman.Enabled  = false;
            address.ReadOnly   = true;
            //password.ReadOnly = true;
            button1.Enabled = false;
            button2.Enabled = true;

            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(" name='");
            stringBuilder.Append(name.Text);
            stringBuilder.Append("' , sex='");
            if (sex_man.Checked)
            {
                stringBuilder.Append("男");
            }
            else
            {
                stringBuilder.Append("女");
            }
            stringBuilder.Append("' , birth='");
            stringBuilder.Append(birth.Value.ToShortDateString());
            stringBuilder.Append("' , address='");
            stringBuilder.Append(address.Text);
            stringBuilder.Append("' , tel='");
            stringBuilder.Append(tel.Text);
            stringBuilder.Append("'");
            //stringBuilder.Append(password.Text+"'");
            if (Userhelp.Changeinfo(admin_id.Text, stringBuilder.ToString()))
            {
                MessageBox.Show("修改成功!");
            }
            else
            {
                MessageBox.Show("修改失败!");
            }
        }
示例#9
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!sernum.Equals(""))
     {
         if (Userhelp.Back_book(sernum))
         {
             Userhelp.update_ustate();
             bookcount = Bookhelp.BookNum(bookid);
             bookcount++;
             Bookhelp.UpdateBook_lend(bookid, bookcount.ToString());
             MessageBox.Show("还书成功!");
             init_grid();
             lend_num.Text = Userhelp.Lend_num().ToString();
         }
         else
         {
             MessageBox.Show("本书已归还!请勿重复操作!");
         }
     }
     else
     {
         MessageBox.Show("没有选择的书目!");
     }
 }
示例#10
0
 private void InitUserTop()
 {
     userTop.DataSource = Userhelp.UserTop();
 }
示例#11
0
        //query
        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt = Userhelp.ReaderInfoManage(reader_id.Text.ToString());

            dataGridView1.DataSource = dt;
        }