//------------------------------------------------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); }
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(); }
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(); }
//------------------------------------------------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"; }
//------------------------------------------------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); } }
private void br_select(string sql) { data_br.DataBindings.Clear(); data_br.DataSource = Borrow_ad.runsql(sql); }