Exemple #1
0
        /// <summary>
        /// 点击借出/归还按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLend_Click(object sender, EventArgs e)
        {
            DataTable dt = (DataTable)dataGridView.DataSource;
            // 获取选中行的id
            string book_id   = "" + dataGridView.Rows[dataGridView.CurrentRow.Index].Cells[0].Value;
            string book_name = "" + dataGridView.Rows[dataGridView.CurrentRow.Index].Cells[1].Value;
            string book_out_date;
            string book_in_date;

            switch (btnLend.Text)
            {
            case "借出":
                Common.bookDetail = new Book(book_id, book_name);
                Form form = new Admin_lendBook();
                form.ShowDialog();
                book_out_date = AutoCreateTool.getNowDate("yyyyMMdd");
                book_in_date  = AutoCreateTool.getNextBookInDate(book_out_date);

                bookService.updateBookStatusOut(book_id, book_out_date, book_in_date);
                break;

            case "归还":
                book_in_date = AutoCreateTool.getNowDate("yyyyMMdd");

                bookService.updateBookStatusIn(book_id, book_in_date);
                MessageBox.Show("归还成功!");
                break;

            default:
                break;
            }
        }
Exemple #2
0
        /// <summary>
        /// 初始化界面显示
        /// </summary>
        private void initialize()
        {
            textBox1.Text = Common.bookDetail.book_id;
            textBox2.Text = Common.bookDetail.book_name;

            textBox5.Text = AutoCreateTool.getNowDate("yyyyMMdd");
        }
Exemple #3
0
        /// <summary>
        /// 点击确认借出按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_addBook_Click(object sender, EventArgs e)
        {
            Lend lend = new Lend();

            lend.lend_id          = AutoCreateTool.getlendID();
            lend.lend_book_id     = Common.bookDetail.book_id;
            lend.lend_book_name   = Common.bookDetail.book_name;
            lend.lend_user_id     = Convert.ToInt32(textBox3.Text);
            lend.lend_user_name   = textBox4.Text;
            lend.lend_create_date = AutoCreateTool.getNowDate("yyyyMMdd");

            lendService.addLend(lend);
            MessageBox.Show("借出成功");
            Close();
        }
Exemple #4
0
        /// <summary>
        /// 添加到数据库
        /// </summary>
        private void addToDB()
        {
            string     format           = "00000;-#;(0)";
            int        count            = 0;
            string     seq              = "";
            string     file_name        = "";
            string     file_parent_name = "";
            string     create_date      = AutoCreateTool.getNowDate("yyyyMMdd");
            MyFileInfo myFileInfo       = null;

            foreach (var file in files)
            {
                seq              = AutoCreateTool.getSeq() + (++count).ToString(format);
                file_name        = file.Key;
                file_parent_name = file.Value;
                myFileInfo       = new MyFileInfo(seq, file_name, file_parent_name, create_date);
                myFileInfoService.addMyFileInfo(myFileInfo);
            }
        }
Exemple #5
0
        // 初始化获得当前日期
        private void initialize()
        {
            string date = AutoCreateTool.getNowDate("yyyyMMdd");

            textBox3.Text = date;
        }