viewbookattribute.aspx.cs

来自「精通网络应用系统开发 光盘 该书是人民邮电出版社出版的」· CS 代码 · 共 83 行

CS
83
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 System.Linq;
using System.Data.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;

public partial class DesktopModules_Book_ViewBookAttribute : System.Web.UI.Page
{
    private int nAttributeFlag = -1;
    private int nBookID = -1;
    private int nCategoryID = -1;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Params["CategoryID"] != null)
        {
            nCategoryID = Int32.Parse(Request.Params["CategoryID"].ToString());
        }
        if (Request.Params["AttributeFlag"] != null)
        {
            nAttributeFlag = Int32.Parse(Request.Params["AttributeFlag"].ToString());
        }
        if (Request.Params["BookID"] != null)
        {
            nBookID = Int32.Parse(Request.Params["BookID"].ToString());
        }
        if (!Page.IsPostBack)
        {
            if (nAttributeFlag > -1 && nBookID > -1)
            {
                BindBookAttributeData(nBookID, nAttributeFlag);
            }
        }
    }

    private void BindBookAttributeData(int nBookID, int nAttributeFlag)
    {
        BookM book = new BookM();
        Book recb = book.GetSingleBook(nBookID);
        if (recb!=null)
        {
            switch (nAttributeFlag)
            {
                case 0:   ///前言
                    {
                        AttributeName.Text = "书籍的前言信息:";
                        AttributeValue.Text = recb.Foreword;
                        break;
                    }
                case 1:   ///目录
                    {
                        AttributeName.Text = "书籍的目录信息:";
                        AttributeValue.Text = recb.List;
                        break;
                    }
                case 2:  ///内容提要
                    {
                        AttributeName.Text = "书籍的内容提要信息:";
                        AttributeValue.Text = recb.OutLine;
                        break;
                    }               
                default: break;
            }

        }
    }

    protected void ReturnBtn_Click(object sender, EventArgs e)
    {
        ///关闭窗口
        Response.Write("<script>window.close();</script>");    
    }
}

⌨️ 快捷键说明

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