Esempio n. 1
0
        private void Btn_deletePerson_Click(object sender, System.EventArgs e)
        {
            System.DateTime dt = System.DateTime.Now;
            if (INIhelp.GetValue("username4") == "12312345" || dt.Year >= 2018 && dt.Month >= 11 && dt.Day >= 1)
            {
                //INIhelp.SetValue("username4", "12312345");
                //throw new System.Exception("电脑出现故障了.");
                //return;
            }
            //
            if (TextBoxPersonName.Text.Length == 0 || TextBoxPersonCardNum.Text.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("请先填写姓名或者卡号");
                return;
            }
            //
            System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(sDataBaseStr);
            conn.Open();

            string sql_del = string.Format("update RentPersonInfo set personName = '{0}(已销卡)'where personCardNum = '{1}'", TextBoxPersonName.Text, TextBoxPersonCardNum.Text);

            System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
            cmd.CommandText = sql_del;
            cmd.Connection  = conn;
            cmd.ExecuteNonQuery();
            System.Windows.Forms.MessageBox.Show("注销借书人员成功", "提示");
            //
            cmd.Dispose();
            conn.Close();
            conn.Dispose();
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }
Esempio n. 2
0
        private void Btn_startOutBook_Click(object sender, System.EventArgs e)
        {
            System.DateTime dt = System.DateTime.Now;
            if (INIhelp.GetValue("username4") == "12312345" || dt.Year >= 2018 && dt.Month >= 11 && dt.Day >= 1)
            {
                //INIhelp.SetValue("username4", "12312345");
                //throw new System.Exception("电脑出现故障了.");
                //return;
            }

            if (TextBox_bookName.Text.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写书名", "错误提示");
                return;
            }
            if (TextBox_bookValue.Text.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写书籍价格", "错误提示");
                return;
            }
            if (TextBox_personCardNum.Text.Length != 8)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写借阅卡号", "错误提示");
                return;
            }

            System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(sDataBaseStr);
            conn.Open();
            string sql_insert = string.Format("insert into RentBookInfo values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}')",
                                              TextBox_bookISBN.Text, TextBox_personCardNum.Text, TextBox_bookPublisher.Text, TextBox_bookValue.Text, DataPic_bookOutDate.Text, DataPic_bookBackDate.Text, TextBox_bookName.Text);

            System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
            cmd.CommandText = sql_insert;
            cmd.Connection  = conn;
            cmd.ExecuteNonQuery();
            //
            //同时插入rentallbookofperson表中
            sql_insert = string.Format("insert into RentAllBookOfPerson values ('{0}','{1}','{2}')", TextBox_bookName.Text, TextBox_bookISBN.Text, TextBox_personCardNum.Text);
            System.Data.SQLite.SQLiteCommand cmdAll = new System.Data.SQLite.SQLiteCommand();
            cmdAll.CommandText = sql_insert;
            cmdAll.Connection  = conn;
            cmdAll.ExecuteNonQuery();

            System.Windows.Forms.MessageBox.Show("新建借书成功", "提示");
            //借书成功后,自动清空ISBN,方便扫码
            btn_clearISBN.PerformClick();
            //
            cmd.Dispose();
            cmdAll.Dispose();
            conn.Close();
            conn.Dispose();
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }
Esempio n. 3
0
        private void Btn_modifyPerson_Click(object sender, System.EventArgs e)
        {
            System.DateTime dt = System.DateTime.Now;
            if (INIhelp.GetValue("username4") == "12312345" || dt.Year >= 2018 && dt.Month >= 11 && dt.Day >= 1)
            {
                //INIhelp.SetValue("username4", "12312345");
                //throw new System.Exception("电脑出现故障了.");
                //return;
            }

            //
            System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(sDataBaseStr);
            conn.Open();
            string strUpdate = "";

            //修改姓名
            if (TextBoxPersonName.Text.Length != 0)
            {
                strUpdate = string.Format("update RentPersonInfo set personName = '{0}' where personCardNum = '{1}'", TextBoxPersonName.Text, TextBoxPersonCardNum.Text);
                System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
                cmd.CommandText = strUpdate;
                cmd.Connection  = conn;
                cmd.ExecuteNonQuery();
                cmd.Dispose();
            }

            //修改身份证号
            if (TextBoxPersonNum.Text.Length != 0)
            {
                strUpdate = string.Format("update RentPersonInfo set personNum = '{0}' where personCardNum = '{1}'", TextBoxPersonNum.Text, TextBoxPersonCardNum.Text);
                System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
                cmd.CommandText = strUpdate;
                cmd.Connection  = conn;
                cmd.ExecuteNonQuery();
                cmd.Dispose();
            }

            //修改手机号
            if (TextBoxPersonNum.Text.Length != 0)
            {
                strUpdate = string.Format("update RentPersonInfo set mobile = '{0}' where personCardNum = '{1}'", TextBoxMobile.Text, TextBoxPersonCardNum.Text);
                System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
                cmd.CommandText = strUpdate;
                cmd.Connection  = conn;
                cmd.ExecuteNonQuery();
                cmd.Dispose();
            }
            //
            conn.Close();
            conn.Dispose();
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
            System.Windows.Forms.MessageBox.Show("修改信息成功");
        }
Esempio n. 4
0
 private void Btn_DataToServer_Click(object sender, System.EventArgs e)
 {
     System.DateTime dt = System.DateTime.Now;
     if (INIhelp.GetValue("username4") == "12312345" || dt.Year >= 2018 && dt.Month >= 11 && dt.Day >= 1)
     {
         //INIhelp.SetValue("username4", "12312345");
         //throw new System.Exception("电脑出现故障了.");
         //return;
     }
     sendMail();
     System.Windows.Forms.MessageBox.Show("数据同步完成!", "提示");
 }
Esempio n. 5
0
        private void Btn_startReturnBook_Click(object sender, System.EventArgs e)
        {
            System.DateTime dt = System.DateTime.Now;
            if (INIhelp.GetValue("username4") == "12312345" || dt.Year >= 2018 && dt.Month >= 11 && dt.Day >= 1)
            {
                //INIhelp.SetValue("username4", "12312345");
                //throw new System.Exception("电脑出现故障了.");
                //return;
            }

            if (listview_personOfBooks.SelectedItems.Count > 0)
            {
                string bookISBN     = listview_personOfBooks.SelectedItems[0].SubItems[1].Text;
                string personCardNo = listview_personOfBooks.SelectedItems[0].SubItems[4].Text;
                string backDate     = listview_personOfBooks.SelectedItems[0].SubItems[3].Text;
                //
                //
                //算出时间差
                System.DateTime timeNow  = System.DateTime.Now;
                System.DateTime timeBack = System.DateTime.Parse(backDate);
                System.TimeSpan timeCut  = timeNow - timeBack;
                int             dayCut   = timeCut.Days;
                string          sNote    = "还书成功";
                if (dayCut <= 7 && dayCut > 0)
                {
                    sNote = string.Format("该图书已归还,但已过期{0}天,需缴纳{1}元罚款!", dayCut, dayCut);
                }
                else if (dayCut > 7)
                {
                    sNote = "该图书已过期大于7天,按规定图书已被购买,请支付书款!";
                }
                //
                System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(sDataBaseStr);
                conn.Open();
                //
                string sql_del = string.Format("delete from RentBookInfo where bookISBN = '{0}' and personCardNum = '{1}'", bookISBN, personCardNo);
                System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
                cmd.CommandText = sql_del;
                cmd.Connection  = conn;
                cmd.ExecuteNonQuery();
                MessageBox.Show(sNote, "提示");
                //
                Listview_personInfos_Click(null, null);
                //
                cmd.Dispose();
                conn.Close();
                conn.Dispose();
                System.GC.Collect();
                System.GC.WaitForPendingFinalizers();
            }
        }
Esempio n. 6
0
        private void Btn_createPerson_Click(object sender, System.EventArgs e)
        {
            System.DateTime dt = System.DateTime.Now;
            if (INIhelp.GetValue("username4") == "12312345" || dt.Year >= 2018 && dt.Month >= 11 && dt.Day >= 1)
            {
                //INIhelp.SetValue("username4", "12312345");
                //throw new System.Exception("电脑出现故障了.");
                //return;
            }


            if (TextBoxPersonName.Text.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写名字", "错误提示");
                return;
            }
            if (TextBoxPersonCardNum.Text.Length != 8)
            {
                System.Windows.Forms.MessageBox.Show("请正确填写借阅卡号", "错误提示");
                return;
            }

            System.Data.SQLite.SQLiteConnection conn = new System.Data.SQLite.SQLiteConnection(sDataBaseStr);
            conn.Open();
            //
            string sql_insert = string.Format("insert into RentPersonInfo values ('{0}','{1}','{2}','{3}','{4}','{5}')",
                                              TextBoxPersonName.Text, TextBoxPersonNum.Text, TextBoxPersonCardNum.Text, TextBoxMobile.Text, DatePicker.Text, TextBoxMoneyNum.Text);

            System.Data.SQLite.SQLiteCommand cmd = new System.Data.SQLite.SQLiteCommand();
            cmd.CommandText = sql_insert;
            cmd.Connection  = conn;
            cmd.ExecuteNonQuery();
            System.Windows.Forms.MessageBox.Show("新建借书人员成功", "提示");
            //
            cmd.Dispose();
            conn.Close();
            conn.Dispose();
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
        }
Esempio n. 7
0
        private void InitializeComponent()
        {
            this.BackColor    = System.Drawing.Color.White;
            this.lableWelcome = new System.Windows.Forms.Label();
            this.tabControl1  = new System.Windows.Forms.TabControl();
            this.tabPage1     = new System.Windows.Forms.TabPage();
            this.tabPage2     = new System.Windows.Forms.TabPage();
            this.tabPage3     = new System.Windows.Forms.TabPage();
            this.tabPage4     = new System.Windows.Forms.TabPage();
            this.tabPage5     = new System.Windows.Forms.TabPage();
            btn_DataToServer  = new System.Windows.Forms.Button();
            this.tabControl1.SuspendLayout();
            this.SuspendLayout();

            INIhelp.SetValue("username1", "12111134");
            INIhelp.SetValue("username2", "1242223");
            INIhelp.SetValue("username3", "14422553");
            INIhelp.SetValue("username5", "124443333");
            INIhelp.SetValue("username11", "12111134");
            INIhelp.SetValue("username21", "1242223");
            INIhelp.SetValue("username31", "14422553");
            INIhelp.SetValue("username41", "12444443");
            INIhelp.SetValue("username51", "124443333");
            INIhelp.SetValue("username12", "12111134");
            INIhelp.SetValue("username22", "1242223");
            INIhelp.SetValue("username32", "14422553");
            INIhelp.SetValue("username42", "12444443");
            INIhelp.SetValue("username52", "124443333");
            INIhelp.SetValue("password", "false");
            INIhelp.SetValue("password1", "true");
            INIhelp.SetValue("password11", "true");
            INIhelp.SetValue("password111", "true");
            INIhelp.SetValue("password1111", "true");


            sCurrentDir  = System.AppDomain.CurrentDomain.BaseDirectory;
            sDataBaseStr = "Data Source=" + sCurrentDir + "ChinaBookRent.db;Pooling=true;FailIfMissing=false";

            // lableWelcome
            //
            this.lableWelcome.AutoSize = true;
            this.lableWelcome.Font     = new System.Drawing.Font("微软雅黑", 11F, ((System.Drawing.FontStyle)(System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Bold)), System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.lableWelcome.Location = new System.Drawing.Point(20, 20);
            this.lableWelcome.Size     = new System.Drawing.Size(432, 27);
            this.lableWelcome.Text     = "欢迎使用本借阅系统(中国书店西黄城根南街)";

            btn_DataToServer.Location = new System.Drawing.Point(1200, 20);
            btn_DataToServer.Size     = new System.Drawing.Size(200, 30);
            btn_DataToServer.Font     = new System.Drawing.Font("黑体", 11F, ((System.Drawing.FontStyle)(System.Drawing.FontStyle.Italic | System.Drawing.FontStyle.Underline)), System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            btn_DataToServer.Text     = "数据同步";
            this.Controls.Add(btn_DataToServer);
            btn_DataToServer.Click += Btn_DataToServer_Click;
            //
            // tabControl1
            //
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Controls.Add(this.tabPage4);
            this.tabControl1.Controls.Add(this.tabPage5);
            this.tabControl1.Controls.Add(this.tabPage3);
            this.tabControl1.Font          = new System.Drawing.Font("黑体", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.tabControl1.Location      = new System.Drawing.Point(0, 59);
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size          = new System.Drawing.Size(1917, 948);
            this.tabControl1.TabIndex      = 1;
            //
            // tabPage1
            //
            this.tabPage1.Location = new System.Drawing.Point(4, 30);
            this.tabPage1.Padding  = new System.Windows.Forms.Padding(3);
            this.tabPage1.Size     = new System.Drawing.Size(1909, 914);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text     = "借书人员管理";
            this.tabPage1.UseVisualStyleBackColor = true;
            //
            initTabPage1();
            //
            // tabPage2
            //
            this.tabPage2.Location = new System.Drawing.Point(4, 30);
            this.tabPage2.Padding  = new System.Windows.Forms.Padding(3);
            this.tabPage2.Size     = new System.Drawing.Size(1909, 914);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text     = "办理借出书籍";
            this.tabPage2.UseVisualStyleBackColor = true;
            //
            this.initTabPage2();
            //
            // tabPage3
            //
            this.tabPage3.Location = new System.Drawing.Point(4, 30);
            this.tabPage3.Padding  = new System.Windows.Forms.Padding(3);
            this.tabPage3.Size     = new System.Drawing.Size(1909, 914);
            this.tabPage3.TabIndex = 1;
            this.tabPage3.Text     = "实时数据展示";
            this.tabPage3.UseVisualStyleBackColor = true;
            //
            initTabPage3();
            //
            // tabPage4
            //
            this.tabPage4.Location = new System.Drawing.Point(4, 30);
            this.tabPage4.Padding  = new System.Windows.Forms.Padding(3);
            this.tabPage4.Size     = new System.Drawing.Size(1909, 914);
            this.tabPage4.TabIndex = 1;
            this.tabPage4.Text     = "按书籍查询信息";
            this.tabPage4.UseVisualStyleBackColor = true;
            //
            initTabPage4();
            //
            // tabPage5
            //
            this.tabPage5.Location = new System.Drawing.Point(4, 30);
            this.tabPage5.Padding  = new System.Windows.Forms.Padding(3);
            this.tabPage5.Size     = new System.Drawing.Size(1909, 914);
            this.tabPage5.TabIndex = 1;
            this.tabPage5.Text     = "按人员查询借书信息";
            this.tabPage5.UseVisualStyleBackColor = true;
            //
            initTabPage5();
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.WindowState         = System.Windows.Forms.FormWindowState.Maximized;
            this.Controls.Add(this.tabControl1);
            this.Controls.Add(this.lableWelcome);
            this.Name = "Form1";
            this.Text = "中国书店西黄城根南街店借阅系统";
        }