杂志目录(页面部分CodeBehind)

发表于:2007-06-30来源:作者:点击数: 标签:
using System; using System.Data; using System.Data.SqlClient; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace cj168.Web { /// summary /// Summary description for showIssueCat. /// /summary public class show
using System;
using System.Data;
using System.Data.SqlClient;


using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;




namespace cj168.Web
{
    /// <summary>
    /// Summary description for showIssueCat.
    /// </summary>
    public class showIssueCat : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.Label lbMagInfo;

        protected System.Web.UI.WebControls.DataList datalistMagCat;
        protected System.Web.UI.WebControls.DataList datalistShowMagArtTitleLevel2;
        protected System.Web.UI.WebControls.DataList datalistShowMagArtTitleLevel1;
        protected System.Web.UI.WebControls.DataList DataList1;

        protected System.Web.UI.WebControls.DataList datalistShowMagArtTitleLevel3;
        
        protected System.Web.UI.WebControls.LinkButton LinkButton;
        protected System.Web.UI.WebControls.AdRotator Adrotator1;
        protected System.Web.UI.WebControls.Label lbArtDetailTitle;

        protected System.Web.UI.WebControls.Label lbArtQuotation;
        protected System.Web.UI.WebControls.Label lbArtMainHeader;
        protected System.Web.UI.WebControls.Label lbArtSubHeader;
        protected System.Web.UI.WebControls.Label lbArtViewPoint;
        protected System.Web.UI.WebControls.Label lbArtPageNo;
        protected System.Web.UI.WebControls.Label lbArtContent;


    
        
    
        public showIssueCat()
        {
            Page.Init += new System.EventHandler(Page_Init);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here

            //if (!IsPostBack)
            //{
                



                ShowCat();
            

            //}

        }

        //void BindData(int MagID, int MagYear, int YearIssue)
        


        void ShowCat()
        {
            String magName = Request.Params["MagName"];
            int magID = Int32.Parse(Request.Params["MagID"]);
            int magYear = Int32.Parse(Request.Params["MagYear"]);
            int yearIssue = Int32.Parse(Request.Params["YearIssue"]);
            
            

            //if (strMagName != String.Empty && strMagID != String.Empty  && strMagYear != String.Empty && strYearIssue != String.Empty)
            //{
            

            lbMagInfo.Text = magName + " " + magYear + "年度 第" + yearIssue + "期";
            //}
            //else
            //{
            //    lbMagInfo.Text = "参数有错";
            //}


            cj168.DataAclearcase/" target="_blank" >ccess.MagsDB ShowMagIssueCat = new cj168.DataAccess.MagsDB();
            datalistMagCat.DataSource = ShowMagIssueCat.GetMagIssueCat(magID, magYear, yearIssue);
            datalistMagCat.DataBind();
            

        }



        public DataSet ShowSubCat(int magID, int magYear, int yearIssue, int catID)
        {

            cj168.DataAccess.MagsDB ShowSubCat = new cj168.DataAccess.MagsDB();
            DataSet dr = ShowSubCat.GetSubCat(magID, magYear, yearIssue, catID);

            return dr;
            
        }

        public DataSet ShowMagArtTitle(int catIssueID)
        {        

            cj168.DataAccess.MagsDB ShowMagArtTitle = new cj168.DataAccess.MagsDB();
            DataSet dr = ShowMagArtTitle.GetMagArtTitle(catIssueID);
            
            return dr;
            
        }

        public String ShowArtURL(int artID)
        {
            String magName = Request.Params["MagName"];
            int magID = Int32.Parse(Request.Params["MagID"]);
            int magYear = Int32.Parse(Request.Params["MagYear"]);
            int yearIssue = Int32.Parse(Request.Params["YearIssue"]);

            return "showIssueCat.aspx?MagName=" + magName + "&MagID=" + magID + "&MagYear=" + magYear + "&YearIssue=" + yearIssue + "&txtID="+ artID;

        }

        public void ArtTitleLinkButton_Click(object sender, EventArgs e)
        {        
            int ArtID = ((LinkButton)sender).TabIndex;
            cj168.DataAccess.MagsDB ShowArtDetail = new cj168.DataAccess.MagsDB();
            DataSet myDataSet = ShowArtDetail.GetArtDetail(ArtID);

            DataRowView myRowView = myDataSet.Tables["ArtDetail"].DefaultView[0];

            if (myRowView["Quotation"].ToString().Trim() != String.Empty)
            {
                lbArtQuotation.Visible = true;
                lbArtQuotation.Text = "<div class=@#Quotation@#>" + myRowView["Quotation"].ToString() + "</div>";
            }
            else
            {
                lbArtQuotation.Visible = false;
            }

            lbArtMainHeader.Text = "<div class=@#MainHeader@#>" + myRowView["MainHeader"].ToString() + "</div>";
            if(myRowView["SubHeader"].ToString().Trim() != String.Empty)
            {
                lbArtSubHeader.Visible = true;
                lbArtSubHeader.Text = "<div class=@#SubHeader@#>" + myRowView["SubHeader"].ToString() + "</div>";
            }
            else
            {
                lbArtSubHeader.Visible = false;
            }

            if(myRowView["ViewPoint"].ToString().Trim() != String.Empty)
            {    lbArtViewPoint.Visible = true;
                lbArtViewPoint.Text = "<div class=@#ViewPoint@#>" + myRowView["ViewPoint"].ToString() + "</div>";
            }
            else
            {    lbArtViewPoint.Visible = false;
            }

            lbArtPageNo.Text = "<div class=@#PageNo@#>" + "页数:" + myRowView["PageNo"].ToString() + "</div>";

            lbArtContent.Text = "<div class=@#Content@#>" + myRowView["Content"].ToString() + "</div>";

        }


        protected void Page_Init(object sender, EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
        }

        //#region Web Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {    
            this.Load += new System.EventHandler(this.Page_Load);

        }
        //#endregion
    }
}

原文转自:http://www.ltesting.net