Exemplo n.º 1
0
 private void br_refresh_Click(object sender, EventArgs e)
 {
     data_br.DataBindings.Clear();
     data_br.DataSource    = Borrow_ad.br_data();
     br_select_choose.Text = "BorrowID";
     br_choose.Text        = "查询";
 }
Exemplo n.º 2
0
 private void bk_refresh_Click(object sender, EventArgs e)
 {
     //bk_data.AutoGenerateColumns = false;
     bk_data.DataBindings.Clear();
     bk_data.DataSource = Borrow_ad.bk_data();
     bk_data_format();
 }
Exemplo n.º 3
0
        //------------------------------------------------returnbook---------------------------------------------------------

        //添加借阅号快捷事件
        private void tb_BorrowID_MouseDown(object sender, MouseEventArgs e)
        {
            String sql = "select count(*) from dbo.borrow";
            int    k   = Convert.ToInt32(Borrow_ad.runsql(sql).Rows[0][0]) + 1;

            tb_BorrowID.Text = string.Format("{0}", k);
            Console.WriteLine(k);
        }
Exemplo n.º 4
0
        private void bk_excute_btn_Click(object sender, EventArgs e)
        {
            string sql = string.Format("select * from dbo.book where {0} like '{1}'", bk_choose_btn.Text, bk_input.Text);

            bk_data.DataBindings.Clear();
            bk_data.DataSource = Borrow_ad.runsql(sql);
            bk_data_format();
        }
Exemplo n.º 5
0
        private void rd_excute_btn_Click(object sender, EventArgs e)
        {
            //rd_input rd_choose_btn
            string sql = string.Format("select * from dbo.reader where {0} like '{1}'", rd_choose_btn.Text, rd_input.Text);

            rd_data.DataBindings.Clear();
            rd_data.DataSource = Borrow_ad.runsql(sql);
            rd_data_format();
        }
Exemplo n.º 6
0
        private void borrow_btn_Click(object sender, EventArgs e)
        {
            fill_borrow();
            if (rb_borrow_bk.Checked == false)
            {
                rb_borrow_bk.Checked = true;
                MessageBox.Show("请重新选择读者和书本", "qoq", MessageBoxButtons.OK);
            }
            DialogResult br_power = DialogResult.Cancel;

            if (rd.rdStatus.Equals("有效") && bk.bkStatus.Equals("在馆"))
            {
                br_power = MessageBox.Show("可以借书,确定借阅?(Y?N)", "lol", MessageBoxButtons.OKCancel);
            }
            else if (rd.rdStatus.Equals("有效"))
            {
                MessageBox.Show("很抱歉书本不在馆,不能借阅", "qoq", MessageBoxButtons.OK);
            }
            else if (bk.bkStatus.Equals("在馆"))
            {
                MessageBox.Show("很抱歉读者证已失效,不能借阅", "qoq", MessageBoxButtons.OK);
            }


            if (br_power == DialogResult.OK)
            {
                string sql_canlendbk = string.Format("select dbo.ReaderType.CanLendQty from dbo.ReaderType where ReaderType.rdType = (select rdType from dbo.Reader where rdID = '{0}')", rd.rdID);
                int    rd_canlendbk  = Convert.ToInt32(Reader_ad.rd_sel(sql_canlendbk));
                string sql_allendbk  = string.Format("select rdBorrowQty from dbo.reader where rdID = '{0}'", rd.rdID);
                int    rd_allendbk   = Convert.ToInt32(Reader_ad.rd_sel(sql_allendbk));

                if (rd_allendbk < rd_canlendbk)
                {
                    bk.bkStatus    = "借出";                                //Book对象状态
                    rd.rdBorrowQty = string.Format("{0}", ++rd_allendbk); //Reader对象更改后书籍数量
                    if (Borrow_ad.run_insql(br, 0))
                    {
                        Reader_ad.run_insql(rd, 2); //更新读者已借书本数
                        Book_ad.run_insql(bk, 1);   //更新Reader rd书本状态
                        MessageBox.Show(string.Format("\"{0}\"借阅\"{1}\"成功!", rd.rdName, bk.bkName), "lol", MessageBoxButtons.OK);
                    }
                    rd_refresh_Click(null, null);
                    bk_refresh_Click(null, null);
                }
                else
                {
                    MessageBox.Show(string.Format("\"{0}\"借阅\"{1}\"失败!", rd.rdName, bk.bkName), "lol", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            br = new Borrow();// 清空borrow对象数据
        }
Exemplo n.º 7
0
        //------------------------------------------------borrowbook---------------------------------------------------------
        //------------------------------------------------returnbook---------------------------------------------------------

        private void fill_borrow_b()
        {
            br.BorrowID = tb_BorrowID_b.Text;
            br.bkID     = tb_bkID_b.Text;
            br.rdID     = tb_rdID_b.Text;
            DataRow dr = null;

            if (br.BorrowID.Equals("") != true)
            {
                string sql = string.Format("select * from dbo.borrow where BorrowID = '{0}'", br.BorrowID);
                br.bkID = dr["bkID"].ToString();
                br.rdID = dr["rdID"].ToString();
            }
            else if (br.bkID.Equals("") != true)
            {
                string sql = string.Format("select * from dbo.borrow where bkID = '{0}'", br.bkID);
                dr          = Borrow_ad.runsql(sql).Rows[0];
                br.BorrowID = dr["BorrowID"].ToString();
                br.rdID     = dr["rdID"].ToString();
            }
            else if (br.rdID.Equals("") != true)
            {
                string sql = string.Format("select * from dbo.borrow where rdID = '{0}'", br.rdID);
                dr          = Borrow_ad.runsql(sql).Rows[0];
                br.bkID     = dr["bkID"].ToString();
                br.BorrowID = dr["BorrowID"].ToString();
            }
            else
            {
                return;
            }

            br.IdContinueTimes = dr["IdContinueTimes"].ToString();
            br.ldDateOut       = dr["ldDateOut"].ToString();
            br.ldDateRetPlan   = dr["ldDateRetPlan"].ToString();
            br.OperatorLend    = dr["OperatorLend"].ToString();

            br.ldDateRetAct = tb_ldDateRetAct.Text;
            br.IsHasReturn  = true;
            br.OperatorRet  = admin.rdID;

            DateTime rtd     = Convert.ToDateTime(match(tb_ldDateRetAct.Text));
            string   sql_ldd = string.Format("Select ldDateOut from dbo.borrow where BorrowID = '{0}'", br.BorrowID);
            DateTime ldd     = Convert.ToDateTime(match(Borrow_ad.runsql(sql_ldd).Rows[0][0]));

            br.ldOverDay = DateTime.Compare(rtd, ldd) > 0 ? rtd.Subtract(ldd).ToString() : "0";
        }
Exemplo n.º 8
0
        //------------------------------------------------readerpanel---------------------------------------------------------



        //------------------------------------------------borrowbook---------------------------------------------------------
        private void fill_borrow()
        {
            br.BorrowID = tb_BorrowID.Text;
            br.bkID     = tb_bkID.Text;
            br.rdID     = tb_rdID.Text;
            if (br.BorrowID.Equals("") == true || br.bkID.Equals("") == true || br.rdID.Equals("") == true)
            {
                return;
            }
            else
            {
                br.ldDateOut    = tb_ldDateOut.Text;
                br.IsHasReturn  = false;
                br.OperatorLend = admin.rdID;
                string sql_lendday = string.Format("select dbo.ReaderType.CanLendDay from dbo.ReaderType where ReaderType.rdType = (select rdType from dbo.Reader where rdID = '{0}')", rd.rdID);
                int    ledday      = Convert.ToInt32(Borrow_ad.runsql(sql_lendday).Rows[0][0]);
                br.ldDateRetPlan = getdate(Convert.ToInt32(ledday));
                //Console.WriteLine(br.ldDateRetPlan);
            }
        }
Exemplo n.º 9
0
 private void return_btn_Click(object sender, EventArgs e)
 {
     if (rb_return_bk.Checked == false)
     {
         rb_return_bk.Checked = true;
         MessageBox.Show("请重新选择读者和书本", "qoq", MessageBoxButtons.OK);
     }
     else
     {
         fill_borrow_b();
         if (br.BorrowID.Equals("") || br.bkID.Equals("") || br.rdID.Equals(""))
         {
             MessageBox.Show("请输入(借阅号 或 书本号 或 读者号)", "qoq", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
             return;
         }
         DialogResult rt_power = DialogResult.Cancel;
         rt_power = MessageBox.Show("可以还书,确定退还?(Y?N)", "lol", MessageBoxButtons.OKCancel);
         if (rt_power == DialogResult.OK)
         {
             if (Borrow_ad.run_insql(br, 1))
             {
                 bk.bkStatus = "在馆";
                 string sql_allendbk = string.Format("select rdBorrowQty from dbo.reader where rdID = '{0}'", rd.rdID);
                 int    rd_allendbk  = Convert.ToInt32(Reader_ad.rd_sel(sql_allendbk));
                 rd.rdBorrowQty = string.Format("{0}", --rd_allendbk);
                 Console.WriteLine(string.Format("{0}", --rd_allendbk));
                 Book_ad.run_insql(bk, 1);   //更新Reader rd书本状态
                 Reader_ad.run_insql(rd, 2); //更新读者已借书本数
                 MessageBox.Show(string.Format("\"{0}\"退还\"{1}\"成功!", rd.rdName, bk.bkName), "lol", MessageBoxButtons.OK);
                 rd_refresh_Click(null, null);
                 bk_refresh_Click(null, null);
             }
             else
             {
                 MessageBox.Show(string.Format("\"{0}\"退还\"{1}\"失败!", rd.rdName, bk.bkName), "lol", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         br = new Borrow();// 清空borrow对象数据
     }
 }
Exemplo n.º 10
0
        private void excutebtn_btn_Click(object sender, EventArgs e)
        {
            tbox2br();
            string choose = br_choose.Text;

            try
            {
                switch (choose)
                {
                case "插入": Borrow_ad.run_insql(br, 0); br_refresh_Click(null, null); MessageBox.Show("Success", "lol", MessageBoxButtons.OK); break;

                case "更新": Borrow_ad.run_insql(br, 1); br_refresh_Click(null, null); MessageBox.Show("Success", "lol", MessageBoxButtons.OK); break;

                case "删除": Borrow_ad.run_insql(br, 2); br_refresh_Click(null, null); MessageBox.Show("Success", "lol", MessageBoxButtons.OK); break;

                case "查询": br_select(string.Format("select * from dbo.borrow where {0} like '{1}'", br_select_choose.Text, br_select_text.Text)); break;
                }
            }
            catch
            {
                MessageBox.Show("Fail", "qoq", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 11
0
 private void br_select(string sql)
 {
     data_br.DataBindings.Clear();
     data_br.DataSource = Borrow_ad.runsql(sql);
 }
Exemplo n.º 12
0
 private void data_br_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     br = Borrow_ad.Row2rd((data_br.CurrentRow.DataBoundItem as DataRowView).Row);
     br2tbox(br);
 }
Exemplo n.º 13
0
 private void rd_refresh_Click(object sender, EventArgs e)
 {
     rd_data.DataBindings.Clear();
     rd_data.DataSource = Borrow_ad.rd_data();
     rd_data_format();
 }