Beispiel #1
0
        protected override void CreateChildControls()
        {
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            bool bPublic = false;

            // public
            if (sessioninfo != null && sessioninfo.Account != null)
            {
                if (sessioninfo.Account.UserID == "public")
                {
                    bPublic = true;
                }
            }

            string strClass = "content";

            // 表头
            LiteralControl literal = new LiteralControl();

            literal.Text = // "<table class='head' cellspacing='1' cellpadding='4'>";
                           "<table class='head' width='768' border='0' cellpadding='0' cellspacing='0'>";

            //  width='780px'
            this.Controls.Add(literal);

            // 图书馆标志
            literal      = new LiteralControl();
            literal.Text = "<tr height='14'></tr><tr class='logo'>"
                           + "<td width='12' rowspan='2'></td><td class='logo' nowrap>";
            this.Controls.Add(literal);

            Image image = new Image();

            image.ID       = "logo";
            image.ImageUrl = "./arttext.aspx?text="
                             + HttpUtility.UrlEncode("数字平台读者服务")
                             + "&face="
                             + HttpUtility.UrlEncode("华文隶书")
                             + "&size="
                             + Convert.ToString(30.0F)
                             + "&effect=shadow&fontcolor=aaaaaa&backcolor=ffffff";
            // image.ImageUrl = "./logo.jpg";
            this.Controls.Add(image);

            literal      = new LiteralControl();
            literal.Text = "</td></tr>";
            this.Controls.Add(literal);


            // LinkButton linkbutton = null;
            // HyperLink hyperlink = null;


            literal      = new LiteralControl();
            literal.Text = "<tr class='content'>";
            this.Controls.Add(literal);

            // 登录和登出
            if (this.CurrentColumn == HeaderColumn.Login ||
                this.CurrentColumn == HeaderColumn.Login)
            {
                strClass = "content_active";
            }
            else
            {
                strClass = "content";
            }


            literal      = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";

            this.Controls.Add(literal);


            /*
             *
             * // 登录
             * linkbutton = new LinkButton();
             * linkbutton.ID = "login";
             * linkbutton.Text = "登录";
             * linkbutton.Click +=new EventHandler(loginButton_Click);
             * this.Controls.Add(linkbutton);
             *
             * // 登出
             * linkbutton = new LinkButton();
             * linkbutton.ID = "logout";
             * linkbutton.Text = "登出";
             * linkbutton.Click += new EventHandler(logoutButton_Click);
             * this.Controls.Add(linkbutton);
             *
             */

            CreateLink(
                false,
                "login",
                "登录",
                "./login.aspx");

            CreateLink(
                false,
                "logout",
                "登出",
                "./login.aspx?action=logout");

            literal      = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 我的图书馆

            if (this.CurrentColumn == HeaderColumn.MyLibrary)
            {
                strClass = "content_active";
            }
            else
            {
                strClass = "content";
            }

            literal      = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);


            /*
             * if (this.ImageStyle == false)
             * {
             *  hyperlink = new HyperLink();
             *  hyperlink.ID = "mylibrary";
             *  hyperlink.Text = "我的图书馆";
             *  hyperlink.NavigateUrl = "./mylibrary.aspx";
             *  this.Controls.Add(hyperlink);
             * }
             * else
             * {
             *  literal = new LiteralControl();
             *  literal.Text = "<a href='./mylibrary.aspx'>";
             *  this.Controls.Add(literal);
             *
             *  Image image = new Image();
             *  image.ID = "mylibrary";
             *  image.ImageUrl = "./arttext.aspx?text="
             + HttpUtility.UrlEncode("我的图书馆")
             + "&face=Tahoma&size="
             + Convert.ToString(12.0F)
             + "&effect=none";
             +  image.CssClass = "mylibrary";
             +  this.Controls.Add(image);
             +
             +  literal = new LiteralControl();
             +  literal.Text = "</a>";
             +  this.Controls.Add(literal);
             + }
             */

            if (bPublic == false)
            {
                CreateLink(
                    this.CurrentColumn == HeaderColumn.MyLibrary ? true : false,
                    "mylibrary",
                    "我的图书馆",
                    "./mylibrary.aspx");
            }

            literal      = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 检索

            if (this.CurrentColumn == HeaderColumn.Search)
            {
                strClass = "content_active";
            }
            else
            {
                strClass = "content";
            }


            literal      = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);

            /*
             *
             * hyperlink = new HyperLink();
             * hyperlink.ID = "search";
             * hyperlink.Text = "检索";
             * hyperlink.NavigateUrl = "./search.aspx";
             * this.Controls.Add(hyperlink);
             */

            CreateLink(
                this.CurrentColumn == HeaderColumn.Search ? true : false,
                "search",
                "检索",
                "./search.aspx");

            literal      = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 我的消息


            if (this.CurrentColumn == HeaderColumn.MyMessage)
            {
                strClass = "content_active";
            }
            else
            {
                strClass = "content";
            }

            literal      = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);

            /*
             *
             *
             * hyperlink = new HyperLink();
             * hyperlink.ID = "mymessage";
             * hyperlink.Text = "我的消息";
             * hyperlink.NavigateUrl = "./mymessage.aspx";
             * this.Controls.Add(hyperlink);
             */
            if (bPublic == false)
            {
                int nUnreadCount = 0;
                if (this.GetInboxUnreadCount != null)
                {
                    GetInboxUnreadCountEventArgs e = new GetInboxUnreadCountEventArgs();

                    this.GetInboxUnreadCount(this, e);
                    nUnreadCount = e.UnreadCount;
                }

                string strText = "我的消息";

                if (nUnreadCount != 0)
                {
                    strText += "(" + nUnreadCount.ToString() + ")";
                }
                CreateLink(
                    this.CurrentColumn == HeaderColumn.MyMessage ? true : false,
                    "mymessage",
                    strText,
                    "./mymessage.aspx");
            }

            literal      = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 刷新


            strClass = "content";

            literal      = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);

            /*
             *
             * linkbutton = new LinkButton();
             * linkbutton.ID = "refresh";
             * linkbutton.Text = "刷新";
             * linkbutton.Click += new EventHandler(refreshButton_Click);
             * this.Controls.Add(linkbutton);
             */

            ImageButton refresh = CreateImageButton(
                false,
                "refresh",
                "刷新");

            refresh.Click += new ImageClickEventHandler(refresh_Click);

            literal      = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);


            literal      = new LiteralControl();
            literal.Text = "</tr></table>";
            this.Controls.Add(literal);
        }
Beispiel #2
0
        protected override void CreateChildControls()
        {
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            bool bPublic = false;
            // public
            if (sessioninfo != null && sessioninfo.Account != null)
            {
                if (sessioninfo.Account.UserID == "public")
                    bPublic = true;
            }

            string strClass = "content";

            // 表头
            LiteralControl literal = new LiteralControl();
            literal.Text = // "<table class='head' cellspacing='1' cellpadding='4'>";
                "<table class='head' width='768' border='0' cellpadding='0' cellspacing='0'>";

            //  width='780px' 
            this.Controls.Add(literal);

            // 图书馆标志
            literal = new LiteralControl();
            literal.Text = "<tr height='14'></tr><tr class='logo'>"
                + "<td width='12' rowspan='2'></td><td class='logo' nowrap>";
            this.Controls.Add(literal);

            Image image = new Image();
            image.ID = "logo";
            image.ImageUrl = "./arttext.aspx?text="
                + HttpUtility.UrlEncode("数字平台读者服务")
                + "&face="
                + HttpUtility.UrlEncode("华文隶书")
                + "&size="
                + Convert.ToString(30.0F)
                + "&effect=shadow&fontcolor=aaaaaa&backcolor=ffffff";
            // image.ImageUrl = "./logo.jpg";
            this.Controls.Add(image);

            literal = new LiteralControl();
            literal.Text = "</td></tr>";
            this.Controls.Add(literal);


            // LinkButton linkbutton = null;
            // HyperLink hyperlink = null;


            literal = new LiteralControl();
            literal.Text = "<tr class='content'>";
            this.Controls.Add(literal);

            // 登录和登出
            if (this.CurrentColumn == HeaderColumn.Login
                || this.CurrentColumn == HeaderColumn.Login)
                strClass = "content_active";
            else
                strClass = "content";


            literal = new LiteralControl();
            literal.Text = "<td class='"+strClass+"' nowrap>";

            this.Controls.Add(literal);


            /*

            // 登录
            linkbutton = new LinkButton();
            linkbutton.ID = "login";
            linkbutton.Text = "登录";
            linkbutton.Click +=new EventHandler(loginButton_Click);
            this.Controls.Add(linkbutton);

            // 登出
            linkbutton = new LinkButton();
            linkbutton.ID = "logout";
            linkbutton.Text = "登出";
            linkbutton.Click += new EventHandler(logoutButton_Click);
            this.Controls.Add(linkbutton);
             * 
             */

            CreateLink(
                false,
                "login",
    "登录",
    "./login.aspx");

            CreateLink(
                false,
                "logout",
"登出",
"./login.aspx?action=logout");

            literal = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 我的图书馆

            if (this.CurrentColumn == HeaderColumn.MyLibrary)
                strClass = "content_active";
            else
                strClass = "content";

            literal = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);


            /*
            if (this.ImageStyle == false)
            {
                hyperlink = new HyperLink();
                hyperlink.ID = "mylibrary";
                hyperlink.Text = "我的图书馆";
                hyperlink.NavigateUrl = "./mylibrary.aspx";
                this.Controls.Add(hyperlink);
            }
            else
            {
                literal = new LiteralControl();
                literal.Text = "<a href='./mylibrary.aspx'>";
                this.Controls.Add(literal);

                Image image = new Image();
                image.ID = "mylibrary";
                image.ImageUrl = "./arttext.aspx?text="
                + HttpUtility.UrlEncode("我的图书馆")
                + "&face=Tahoma&size="
                + Convert.ToString(12.0F)
                + "&effect=none";
                image.CssClass = "mylibrary";
                this.Controls.Add(image);

                literal = new LiteralControl();
                literal.Text = "</a>";
                this.Controls.Add(literal);
            }
             */

            if (bPublic == false)
            {
                CreateLink(
                    this.CurrentColumn == HeaderColumn.MyLibrary ? true : false,
                    "mylibrary",
                    "我的图书馆",
                    "./mylibrary.aspx");
            }

            literal = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 检索

            if (this.CurrentColumn == HeaderColumn.Search)
                strClass = "content_active";
            else
                strClass = "content";


            literal = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);

            /*

            hyperlink = new HyperLink();
            hyperlink.ID = "search";
            hyperlink.Text = "检索";
            hyperlink.NavigateUrl = "./search.aspx";
            this.Controls.Add(hyperlink);
             */

            CreateLink(
                this.CurrentColumn == HeaderColumn.Search ? true : false,
                "search",
    "检索",
    "./search.aspx");

            literal = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 我的消息


            if (this.CurrentColumn == HeaderColumn.MyMessage)
                strClass = "content_active";
            else
                strClass = "content";

            literal = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);

            /*


            hyperlink = new HyperLink();
            hyperlink.ID = "mymessage";
            hyperlink.Text = "我的消息";
            hyperlink.NavigateUrl = "./mymessage.aspx";
            this.Controls.Add(hyperlink);
             */
            if (bPublic == false)
            {
                int nUnreadCount = 0;
                if (this.GetInboxUnreadCount != null)
                {
                    GetInboxUnreadCountEventArgs e = new GetInboxUnreadCountEventArgs();

                    this.GetInboxUnreadCount(this, e);
                    nUnreadCount = e.UnreadCount;
                }

                string strText = "我的消息";

                if (nUnreadCount != 0)
                    strText += "(" + nUnreadCount.ToString() + ")";
                CreateLink(
                    this.CurrentColumn == HeaderColumn.MyMessage ? true : false,
                    "mymessage",
                    strText,
                    "./mymessage.aspx");
            }

            literal = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);

            // 刷新


            strClass = "content";

            literal = new LiteralControl();
            literal.Text = "<td class='" + strClass + "' nowrap>";
            this.Controls.Add(literal);

            /*

            linkbutton = new LinkButton();
            linkbutton.ID = "refresh";
            linkbutton.Text = "刷新";
            linkbutton.Click += new EventHandler(refreshButton_Click);
            this.Controls.Add(linkbutton);
             */

            ImageButton refresh = CreateImageButton(
                false,
                "refresh",
    "刷新");
            refresh.Click +=new ImageClickEventHandler(refresh_Click);

            literal = new LiteralControl();
            literal.Text = "</td>";
            this.Controls.Add(literal);


            literal = new LiteralControl();
            literal.Text = "</tr></table>";
            this.Controls.Add(literal);
        }