Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string BookBarcode = bookBarCode.Text;               //获取图书条形码信息
            string BookName    = bookName.Text;                  //获取图书名称信息
            string BookType    = bookType.SelectedValue;         //获取图书类型信息
            string BookCase    = bookCase.SelectedValue;         //获取书架信息
            string Author      = author.Text;                    //获取图书作者信息
            string Price       = price.Text;                     //获取图书价格信息
            string Stock       = stock.Text;
            string BorrowSum   = borrowSum.Text;
            string Operator    = Session["userName"].ToString();
            string sql         = "";

            if (barcode == "add")
            {
                sql = "insert into tb_bookInfo values('" + BookBarcode + "','" + BookName + "'," + BookType + ",'" + BookCase + "','" + Author + "'," + Price + ",'" + Stock + "'," + BorrowSum + ",'" + Operator + "')";
            }
            else
            {
                sql = "update tb_bookInfo set bookName='" + BookName + "', bookType='" + BookType + "',bookCase='" + BookCase + "', author='" + Author + "',price='" + Price + "',stock='" + Stock + "',borrowSum='" + BorrowSum + "', operator='" + Operator + "'where bookBarCode='" + barcode + "'";
            }

            if (DataOperate.ExecSQL(sql))
            {
                Response.Write("<script language=javascript>alert('保存成功!');window.opener.location.href=window.opener.location='BookInfo.aspx';window.close();</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存失败!')</script>");
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string ReaderTypeID   = readerTypeID.Text;
            string ReaderTypeName = readerTypeName.Text;
            string Num            = num.Text;
            string sql            = "";

            if (typeid == "add")
            {
                sql = "insert into tb_readerType values(" + ReaderTypeID + ",'" + ReaderTypeName + "'," + Num + ")";
            }
            else
            {
                sql = "update tb_readerType set readerTypeID=" + ReaderTypeID + ", readerTypeName='" + ReaderTypeName + "',num=" + Num + " where readerTypeID='" + typeid + "'";;
            }

            if (DataOperate.ExecSQL(sql))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存成功');window.opener.location.href=window.opener.location='ReaderType.aspx';window.close();</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存失败')</script>");
            }
        }
        protected void gvReaderType_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string id     = gvReaderType.DataKeys[e.RowIndex].Value.ToString();
            string sqlDel = "delete tb_readerType where readerTypeID='" + id + "'";

            DataOperate.ExecSQL(sqlDel);  //调用公共类中通用数据更新、插入和删除操作方法函数execSQL,删除此读者。
            bindReaderType();
            ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('删除成功')</script>");
        }
Esempio n. 4
0
 protected void update_Click(object sender, EventArgs e)
 {
     if (Session["entryType"].ToString() == "读者")
     {
         string        sql = "select * from tb_readerInfo where readerName='" + Session["userName"].ToString() + "'";
         SqlDataReader sdr = DataOperate.GetRow(sql);
         sdr.Read();
         if (pwd.Text == sdr["readerPassword"].ToString())
         {
             string upSql = "update tb_readerInfo set readerPassword='******' where readerName='" + Session["userName"].ToString() + "'";
             if (DataOperate.ExecSQL(upSql))
             {
                 ClientScript.RegisterStartupScript(GetType(), "Message", "<script>alert('密码修改成功!');window.location='Login.aspx';</script>");
             }
             else
             {
                 Response.Write("<script>alert('更新失败!')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('原始密码输入错误')</script>");
         }
     }
     else
     {
         string        sql = "select * from tb_user where userName='******'";
         SqlDataReader sdr = DataOperate.GetRow(sql);
         sdr.Read();
         if (pwd.Text == sdr["userPwd"].ToString())
         {
             string upSql = "update tb_user set userPwd='" + newPwd.Text + "' where userName='******'";
             if (DataOperate.ExecSQL(upSql))
             {
                 ClientScript.RegisterStartupScript(GetType(), "Message", "<script>alert('密码修改成功');window.location='Login.aspx';</script>");
             }
             else
             {
                 Response.Write("<script>alert('更新失败!')</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('原始密码输入错误')</script>");
         }
     }
 }
Esempio n. 5
0
        protected void gvReaderInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string id     = gvReaderInfo.DataKeys[e.RowIndex].Value.ToString(); //获取读者编号
            string sqlSel = "select count(*) from tb_bookBorrow where readerBarcode='" + id + "'";

            //调用公共类中判断指定数据是否存在的方法函数seleSQL,判断该读者是否有未归还图书
            if (DataOperate.SeleSQL(sqlSel) > 0)
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('不可以删除该读者,该读者图书还未归还')</script>"); //提示有未还图书,不能删除。
            }
            else
            {
                string sqlDel = "delete tb_readerInfo where readerBarCode='" + id + "'";
                DataOperate.ExecSQL(sqlDel);  //调用公共类中通用数据更新、插入和删除操作方法函数execSQL,删除此读者。
                bindReaderInfo();
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('删除成功')</script>");
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string BookTypeID   = bookTypeID.Text;
            string BookTypeName = bookTypeName.Text;
            string BorrowDay    = borrowDay.Text;
            string Hire         = hire.Text;
            string LagMoney     = lagMoney.Text;
            string sql          = "insert into tb_bookType values(" + BookTypeID + ",'" + BookTypeName + "'," + BorrowDay + "," + Hire + "," + LagMoney + ")";

            if (DataOperate.ExecSQL(sql))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存成功');window.opener.location.href=window.opener.location='BookType.aspx';window.close();</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存失败')</script>");
            }
        }
Esempio n. 7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string ReaderBarCode   = readerBarCode.Text;            //读者编号
            string ReaderPassword  = readerPassword.Text;           //登录密码
            string ReaderName      = readerName.Text;               //读者名称
            string Sex             = sex.SelectedValue;             //性别
            string ReaderType      = readerType.SelectedValue;      //读者类型
            string CertificateType = certificateType.SelectedValue; //证书类型
            string CertificateID   = certificateID.Text;            //证书编号
            string Tel             = tel.Text;                      //联系电话
            string Email           = email.Text;                    //Email地址
            string Remark          = remark.InnerText;              //备注
            double Addmoney;                                        //增加余额

            if (addMoney.Text == "")
            {
                Addmoney = 0;
            }
            else
            {
                Addmoney = Convert.ToDouble(addMoney.Text);
            }
            string Operator = Session["userName"].ToString();
            string sql      = "";

            if (barcode == "add")
            {
                sql = "insert into tb_readerInfo(readerBarCode,readerPassword,readerName,sex,readerType,certificateType,certificateID,tel,email,remark,money,Operator) values('" + ReaderBarCode + "','" + ReaderPassword + "','" + ReaderName + "','" + Sex + "','" + ReaderType + "','" + CertificateType + "','" + CertificateID + "','" + Tel + "','" + Email + "','" + Remark + "'," + Addmoney + ",'" + Operator + "')";
            }
            else
            {
                sql = "update tb_readerInfo set readerName='" + ReaderName + "', sex='" + Sex + "',readerType='" + ReaderType + "', certificateType='" + CertificateType + "',certificateID='" + CertificateID + "',tel='" + Tel + "',email='" + Email + "', remark='" + Remark + "',money=money+" + Addmoney + ",operator='" + Operator + "' where readerBarCode='" + barcode + "'";
            }

            if (DataOperate.ExecSQL(sql))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存成功');window.opener.location.href=window.opener.location='ReaderInfo.aspx';window.close();</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存失败')</script>");
            }
        }
Esempio n. 8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string LibraryName  = libraryName.Text;
            string WebSite      = webSite.Text;
            string Unit         = unit.Text;
            string Built        = built.Text;
            string Introduction = introduction.Text;
            string Address      = address.Text;
            string Phone        = phone.Text;
            string sql          = "update tb_libraryInfo set libraryName='" + LibraryName + "', webSite='" + WebSite + "',unit='" + Unit + "', built='" + Built + "',introduction='" + Introduction + "',address='" + Address + "',phone='" + Phone + "' where libraryBarCode=" + "'1001'";

            if (DataOperate.ExecSQL(sql))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存成功')</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存失败')</script>");
            }
            Save.Enabled        = false;
            Update.Enabled      = true;
            libraryName.Enabled = webSite.Enabled = unit.Enabled = built.Enabled = calendarImg.Enabled = Calendar.Enabled = introduction.Enabled = address.Enabled = phone.Enabled = false;
        }
Esempio n. 9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string BookcaseID   = bookcaseID.Text;
            string BookcaseName = bookcaseName.Text;
            string sql          = "";

            if (caseId == "add")
            {
                sql = "insert into tb_bookCase values(" + BookcaseID + ",'" + BookcaseName + "')";
            }
            else
            {
                sql = "update tb_bookCase set bookcaseID=" + BookcaseID + ", bookcaseName='" + BookcaseName + "' where bookcaseID='" + caseId + "'";
            }

            if (DataOperate.ExecSQL(sql))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存成功');window.opener.location.href=window.opener.location='BookCase.aspx';window.close();</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('保存失败')</script>");
            }
        }