Example #1
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.DataSource != null)
            {
                DialogResult result = MessageBox.Show("确认归还?", "温馨提示", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    //执行删除语句
                    MessageBox.Show("还书成功!");
                }
                select_ID = (string)dataGridView1.CurrentCell.Value;
                //从在借单中删除
                string sql = "delete from Borrow_List where 书籍序列号='" + select_ID + "'";
                DataBaseApplication.ExecuteNonQuery(sql);
                //获取书名
                bookname = (string)dataGridView1.CurrentRow.Cells[3].Value.ToString();
                PublicPassBy.IMDB_Bookname = bookname;
                PublicPassBy.IMDB_Bookid   = select_ID;
                //添加进还书单
                string sql1 = "insert into Return_List values('" + select_ID + "','" + dataGridView1.CurrentRow.Cells[1].Value.ToString() + "','" + DateTime.Now.ToLongDateString().ToString() + "','" + dataGridView1.CurrentRow.Cells[3].Value.ToString() + "','" + PublicPassBy._name + "','" + PublicPassBy.email + "')";
                DataBaseApplication.ExecuteNonQuery(sql1);
                //加库存
                string sql2 = "update Books_Info set 库存数=库存数+1 where 书籍序列号='" + select_ID + "'";
                DataBaseApplication.ExecuteNonQuery(sql2);

                //询问是否写书评
                IMDB write = new IMDB();
                write.ShowDialog();
                this.Close();
            }
        }
Example #2
0
        private void OK_Click(object sender, EventArgs e)
        {
            string sql = "insert into Book_Recommend(书名,排行) values('" + textBox_top1.Text + "','1'),('" + textBox_top2.Text + "','2'),('" + textBox_top3.Text + "','3'),('" + textBox_top4.Text + "','4'),('" + textBox_top5.Text + "','5')";

            DataBaseApplication.ExecuteNonQuery(sql);
            this.Close();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "insert into Book_Recommend_Reader (书名,作者,出版社)values('" + textBox_BookName + "','" + textBox_Author + "','" + textBox_Press + "')";

            DataBaseApplication.ExecuteNonQuery(sql);
            MessageBox.Show("感谢您的推荐!");
            this.Close();
        }
Example #4
0
        private void btn_all_Click(object sender, EventArgs e)
        {
            string sql = "select * from Borrow_List";

            DataBaseApplication.ExecuteNonQuery(sql);
            DataTable dt = new DataTable();

            dt = DataBaseApplication.GetDataTableValue(sql);
            dataGridView1.DataSource = dt;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "select * from Login_ID";

            DataBaseApplication.ExecuteNonQuery(sql);
            DataTable dt = new DataTable();

            dt = DataBaseApplication.GetDataTableValue(sql);//执行sql语句
            dataGridView1.DataSource = dt;
        }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("确认删除?", "温馨提示", MessageBoxButtons.OKCancel);

            if (result == DialogResult.OK)
            {
                //执行删除语句
                MessageBox.Show("删除成功!");
            }
            string sql = "TRUNCATE TABLE Book_Recommend ";

            //string sql = "delete * from Book_Recommend";
            DataBaseApplication.ExecuteNonQuery(sql);
        }
Example #7
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string sql = "insert into Borrow_List values('" + textBox_No.Text.ToString() + "','" + textBox_ID.Text.ToString() + "','" + DateTime.Now.ToLongDateString().ToString() + "','" + textBox_Name.Text.ToString() + "','" + PublicPassBy._name + "', '" + DateTime.Now.AddDays(30).ToString() + "','" + PublicPassBy.email + "')";

            DataBaseApplication.ExecuteNonQuery(sql);
            string sql1 = "update Books_Info set 库存数=库存数-1 where 书籍序列号='" + textBox_No.Text.ToString() + "' ";

            DataBaseApplication.ExecuteNonQuery(sql1);
            MessageBox.Show("借阅成功!");
            //积分更新
            string sqln = "update Login_ID set 积分=积分+1 where 账号='" + textBox_ID.Text.ToString() + "' ";

            DataBaseApplication.ExecuteNonQuery(sqln);
            this.Close();
        }
        private void submit_Click(object sender, EventArgs e)
        {
            if (richTextBox1 != null && textBox_Rate != null)
            {
                string sql = "insert into IMDB values('" + richTextBox1.Text.ToString() + "','" + PublicPassBy.IMDB_Bookname + "','" + PublicPassBy.IMDB_Bookid + "','" + PublicPassBy.id + "','" + textBox_Rate.Text + "')";
                DataBaseApplication.ExecuteNonQuery(sql);
                DialogResult result = MessageBox.Show("确认提交?", "温馨提示", MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    //执行删除语句
                    MessageBox.Show("提交成功!");
                }
            }
            else
            {
                MessageBox.Show("请先填写完整!");
            }

            this.Close();
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            //时间显示
            timer1.Interval = 1000;
            timer1.Start();
            //底部状态栏数据
            LoginForm lg = new LoginForm();

            level1 = PublicPassBy.level;
            if (level1 == "用户")
            {
                tSSL2.Text = "权限级别:普通用户";
            }
            else
            {
                tSSL2.Text = "权限级别:管理员";
            }

            tSSL5.Text = "  " + PublicPassBy._name;
            //权限设置
            if (level1 == "用户")
            {
                Add_User.Visible = false;
                新用户注册ToolStripMenuItem.Visible = false;
                Add_Books.Visible             = false;
                热门推荐ToolStripMenuItem.Visible = false;
                新书入库ToolStripMenuItem.Visible = false;
            }
            //热门推荐
            string    sql = "select 书名,排行 from Book_Recommend";
            DataTable dt  = new DataTable();

            DataBaseApplication.ExecuteNonQuery(sql);
            dt            = DataBaseApplication.GetDataTableValue(sql);
            label1_1.Text = dt.Rows[0][0].ToString();
            label2_2.Text = dt.Rows[1][0].ToString();
            label3_3.Text = dt.Rows[2][0].ToString();
            label4_4.Text = dt.Rows[3][0].ToString();
            label5_5.Text = dt.Rows[4][0].ToString();
        }
Example #10
0
        private void BorrowBook1_Load(object sender, EventArgs e)
        {
            string sql = "select * from Books_Info where 书名='" + Select_ID + "'and 库存数!=0";

            DataBaseApplication.ExecuteNonQuery(sql);
            DataTable dt = new DataTable();

            dt = DataBaseApplication.GetDataTableValue(sql);//执行sql语句
            dataGridView1.DataSource = dt;
            //书评展示
            string sql1 = "select 书评,评分 from IMDB where 书名='" + Select_ID + "'";

            DataBaseApplication.ExecuteNonQuery(sql1);
            DataTable dt1 = new DataTable();

            dt1 = DataBaseApplication.GetDataTableValue(sql1);
            dataGridView2.DataSource = dt1;
            //平均分
            string sql2 = "select avg(评分) from IMDB where 书名='" + Select_ID + "'";

            DataBaseApplication.ExecuteNonQuery(sql2);
            DataTable dt2 = new DataTable();

            dt2          = DataBaseApplication.GetDataTableValue(sql2);
            avgRate.Text = dt2.Rows[0][0].ToString();
            //--------------------------------控件大小随窗体大小变化

            /*  this.Resize += new EventHandler(BorrowBook1_Resize);
             *
             * X = this.Width;
             * Y = this.Height;
             *
             * setTag(this);
             * BorrowBook1_Resize(new object(), new EventArgs());*/
            //---------------------------------控件大小随窗体大小变化
        }
        private void button_OK_Click(object sender, EventArgs e)
        {
            //防错
            q = textBox_Password.Text.Length;//q和p在上面定义
            p = textBox_phonenum.Text.Length;
            k = textBox_ID.Text.Length;
            if (k != 11)
            {
                MessageBox.Show("请输入账号(11位)!");
                m = 2;
            }
            if (k == 11)
            {
                if (q < 9 | q > 11)
                {
                    MessageBox.Show("请输入9-11位的密码!");
                    m = 2;
                }
                if (p != 11)
                {
                    MessageBox.Show("温馨提示:请检查您输入的号码是否正确(11位)!");
                    m = 2;
                }
            }
            if (p == 11)
            {
                if (textBox_Name.Text == "")
                {
                    MessageBox.Show("您的姓名未填写,请输入姓名!");
                }
                m = 2;


                if (textBox_phonenum.Text == "")
                {
                    MessageBox.Show("您的号码未填写,请输入11位号码!");
                }
                m = 2;


                if (q > 8 && q < 12)
                {
                    if (textBox_Password.Text == "")
                    {
                        MessageBox.Show("您的密码未填写,请输入密码!");
                        m = 2;
                    }

                    else
                    {
                        MessageBox.Show(textBox_Password.Text, "请您确认密码:");
                        m = 0;
                    }
                }
                if (textBox_email.Text == "")
                {
                    MessageBox.Show("您的邮箱未填写,请输入邮箱号!");
                    m = 2;
                }
                else
                {
                    MessageBox.Show(textBox_email.Text, "请您确认邮箱地址:");
                    m = m + 1;
                }
            }
            if (m == 1)
            {
                //防错
                if (type == "1")
                {
                    if (PublicPassBy.level != "管理员")
                    {
                        textBox_Title.Text     = "用户";
                        textBox_Title.ReadOnly = true;
                    }
                    string sql = "insert into Login_ID(账号,密码,身份,电话号码,邮箱,姓名,积分)values('" + textBox_ID.Text.ToString() + "','" + textBox_Password.Text.ToString() + "','" + textBox_Title.Text.ToString() + "','" + textBox_phonenum.Text.ToString() + "','" + textBox_email.Text.ToString() + "','" + textBox_Name.Text.ToString() + "',0)";
                    DataBaseApplication.ExecuteNonQuery(sql);
                    MessageBox.Show("添加成功");
                    this.Close();
                }
                if (type == "2")
                {
                    string sql = "update Login_ID set 密码='" + textBox_Password.Text.ToString() + "',身份='" + textBox_Title.Text.ToString() + "',电话号码='" + textBox_phonenum.Text.ToString() + "',邮箱='" + textBox_email.Text.ToString() + "',姓名='" + textBox_Name.Text.ToString() + "' where 账号='" + textBox_ID.Text.ToString() + "'";
                    DataBaseApplication.ExecuteNonQuery(sql);
                    MessageBox.Show("修改成功");
                    this.Close();
                }
            }
        }
Example #12
0
 private void button1_Click(object sender, EventArgs e)
 {
     //防错
     #region
     //书籍添加防错
     if (textBox_No.Text == "")
     {
         MessageBox.Show("请添加书籍序列号!");
     }
     if (textBox_BookName.Text == "")
     {
         MessageBox.Show("请输入书名!");
     }
     if (textBox_Author.Text == "")
     {
         MessageBox.Show("请输入作者!");
     }
     if (textBox_Press.Text == "")
     {
         MessageBox.Show("请输入出版社!");
     }
     if (textBox_Price.Text == "")
     {
         MessageBox.Show("请输入价格!");
     }
     if (textBox_Storage.Text == "")
     {
         MessageBox.Show("请输入库存数!");
     }
     if (textBox_No.Text != "")
     {
         if (textBox_BookName.Text != "")
         {
             if (textBox_Author.Text != "")
             {
                 if (textBox_Press.Text != "")
                 {
                     if (textBox_Price.Text != "")
                     {
                         if (textBox_Storage.Text != "")
                         {
                             t = 1;
                         }
                     }
                 }
             }
         }
     }//书籍添加防错
     #endregion
     if (t == 1)
     {
         if (type == "1")
         {
             if (textBox_No.Text == "")
             {
                 MessageBox.Show("请输入记录ID");
                 return;
             }
             string sql = "insert into Books_Info(书籍序列号,书名,作者,出版社,价格,库存数)values('" + textBox_No.Text.ToString() + "','" + textBox_BookName.Text.ToString() + "','" + textBox_Author.Text.ToString() + "','" + textBox_Press.Text.ToString() + "','" + textBox_Price.Text.ToString() + "','" + textBox_Storage.Text.ToString() + "')";
             DataBaseApplication.ExecuteNonQuery(sql);
             MessageBox.Show("添加成功");
             this.Close();
         }
     }
 }