ASP.NET图书租赁管理系统(11)

来源:xiaoniu168.com 作者:本站原创 添加时间:2012-03-04 点击数:24435

计算机毕业设计介绍:

图书续借部分代码:
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        string bookBarCode = this.GridView1.DataKeys[e.NewSelectedIndex].Value.ToString();
        DateTime retureDate = Convert.ToDateTime(this.GridView1.Rows[e.NewSelectedIndex].Cells[4].Text);
        DateTime nowDate = DateTime.Now.Date;
        TimeSpan ts = nowDate - retureDate;
        int lagDays = ts.Days;
        string strLagMoney = this.GridView1.Rows[e.NewSelectedIndex].Cells[7].Text;
        int lagMoney = Convert.ToInt32(strLagMoney.Substring(0, strLagMoney.Length - 3));
        string strHire = this.GridView1.Rows[e.NewSelectedIndex].Cells[6].Text;
        int hire = Convert.ToInt32(strHire.Substring(0, strHire.Length - 3));
        int borrowDay = Convert.ToInt32(this.GridView1.Rows[e.NewSelectedIndex].Cells[5].Text);
        string hint = "";
        DateTime isHalf = retureDate.AddDays(-borrowDay / 2);
        if (isHalf < nowDate)
        {
            string[] sql = new string[3];
            if (lagDays > 0)
            {
                sql[0]="update tb_readerInfo set money=money-"+lagDays*lagMoney+" where readerBarCode='"+txtReaderBarCode.Text+"'";
                hint="此书已超归还期"+lagDays+"天,将从您的账户里扣除滞纳金"+lagDays*lagMoney+"元";
            }
            else
            {
                sql[0]="update tb_readerInfo set money=money-"+hire+" where readerBarCode='"+txtReaderBarCode.Text+"'";
            }
            sql[1]="update tb_bookInfo set borrowSum=borrowSum+1 where bookBarCode='"+bookBarCode+"'";
            sql[2]="update tb_bookBorrow set borrowTime='"+nowDate+"',returnTime='"+nowDate.AddDays(borrowDay)+"' where bookBarCode='"+bookBarCode+"'";
            if (dataOperate.execTransaction(sql))
            {
                string s = "select * from tb_readerInfo where readerBarCode='" + txtReaderBarCode.Text + "'";
                SqlDataReader da1 = dataOperate.getRow(s);
                da1.Read();
                string money = da1["money"].ToString();
                txtMoney.Text = money.Substring(0, money.Length - 2);
                string ss = "select * from tb_bookInfo as a inner join tb_bookBorrow as b on a.bookBarCode=b.bookBarCode inner join tb_bookType as c on a.bookType=c.typeID where readerBarCode='" + txtReaderBarCode.Text + "'";
                bindGridView(ss);
                RegisterStartupScript("", "");
            }
            else
            {
                RegisterStartupScript("", "");
            }
        }
        else
        {
            RegisterStartupScript("", "");
        }

<责任编辑:计算机毕业设计网(http://www.xiaoniu168.com)>

【联系方式】

【本站信誉】

用心做计算机毕业设计论文网