⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modifybook.aspx.cs

📁 2007年华中科技大学数据库课程设计参考程序[图书销售系统]+报告
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OnlineBookSell.BLLFactory;
using OnlineBookSell.Model;
using OnlineBookSell.IBLL;
using OnlineBookSell.DBUtility;

public partial class ljian_admin_book_modifybook : System.Web.UI.Page
{

    public IBookBLL ibookdll = BLLFactory.getInstance().createBookBLL();
    public IUserBLL iuserdll = BLLFactory.getInstance().createUserBLL();
    public BookInfo book;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["bookid"] == null)
            return;

        book = ibookdll.GetBookById(Convert .ToInt32 (Request ["bookid"]));
        bookname.Text = book.Bookname;
        bookclass.SelectedIndex = bookclass.Items.IndexOf(bookclass.Items.FindByValue(book.Class1.ToString()));
        isbn.Text = book.Isbn;
        zuozhe.Text = book.Author;
        edition.Text = book.Edition;
        chubanshe.SelectedIndex = chubanshe.Items.IndexOf(chubanshe.Items.FindByValue(book.BookconcernID.ToString()));
        kaiben.Text = book.Format;
        mydate.Text = book.Publishtime.ToShortDateString();
        totalpages.Text = book.Totalpages.ToString();
        price.Text = book.Price.ToString();
        cost.Text = book.Cost.ToString();
        kucunliang.Text = book.Stocks.ToString();
        beizhu.Text = book.Summary;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //book.Addtime = DateTime.Now;
        book.Author = zuozhe.Text.Trim();
        book.BookconcernID = Convert.ToInt32(chubanshe.SelectedValue);
        book.Bookname = bookname.Text.Trim();
        book.Class1 = Convert.ToInt32(bookclass.SelectedValue);
        book.Cost = Convert.ToDouble(cost.Text.Trim());
        book.Edition = edition.Text.Trim();
        book.Format = kaiben.Text.Trim();
        book.Isbn = isbn.Text.Trim();
        book.Price = Convert.ToDouble(price.Text.Trim());
        book.Publishtime = Convert.ToDateTime(mydate.Text.Trim());
        book.Stocks = Convert.ToInt32(kucunliang.Text.Trim());
        book.Summary = beizhu.Text.Trim();
        if (totalpages.Text.Trim() != "")
            book.Totalpages = Convert.ToInt32(totalpages.Text.Trim());
        book.Id = Convert.ToInt32(Request ["bookid"]);

        if(ibookdll .ModifyBook (book))
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.Button1, this.Button1.GetType(), "success", "alert('修改成功!');", true);
        else
            System.Web.UI.ScriptManager.RegisterClientScriptBlock(this.Button1, this.Button1.GetType(), "success", "alert('发生错误,请刷新页面重试!');", true);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -