예제 #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();
        }
예제 #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();
        }
예제 #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("修改信息成功");
        }
예제 #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("数据同步完成!", "提示");
 }
예제 #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();
            }
        }
예제 #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();
        }