实验室网站:新闻列表和新闻明细绑定

2017-07-09 20:42:25  访问(1975) 赞(0) 踩(0)




  • 一、通过参数识别
    1、id:新闻纪录
    2、sortid:新闻栏目
    3、thecode:新闻栏目代号

    二、新闻分成多种
    1、普通的列表
    2、如果列表只有单条则显示单条新闻的明细
    3、固定单条新闻的明细显示



  • 
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="NewsList.aspx.cs" Inherits="NewsList"
        ValidateRequest="false" %>
    
    <%@ Register Src="UserControls/LeftOne.ascx" TagName="LeftOne" TagPrefix="uc1" %>
    <%@ Register Src="UserControls/LeftCYXZ.ascx" TagName="LeftCYXZ" TagPrefix="uc1" %>
    <%@ Register Src="UserControls/LeftCYLJ.ascx" TagName="LeftCYLJ" TagPrefix="uc1" %>
    <%@ Register Src="UserControls/WebTop.ascx" TagName="WebTop" TagPrefix="uc1" %>
    <%@ Register Src="UserControls/WebBottom.ascx" TagName="WebBottom" TagPrefix="uc1" %>
    <%@ Register Src="UserControls/WebBeiAn.ascx" TagName="WebBeiAn" TagPrefix="uc1" %>
    <%@ Register Src="UserControls/WebFooter.ascx" TagName="WebFooter" TagPrefix="uc1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <!-- 新闻列表和新闻明细 -->
        <title>
            <%=WebPageTitle %></title>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
        <link href="<%=strPhyPath %>/css/lab.css" rel="stylesheet" type="text/css" />
        <link href="<%=strPhyPath %>/css/HrefItem.css" rel="stylesheet" type="text/css" />
         
    </head>
    <body>
        <form id="form1" runat="server">
        <uc1:WebTop ID="WebTop1" runat="server" />
        <table width="1200"  border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="240"  valign="top">
                    <table width="100%" height="50" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                            <td height="5">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td height="2" bgcolor="#0078D7">
                            </td>
                        </tr>
                          
                        <tr>
                            <td>
                                <img src="<%=strPhyPath %>/img/fx.jpg" width="240" height="11" alt="" />
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#0078D7">
                                <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td height="40" colspan="2" bgcolor="#0078D7" class="STYLE1">
                                            分类
                                        </td>
                                    </tr>
                                    <asp:Repeater ID="rp_Nav" runat="server">
                                        <ItemTemplate>
                                            <tr>
                                                <td width="10%" height="40" bgcolor="#0078D7">
                                                    <img src="<%=strPhyPath %>/img/dot.jpg" width="3" height="3" alt="" />
                                                </td>
                                                <td width="90%" height="40" bgcolor="#0078D7" class="STYLE2">
                                                    <a href="<%#DBH.ConvertUrl(Eval(NI._newsSort.ListUrl)) %>" title="<%#DBH.ConvertObj(Eval(NI._newsSort.TheName)) %>"
                                                        target="<%#DBH.GetTarget(Eval(NI._newsSort.LinkTarget)) %>" class="NewsHrefSTYLE2">
                                                        <%#DBH.HighLighObj(Eval(NI._newsSort.TheName),Eval(NI._newsSort.ID), curNewSortId)%></a>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="2" colspan="2" bgcolor="#0078D7">
                                                    <img src="<%=strPhyPath %>/img/line2.jpg" width="212" height="2" alt="" />
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                    <tr>
                                        <td height="10" colspan="2" bgcolor="#0078D7">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td height="6">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <!-- 常用链接 -->
                                <uc1:LeftCYLJ ID="LeftCYLJ1" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td height="6">
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <!-- 常用下载 -->
                                <uc1:LeftCYXZ ID="LeftCYXZ1" runat="server" />
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="20">
                    &nbsp;
                </td>
                <td valign="top">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td colspan="2">
                                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td width="9" height="40" class="STYLE3">
                                            &nbsp;
                                        </td>
                                        <td height="40" class="STYLE3">
                                            当前位置:&nbsp;<a href="<%=WB.IndexUrl %>" class="NewsHrefSTYLE3" target="_self">首页</a><%=newsSortNav%></h1>
                                        </td>
                                        <td height="40" class="STYLE3" align="right"  colspan="2">
                                            <asp:TextBox ID="txt_Search" runat="server" CssClass="textbox_search"></asp:TextBox>
                                            <asp:Button ID="btn_Search" Text="搜索" runat="server" OnClick="btn_Search_Click" OnClientClick="OnJsSearchClick(); return false;" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4" class="STYLE3">
                                            <img src="<%=strPhyPath %>/img/l7.jpg" width="941" height="2" alt="" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td height="5" colspan="4" align="left">
                                        </td>
                                    </tr>
                                    <asp:Repeater ID="rp_List" runat="server">
                                        <ItemTemplate>
                                            <tr>
                                                <td height="40" align="left" class="STYLE8">
                                                    <img src="<%=strPhyPath %>/img/dot2.jpg" width="3" height="3" alt="" />
                                                </td>
                                                <td height="40" class="STYLE10">
                                                    <%#Eval(NI.news.HrefValue) %>
                                                </td>
                                                <td colspan="2" align="right" class="STYLE10">
                                                    <span class="STYLE8">
                                                        <%#DH.PrintyyyyMMdd(Eval(NI.news.InsertTime))%></span>
                                                </td>
                                            </tr>
                                        </ItemTemplate>
                                    </asp:Repeater>
                                    <tr runat="server" id="pl_List">
                                        <td height="60" colspan="4" align="center">
                                            <wuqi:AspNetPager CssClass="paginator" CurrentPageButtonClass="cpb" ID="mainAspNetPager"
                                                PageSize="15" runat="server" RecordCount="11" FirstPageText="首页" LastPageText="尾页"
                                                NextPageText="下一页" PrevPageText="上一页" PageIndexBoxStyle="width:50px" ShowPageIndexBox="Auto"
                                                PageIndexBoxType="DropDownList" TextBeforePageIndexBox="转到第" TextAfterPageIndexBox="页"
                                                UrlPaging="true" UrlPageSizeName="pagesize" UrlPageIndexName="pageindex" Width="95%"
                                                LayoutType="Table" ShowNavigationToolTip="true" CustomInfoHTML="显示页信息" ShowDisabledButtons="true"
                                                AlwaysShow="true" ShowCustomInfoSection="Left" PagingButtonSpacing="8px">
                                            </wuqi:AspNetPager>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="pl_Detail" visible="false">
                                        <td height="20" colspan="4" align="center">
                                            <asp:Literal ID="lt_Title" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="pl_contentBar" visible="false">
                                        <td height="20" colspan="4" align="center">
                                            <p>
                                                <asp:Literal runat="server" ID="lt_Author"></asp:Literal>&nbsp;发布:<asp:Literal runat="server"
                                                    ID="lt_InsertTime"></asp:Literal>&nbsp; 分类:<a href="<%=newsSortItem.ConvertListUrl()%>"
                                                        title="<%=newsSortItem.ConvertTheName() %>" class="LiNewsHref"><%=newsSortItem.TheName%></a>&nbsp;点击:<span
                                                            class="blue"><asp:Literal ID="lt_Hits" runat="server"></asp:Literal></span></p>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="pl_DetailTwo" visible="false">
                                        <td colspan="4" align="left">
                                            <asp:Literal ID="lt_TheContent" runat="server"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="pl_PreNext" visible="false">
                                        <td height="60" colspan="4" align="left">
                                            <asp:Literal runat="server" ID="lt_PreNews"></asp:Literal>
                                            <asp:Literal runat="server" ID="lt_NextNews"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="pl_DetailThree" visible="false">
                                        <td height="40" colspan="4" align="left">
                                            <wuqi:AspNetPager CssClass="paginator" CurrentPageButtonClass="cpb" ID="detailAspNetPager"
                                                PageSize="1" runat="server" RecordCount="11" FirstPageText="首页" LastPageText="尾页"
                                                NextPageText="下一页" PrevPageText="上一页" PageIndexBoxStyle="width:50px" ShowPageIndexBox="Auto"
                                                PageIndexBoxType="DropDownList" TextBeforePageIndexBox="转到第" TextAfterPageIndexBox="页"
                                                UrlPaging="true" UrlPageSizeName="pagesize" UrlPageIndexName="pageindex" Width="100%"
                                                LayoutType="Table" ShowNavigationToolTip="true" CustomInfoHTML="" ShowDisabledButtons="true"
                                                AlwaysShow="true" ShowCustomInfoSection="Never" PagingButtonSpacing="8px">
                                            </wuqi:AspNetPager>
                                        </td>
                                    </tr>
                                    <tr runat="server" id="pl_DetailFour" visible="false">
                                        <td height="60" colspan="4" align="left">
                                            <!-- 相关附件 -->
                                            <%=filesInfo %>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <table width="1200" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td height="10">
                    &nbsp;
                </td>
            </tr>
        </table>
                <uc1:WebFooter ID="WebFooter1" runat="server" />
    
        </form>
    </body>
    </html>
    <script language="javascript" type="text/javascript">
        function OnJsSearchClick() {
            var kwCtrl = document.getElementById("<%=txt_Search.ClientID %>");
            var kw = kwCtrl.value;
    
            if (kw == "") {
                alert("请输入关键词");
                kwCtrl.focus();
                kwCtrl.select();
                return false;
            }
    
            var goUrl = "<%=preUrl %>" + escape(kw);
    
            window.location.href = goUrl;
        }
    </script>
    
  • 
    using System;
    using System.Collections.Generic;
    
    using SlowX.DAL.Helpers;
    using SlowX.Functions.Functions;
    using SlowX.Common;
    using SlowX.NewsItem.Items;
    using System.Text;
    using SlowX.Core.ICoreClasses;
    using System.Data;
    using System.Reflection;
    using SlowX.Core.Model;
    using SlowX.WebSite.Classes;
    
    // 新闻列表和新闻栏目 //
    public partial class NewsList 
        :
        WebPageBase
    {
        /// <summary>
        /// 
        /// </summary>
        protected string preUrl = "";
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_Search_Click(object sender, EventArgs e)
        {
            
        }
    
        /// <summary>
        /// 
        /// </summary>
        protected NewsSortBasicItem newsSortItem
                  =
                  null;
    
    
        /// <summary>
        /// 
        /// </summary>
        public string filesInfo = "";
    
        /// <summary>
        /// 当前新闻栏目ID
        /// </summary>
        public long curNewSortId = 0;
    
        /// <summary>
        /// 显示图片 
        /// </summary>
        public string newsSortHeadImg = "";
    
        /// <summary>
        /// 内容区导航
        /// </summary>
        public string newsSortNav = "";
    
        /// <summary>
        /// 
        /// </summary>
        protected string CurPageTitle = "";
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newsId"></param>
        /// <param name="xdbHelper"></param>
        protected SlowX.NewsLib.Model.UTB_SLOWX_NEWS
            DataBindNews
            (
                long newsId,
                DBHelper xdbHelper
            )
        {
    
    
            SlowX.NewsLib.Enums.ViewModel.EmViewModel
                EmViewModelValue
                =
                SlowX.NewsLib.Enums.ViewModel.GetDefaultEmByObj
                (
                    Request.QueryString[HttpContextParamName.EmViewModel],
                    SlowX.NewsLib.Enums.ViewModel.EmViewModel.正常
                );
    
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                SlowX.NewsLib.Business.UTB_SLOWX_NEWS bll
                    = SlowX.NewsLib.Business.UTB_SLOWX_NEWS.instance;
    
                SlowX.NewsLib.Entity.UTB_SLOWX_NEWS entity
                    = new SlowX.NewsLib.Entity.UTB_SLOWX_NEWS();
    
                IQueryDriver iq = entity;
    
                UserSessionInfo
                    uInfo
                    =
                    WebSiteBLL.instance.GetUserSessionInfo(xdbHelper);
    
    
                switch (EmViewModelValue)
                {
                    case SlowX.NewsLib.Enums.ViewModel.EmViewModel.管理员预览:
                        if (!WebSiteBLL.instance.IsAdminByUserSessionInfo(uInfo, xdbHelper))
                        {
                            iq.InitIQueryItem
                            (
                                SlowX.Core.Enums.WhereModel.EmWhereModel.显示
                            );
                        }
                        break;
                    case SlowX.NewsLib.Enums.ViewModel.EmViewModel.录入预览:
                        if (uInfo == null)
                        {
                            iq.InitIQueryItem
                            (
                                SlowX.Core.Enums.WhereModel.EmWhereModel.显示
                            );
                        }
                        else
                        {
                            iq.AddIQueryItemWithEntityFieldInfo
                                (
                                    entity._InputUserId,
                                    uInfo.ID
                                );
                        }
    
                        break;
                    case SlowX.NewsLib.Enums.ViewModel.EmViewModel.正常:
                        iq.InitIQueryItem
                            (
                                SlowX.Core.Enums.WhereModel.EmWhereModel.显示
                            );
                        break;
                    default:
                        throw new Exception
                            (
                                "方法:"
                                + MethodBase.GetCurrentMethod().ReflectedType.FullName
                                + " "
                                + MethodBase.GetCurrentMethod().ToString()
                                + " 发生异常:枚举"
                                + EmViewModelValue.GetType().FullName
                                + "."
                                +
                                EmViewModelValue.ToString()
                                + "尚未实现。"
                            );
                }
    
    
                iq.AddIQueryItemWithEntityFieldInfo
                    (
                        entity._ID,
                        newsId
                    );
    
                SlowX.NewsLib.Model.UTB_SLOWX_NEWS model
                    = bll.GetBaseModel(entity, xdbHelper) as SlowX.NewsLib.Model.UTB_SLOWX_NEWS;
    
                if (model == null)
                {
                    if (bIsCreate)
                        xdbHelper.EndDBHelper();
    
                    return null;
                }
    
                SetNewsDetail
                    (
                        SlowX.NewsLib.Enums.ShowTitleInfo.GetEmByInt(model.EmShowTitleInfoValue),
                        model,
                        xdbHelper
                    );
    
                //NewsSortBasicItem newsSortBasicItemValue
                //        = FindNewsSortBasicItem(theList, model.SortId);
    
    
                //string strMetaKeywords = model.MetaKeywords;
                //if (strMetaKeywords == null || strMetaKeywords.Length == 0)
                //{
                //    strMetaKeywords = model.TheName;
                //}
    
                //if (newsSortBasicItemValue != null)
                //{
                //    string sortKeyWords = newsSortBasicItemValue.GetNewsSortKeywords();
    
                //    if (sortKeyWords != null && sortKeyWords.Length > 0)
                //        strMetaKeywords += sortKeyWords;
                //}
    
                //MetaKeywords
                //    =
                //    StringSlowXFunctions.ConvertStringQuot(strMetaKeywords);
    
                //string strMetaDescription = model.MetaDescription;
    
                //if (strMetaDescription == null || strMetaDescription.Length == 0)
                //{
                //    strMetaDescription = model.TheName;
                //}
    
                //MetaDescription = StringSlowXFunctions.ConvertStringQuot(strMetaDescription);
    
                //if (newsSortBasicItemValue != null)
                //{
                //    WebPageTitle
                //        =
                //        StringSlowXFunctions.CutString(model.TheName, 100) + newsSortBasicItemValue.GetNewsSortPageTitle() + WB.WebTitle;
                //}
                //else
                //{
                //    WebPageTitle
                //        =
                //        StringSlowXFunctions.CutString(model.TheName, 100) + "_" + WB.WebTitle;
                //}
    
                //lt_TheName.Text = model.TheName;
                //lt_InsertTime.Text = model.InsertTime.ToString("yyyy-MM-dd HH:mm:ss");
    
                //lt_TheContent.Text = model.TheContent;
    
                //if (model.TheKeywords != null && model.TheKeywords.Length > 0)
                //{
                //    lt_TheKeywords.Text = "关键词:" + model.TheKeywords;
                //}
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
                return model;
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
        }
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="curId"></param>
        /// <param name="newsSortItem"></param>
        /// <param name="xdbHelper"></param>
        protected void DataBindNewsPreNext
            (
                long curId,
                NewsSortBasicItem newsSortItem,
                DBHelper xdbHelper
            )
        {
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                SlowX.NewsLib.Business.UTB_SLOWX_NEWS
                    bll = SlowX.NewsLib.Business.UTB_SLOWX_NEWS.instance;
    
    
                long sortId = newsSortItem.ID;
                DataRow dr = null;
                NewsDetailListBasicItem item = null;
    
    
                SlowX.NewsLib.DataColumnNameInfo.UTB_SLOWX_NEWS
                    nameInfo = SlowX.NewsLib.DataColumnNameInfo.UTB_SLOWX_NEWS.instance;
    
                dr = bll.GetDataRowPre
                    (
                        curId,
                        nameInfo.SortId,
                        sortId,
                        SlowX.Core.Enums.WhereModel.EmWhereModel.显示,
                        xdbHelper
                    );
    
                NewsHrefValueParams nhvp = new NewsHrefValueParams();
    
                nhvp.CssClass = "NewsHrefSTYLE3";
    
                if (dr != null)
                {
                    item = new NewsDetailListBasicItem
                        (
                            dr,
                            newsSortItem, 
                            nhvp
                        );
    
                    lt_PreNews.Text = "<p>上一条:" + item.HrefValue + "</p>";
                }
                else
                {
                    lt_PreNews.Text = "";
                }
    
                dr = bll.GetDataRowNext
                    (
                        curId,
                        nameInfo.SortId,
                        sortId,
                        SlowX.Core.Enums.WhereModel.EmWhereModel.显示,
                        xdbHelper
                    );
    
                if (dr != null)
                {
                    item = new NewsDetailListBasicItem(dr, newsSortItem,
                            nhvp);
    
                    lt_NextNews.Text =
                        "<p>下一条:" + item.HrefValue + "</p>";
    
                }
                else
                {
                    lt_NextNews.Text = "";
                }
    
                if (lt_NextNews.Text.Length == 0
                    && lt_PreNews.Text.Length == 0)
                {
                    pl_PreNext.Visible = false;
                }
                else
                {
                    pl_PreNext.Visible = true;
                }
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
        }
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="curId"></param>
        /// <param name="xdbHelper"></param>
        protected int AddNewsHits(long curId, DBHelper xdbHelper)
        {
            SlowX.NewsLib.DataColumnNameInfo.UTB_SLOWX_NEWS
                nameInfo = SlowX.NewsLib.DataColumnNameInfo.UTB_SLOWX_NEWS.instance;
    
            return SlowX.NewsLib.Business.UTB_SLOWX_NEWS.instance.AddHits
                (
                    curId,
                    nameInfo.Hits,
                    xdbHelper
                );
        }
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="theValue"></param>
        /// <returns></returns>
        protected string ToGenderStr(int theValue)
        {
            return ZJL.LabLib.Enums.Gender.GetDefaultEmByInt(theValue).ToString();
        }
    
        protected string ToJxLbStr(long theValue,DBHelper xdbHelper)
        {
            ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_JXLB
                bll
                =
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_JXLB.instance;
    
            object obj = bll.CacheGetValueByStrId(theValue.ToString(), "TheName", false, xdbHelper);
    
            if (obj == null)
                return "";
    
            return obj.ToString();
        }
    
    
        protected string ToJxDjStr(long theValue, DBHelper xdbHelper)
        {
            ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_JXDJ
                bll
                =
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_JXDJ.instance;
    
            object obj = bll.CacheGetValueByStrId(theValue.ToString(), "TheName", false, xdbHelper);
    
            if (obj == null)
                return "";
    
            return obj.ToString();
        }
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        protected string ToBirthDay(DateTime? dt)
        {
            if (dt == null)
                return "";
    
            return dt.Value.ToString("yyyy.MM");
        }
    
        /// <summary>
        /// 获得人员名单
        /// </summary>
        /// <param name="xdbHelper"></param>
        /// <returns></returns>
        protected string ToRYMD(DBHelper xdbHelper)
        {
            StringBuilder theResult = new StringBuilder();
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_RYMD
                    bll 
                    = 
                    ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_RYMD.instance;
    
                ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_RYMD
                    entity
                    =
                    new ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_RYMD();
    
                IOrderByDriver iorder = entity;
    
                iorder.AddOrderAsc(entity._ShowSeq);
                iorder.AddOrderAsc(entity._TheName);
                iorder.AddOrderAsc(entity._ID);
    
                List<ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_RYMD>
                    theList = bll.ListCurModel(entity, xdbHelper);
    
                theResult.AppendLine("<table class=\"DL\">");
                theResult.AppendLine("<tr class=\"DL\">");
                theResult.Append("<th class=\"DL\">序号</th>");
                theResult.Append("<th class=\"DL\">姓名</th>");
                theResult.Append("<th class=\"DL\">性别</th>");
                theResult.Append("<th class=\"DL\">出生日期</th>");
                theResult.Append("<th class=\"DL\">职务</th>");
                theResult.Append("<th class=\"DL\">职称</th>");
                theResult.Append("<th class=\"DL\">所学专业</th>");
                theResult.Append("<th class=\"DL\">工作性质</th>");
                theResult.AppendLine("</tr>");
    
                bool bClassFlag = true;
                string className = null;
                int idx = 0;
                foreach (ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_RYMD
                    model in theList)
                {
                    bClassFlag = !bClassFlag;
    
                    if (bClassFlag)
                        className = "DL";
                    else
                        className = "DLA";
    
                    ++idx;
                    theResult.AppendLine("<tr class=\"DL\">");
                    theResult.Append("<td class=\"" + className + "\">" +idx.ToString() + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheName + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + ToGenderStr(model.EmGenderV ) + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + ToBirthDay(model.Birth_Day) + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.ZW + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.ZC + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.SXZY + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.GZXZ + "</td>");
                    theResult.AppendLine("</tr>");
                }
    
                theResult.AppendLine("</table>");
                
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            return theResult.ToString();
        }
    
    
        /// <summary>
        /// 获得奖项
        /// </summary>
        /// <param name="xdbHelper"></param>
        /// <returns></returns>
        protected string ToJX(DBHelper xdbHelper)
        {
            string kw = Request.QueryString["kw"];
    
            if (kw != null)
            {
                kw = kw.Trim();
                kw = Server.UrlDecode(kw);
            }
    
            StringBuilder theResult = new StringBuilder();
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_JX
                    bll
                    =
                    ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_JX.instance;
    
                ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_JX
                    entity
                    =
                    new ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_JX();
    
                IOrderByDriver iorder = entity;
                IQueryDriver iq = entity;
    
                iorder.AddOrderDesc(entity._ItemSeq);
                iorder.AddOrderDesc(entity._HJNF);
                iorder.AddOrderAsc(entity._TheName);
                iorder.AddOrderAsc(entity._ID);
    
                iq.InitIQueryItemWithShow();
    
                if (kw != null && kw.Length > 0)
                {
                    iq.AddIQueryItemAdvSearch(entity._TheName._Name, kw.ToLower());
                }
    
                List<ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_JX>
                    theList = bll.ListCurModel(entity, xdbHelper);
                			
                theResult.AppendLine("<table class=\"DL\">");
                theResult.AppendLine("<tr class=\"DL\">");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\">序号</th>");
                theResult.Append("<th class=\"DL\">成果名称</th>");
                theResult.Append("<th class=\"DL\">获奖类别</th>");
                theResult.Append("<th class=\"DL\" style=\"width:80px;\">等级</th>");
                theResult.Append("<th class=\"DL\">完成人及排序</th>");
                theResult.Append("<th class=\"DL\" style=\"width:85px;\">获奖年份</th>");
                theResult.AppendLine("</tr>");
    
                bool bClassFlag = true;
                string className = null;
                int idx = 0;
                foreach (ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_JX
                    model in theList)
                {
                    bClassFlag = !bClassFlag;
    
                    if (bClassFlag)
                        className = "DL";
                    else
                        className = "DLA";
    
                    ++idx;
                    theResult.AppendLine("<tr class=\"DL\">");
                    theResult.Append("<td class=\"" + className + "\">" + idx.ToString() + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheName + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + ToJxLbStr(model.JXLB_Id,xdbHelper) + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + ToJxDjStr(model.JXDJ_Id,xdbHelper) + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.WCRJPX + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.HJNF.ToString() + "</td>");
                    theResult.AppendLine("</tr>");
                }
    
                theResult.AppendLine("</table>");
    
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            return theResult.ToString();
        }
    
    
        /// <summary>
        /// 获得专著
        /// </summary>
        /// <param name="xdbHelper"></param>
        /// <returns></returns>
        protected string ToZZ(DBHelper xdbHelper)
        {
            string kw = Request.QueryString["kw"];
    
            if (kw != null)
            {
                kw = kw.Trim();
                kw = Server.UrlDecode(kw);
            }
    
            StringBuilder theResult = new StringBuilder();
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_ZZ
                    bll
                    =
                    ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_ZZ.instance;
    
                ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_ZZ
                    entity
                    =
                    new ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_ZZ();
    
                IOrderByDriver iorder = entity;
                IQueryDriver iq = entity;
    
                iorder.AddOrderDesc(entity._ItemSeq);
                iorder.AddOrderDesc(entity._CBRQ);
                iorder.AddOrderAsc(entity._TheName);
                iorder.AddOrderAsc(entity._ID);
    
                iq.InitIQueryItemWithShow();
    
                if (kw != null && kw.Length > 0)
                {
                    iq.AddIQueryItemAdvSearch(entity._TheName._Name, kw.ToLower());
                }
    
                List<ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_ZZ>
                    theList = bll.ListCurModel(entity, xdbHelper);
    
                			
    
                theResult.AppendLine("<table class=\"DL\">");
                theResult.AppendLine("<tr class=\"DL\">");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\">序号</th>");
                theResult.Append("<th class=\"DL\">著作名称</th>");
                theResult.Append("<th class=\"DL\">作者</th>");
                theResult.Append("<th class=\"DL\" style=\"min-width:80px;\">出版单位</th>");
                theResult.Append("<th class=\"DL\" style=\"min-width:85px;\">出版日期</th>");
                theResult.AppendLine("</tr>");
    
                bool bClassFlag = true;
                string className = null;
                int idx = 0;
                foreach (ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_ZZ
                    model in theList)
                {
                    bClassFlag = !bClassFlag;
    
                    if (bClassFlag)
                        className = "DL";
                    else
                        className = "DLA";
    
                    ++idx;
                    theResult.AppendLine("<tr class=\"DL\">");
                    theResult.Append("<td class=\"" + className + "\">" + idx.ToString() + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheName + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheAuthor + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.CBDW + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.CBRQ + "</td>");
                    theResult.AppendLine("</tr>");
                }
    
                theResult.AppendLine("</table>");
    
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            return theResult.ToString();
        }
    
    
        /// <summary>
        /// 获得专利
        /// </summary>
        /// <param name="xdbHelper"></param>
        /// <returns></returns>
        protected string ToZL(DBHelper xdbHelper)
        {
            string kw = Request.QueryString["kw"];
    
            if (kw != null)
            {
                kw = kw.Trim();
                kw = Server.UrlDecode(kw);
            }
    
            StringBuilder theResult = new StringBuilder();
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_ZL
                    bll
                    =
                    ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_ZL.instance;
    
                ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_ZL
                    entity
                    =
                    new ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_ZL();
    
                IOrderByDriver iorder = entity;
                IQueryDriver iq = entity;
    
                iorder.AddOrderDesc(entity._ItemSeq);
                iorder.AddOrderDesc(entity._SQRQ);
                iorder.AddOrderAsc(entity._TheName);
                iorder.AddOrderAsc(entity._ID);
    
                iq.InitIQueryItemWithShow();
    
                if (kw != null && kw.Length > 0)
                {
                    iq.AddIQueryItemAdvSearch(entity._TheName._Name, kw.ToLower());
                }
    
                List<ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_ZL>
                    theList = bll.ListCurModel(entity, xdbHelper);
    
                			
    
    
                theResult.AppendLine("<table class=\"DL\">");
                theResult.AppendLine("<tr class=\"DL\">");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\">序号</th>");
                theResult.Append("<th class=\"DL\">专利名称</th>");
                theResult.Append("<th class=\"DL\">专利号</th>");
                theResult.Append("<th class=\"DL\" style=\"min-width:80px;\">授权日期</th>");
                theResult.Append("<th class=\"DL\" style=\"min-width:85px;\">发明人</th>");
                theResult.AppendLine("</tr>");
    
                bool bClassFlag = true;
                string className = null;
                int idx = 0;
                foreach (ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_ZL
                    model in theList)
                {
                    bClassFlag = !bClassFlag;
    
                    if (bClassFlag)
                        className = "DL";
                    else
                        className = "DLA";
    
                    ++idx;
                    theResult.AppendLine("<tr class=\"DL\">");
                    theResult.Append("<td class=\"" + className + "\">" + idx.ToString() + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheName + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheCode + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.SQRQ + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.FMR + "</td>");
                    theResult.AppendLine("</tr>");
                }
    
                theResult.AppendLine("</table>");
    
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            return theResult.ToString();
        }
    
    
        /// <summary>
        /// 获得专著
        /// </summary>
        /// <param name="xdbHelper"></param>
        /// <returns></returns>
        protected string ToLW(DBHelper xdbHelper)
        {
            string kw = Request.QueryString["kw"];
    
            if (kw != null)
            {
                kw = kw.Trim();
                kw = Server.UrlDecode(kw);
            }
    
            StringBuilder theResult = new StringBuilder();
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_LW
                    bll
                    =
                    ZJL.LabLib.Business.LAB.UTB_ZJL_LAB_LW.instance;
    
                ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_LW
                    entity
                    =
                    new ZJL.LabLib.Entity.LAB.UTB_ZJL_LAB_LW();
    
                IOrderByDriver iorder = entity;
                IQueryDriver iq = entity;
    
                iorder.AddOrderDesc(entity._ItemSeq); 
                iorder.AddOrderAsc(entity._TheName);
                iorder.AddOrderAsc(entity._ID);
    
                iq.InitIQueryItemWithShow();
    
                if (kw != null && kw.Length > 0)
                {
                    iq.AddIQueryItemAdvSearch(entity._TheName._Name, kw.ToLower());
                }
    
                List<ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_LW>
                    theList = bll.ListCurModel(entity, xdbHelper);
    
    
    
                						
    
                theResult.AppendLine("<table class=\"DL\">");
                theResult.AppendLine("<tr class=\"DL\">");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\">序号</th>");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\">论文<br />名称</th>");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\">刊物<br />名称</th>");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\" >论文所<br />在期刊<br />的卷、<br />期、页</th>");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\" >论文收<br />录类型</th>");
                theResult.Append("<th class=\"DL\"  style=\"width:40px;\">是否为<br />1区论文</th>");
                theResult.Append("<th class=\"DL\"  style=\"width:40px;\">论文<br />作者</th>");
                theResult.Append("<th class=\"DL\" style=\"width:40px;\" >通讯<br />作者</th>");
    
                theResult.AppendLine("</tr>");
    
                bool bClassFlag = true;
                string className = null;
                int idx = 0;
                foreach (ZJL.LabLib.Model.LAB.UTB_ZJL_LAB_LW
                    model in theList)
                {
                    bClassFlag = !bClassFlag;
    
                    if (bClassFlag)
                        className = "DL";
                    else
                        className = "DLA";
    
                    ++idx;
                    theResult.AppendLine("<tr class=\"DL\">");
                    theResult.Append("<td class=\"" + className + "\">" + idx.ToString() + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TheName + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.KWMC + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.SZQK + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.LWSLLX + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.YQLW + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.LWZZ + "</td>");
                    theResult.Append("<td class=\"" + className + "\">" + model.TXZZ + "</td>");
                    theResult.AppendLine("</tr>");
                }
    
                theResult.AppendLine("</table>");
    
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            return theResult.ToString();
        }
    
        /// <summary>
        /// 
        /// </summary>
        /// <param name="emShowTitleInfoValue"></param>
        /// <param name="newsModel"></param>
        /// <param name="xdbHelper"></param>
        protected void SetNewsDetail
            (
                SlowX.NewsLib.Enums.ShowTitleInfo.EmShowTitleInfo emShowTitleInfoValue,
                SlowX.NewsLib.Model.UTB_SLOWX_NEWS model,
                DBHelper xdbHelper
            )
        {
            
    
            if (model.DetailTitle == null || model.DetailTitle.Length == 0)
            {
                lt_Title.Text = "<h2 class=\"news_title\">" + model.TheName + "</h2>";
            }
            else
            {
                lt_Title.Text = model.DetailTitle;
            }
    
            if (model.Author != null && model.Author.Length > 0)
                lt_Author.Text = "来源:" + model.Author;
            else
                lt_Author.Text = "来源:不详";
    
            lt_Hits.Text = model.Hits.ToString();
    
            lt_InsertTime.Text = model.InsertTime.ToString("yyyy-MM-dd HH:mm:ss");
    
            StringBuilder sbContext = new StringBuilder();
    
            string videoText = "";
    
            // 视频 //
            if (model.VideoUrl != null && model.VideoUrl.Length > 0)
            {
                string strVideoWidth = "600px";
    
                if (model.VideoWidth != null && model.VideoWidth != 0)
                {
                    if (model.VideoWidth > 0)
                        strVideoWidth = model.VideoWidth.ToString() + "px";
                    else
                        strVideoWidth = (-model.VideoWidth).ToString() + "%";
                }
    
                string strVideoHeight = "400px";
    
                if (model.VideoHeight != null && model.VideoHeight != 0)
                {
                    if (model.VideoHeight > 0)
                        strVideoHeight = model.VideoHeight.ToString() + "px";
                    else
                        strVideoHeight = (-model.VideoHeight).ToString() + "%";
                }
    
                SlowX.NewsLib.Enums.VideoShowInText.EmVideoShowInText
                    EmVideoShowInTextValue
                    =
                     SlowX.NewsLib.Enums.VideoShowInText.GetEmByInt(model.EmVideoShowInTextValue);
    
                if (EmVideoShowInTextValue != SlowX.NewsLib.Enums.VideoShowInText.EmVideoShowInText.不显示)
                {
                    string videoUrl = DBH.ConvertStrUrl(model.VideoUrl);
    
                    string pAlign = "center";
    
                    switch (EmVideoShowInTextValue)
                    {
                        case SlowX.NewsLib.Enums.VideoShowInText.EmVideoShowInText.内容顶端右边显示:
                            pAlign = "right";
                            break;
                        case SlowX.NewsLib.Enums.VideoShowInText.EmVideoShowInText.内容顶端左边显示:
                            pAlign = "left";
                            break;
                        default:
                            pAlign = "center";
                            break;
                    }
    
                    SlowX.NewsLib.Enums.VideoType.EmVideoType
                        EmVideoTypeValue = SlowX.NewsLib.Enums.VideoType.GetEmByInt(model.EmVideoTypeValue);
    
                    switch (EmVideoTypeValue)
                    {
                        case SlowX.NewsLib.Enums.VideoType.EmVideoType.Flash:
                            videoText = @"<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0""  width=""" + strVideoWidth + @""" height=""" + strVideoHeight + @""" >
    <param name=""movie"" value=""" + videoUrl + @""" />
    <param name=""wmode"" value=""opaque"">
    <param name=""quality"" value=""high"" />
    <embed src=""" + videoUrl + @""" quality=""high"" pluginspage=""http://www.macromedia.com/go/getflashplayer"" type=""application/x-shockwave-flash""  width=""" + strVideoWidth + @""" height=""" + strVideoHeight + @""" ></embed>
    </object>";
                            break;
                        case SlowX.NewsLib.Enums.VideoType.EmVideoType.avi:
    
    
                            videoText = @"<object  width=""" + strVideoWidth + @""" height=""" + strVideoHeight + @""" border=""0"" classid=""clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA""> 
    <param name=""ShowDisplay"" value=""0""> 
    <param name=""ShowControls"" value=""1""> 
    <param name=""AutoStart"" value=""1""> 
    <param name=""AutoRewind"" value=""0""> 
    <param name=""PlayCount"" value=""0""> 
    <param name=""Appearance value=""0 value=""""""> 
    <param name=""BorderStyle value=""0 value=""""""> 
    <param name=""MovieWindowHeight"" value=""" + strVideoHeight + @"""> 
    <param name=""MovieWindowWidth"" value=""" + strVideoWidth + @"""> 
    <param name=""FileName"" value=""" + videoUrl + @"""> 
    <embed width=""" + strVideoWidth + @""" height=""" + strVideoHeight + @""" border=""0"" showdisplay=""0"" showcontrols=""1"" autostart=""1"" autorewind=""0"" playcount=""0"" moviewindowheight=""" + strVideoHeight + @""" moviewindowwidth=""" + strVideoWidth + @""" filename=""" + videoUrl + @""" src=""" + videoUrl + @"""> 
    </embed> 
    </object> ";
                            break;
                    }
    
                    videoText
                        =
                        "<p style=\"text-align:" + pAlign + ";\">" + videoText + "</p><br />";
    
                    sbContext.Append(videoText);
                }
    
            }
    
            string imageText = "";
    
            if (model.ImageUrl != null && model.ImageUrl.Length > 0)
            {
                string strImgWidth = "600px";
    
                if (model.ImageWidth != null && model.ImageWidth != 0)
                {
                    if (model.ImageWidth > 0)
                        strImgWidth = model.ImageWidth.ToString() + "px";
                    else
                        strImgWidth = (-model.ImageWidth).ToString() + "%";
                }
    
                string strImgHeight = "400px";
    
                if (model.ImageHeight != null && model.ImageHeight != 0)
                {
                    if (model.ImageHeight > 0)
                        strImgHeight = model.ImageHeight.ToString() + "px";
                    else
                        strImgHeight = (-model.ImageHeight).ToString() + "%";
                }
    
                SlowX.NewsLib.Enums.ImageShowInText.EmImageShowInText
                    EmImageShowInTextValue
                    =
                     SlowX.NewsLib.Enums.ImageShowInText.GetEmByInt(model.EmImageShowInTextValue);
    
                if (EmImageShowInTextValue != SlowX.NewsLib.Enums.ImageShowInText.EmImageShowInText.不显示)
                {
                    string imgUrl = DBH.ConvertStrUrl(model.ImageUrl);
    
                    string pAlign = "center";
    
                    switch (EmImageShowInTextValue)
                    {
                        case SlowX.NewsLib.Enums.ImageShowInText.EmImageShowInText.内容顶端右边显示:
                            pAlign = "right";
                            break;
                        case SlowX.NewsLib.Enums.ImageShowInText.EmImageShowInText.内容顶端左边显示:
                            pAlign = "left";
                            break;
                        default:
                            pAlign = "center";
                            break;
                    }
    
                    imageText
                        =
                        "<p style=\"text-align:" + pAlign + ";\"><a href=\"" + imgUrl + "\" target=\"_blank\"><img src=\"" + imgUrl + "\" alt=\"\" border=\"0\" style=\"border:0px;width:" + strImgWidth + ";height:" + strImgHeight + ";\" /></a></p><br />";
    
                    sbContext.Append(imageText);
                }
    
            }
    
            if (model.TheContentNumber == 1)
            {
                detailAspNetPager.Visible = false;
                pl_DetailThree.Visible = false;
    
                string newsTheContent = model.TheContent;
    
                if (newsTheContent != null  )
                {
                    string strCT = null;
                    if (newsTheContent.Contains("{$db.rymd}"))
                    {
                        // 转义人员名单 //
                        strCT = ToRYMD(xdbHelper);
    
                        newsTheContent = newsTheContent.Replace("{$db.rymd}", strCT);
                    }
    
                    if (newsTheContent.Contains("{$db.jx}"))
                    {
                        // 转义奖项 //
                        strCT = ToJX(xdbHelper);
    
                        newsTheContent = newsTheContent.Replace("{$db.jx}", strCT);
                    }
    
                    if (newsTheContent.Contains("{$db.zz}"))
                    {
                        // 转义专著 //
                        strCT = ToZZ(xdbHelper);
    
                        newsTheContent = newsTheContent.Replace("{$db.zz}", strCT);
                    }
    
                    if (newsTheContent.Contains("{$db.zl}"))
                    {
                        // 转义专著 //
                        strCT = ToZL(xdbHelper);
    
                        newsTheContent = newsTheContent.Replace("{$db.zl}", strCT);
                    }
    
    
                    if (newsTheContent.Contains("{$db.lw}"))
                    {
                        // 转义论文 //
                        strCT = ToLW(xdbHelper);
    
                        newsTheContent = newsTheContent.Replace("{$db.lw}", strCT);
                    }
    
                }
    
                sbContext.Append(newsTheContent);
            }
            else
            {
                pl_DetailThree.Visible = true;
                detailAspNetPager.RecordCount = model.TheContentNumber;
    
                int pageindex
                    =
                    HttpContextSlowXFunctions.GetIntParameter(detailAspNetPager.UrlPageIndexName, 1) - 1;
    
                detailAspNetPager.Visible = true;
    
                if (pageindex == 0)
                {
                    sbContext.Append(model.TheContent);
                }
                else
                {
                    sbContext.Append(WebSiteBLL.instance.GetNewsContent(model.ID, pageindex, xdbHelper));
                }
            }
    
            // 获得文件URL //
            if (model.FileUrl != null && model.FileUrl.Length > 0)
            {
                // 下载文件信息 //
                filesInfo = GetNewsFiles(model.ID, xdbHelper);
    
                if (filesInfo.Length > 0)
                {
                    pl_DetailFour.Visible = true;
                }
                else
                {
                    pl_DetailFour.Visible = false;
                }
            }
    
            lt_TheContent.Text
                =
                sbContext.ToString();
    
    
            switch (emShowTitleInfoValue)
            {
                case SlowX.NewsLib.Enums.ShowTitleInfo.EmShowTitleInfo.显示:
                    lt_Title.Visible = true;
                    pl_contentBar.Visible = true;
                    break;
                case SlowX.NewsLib.Enums.ShowTitleInfo.EmShowTitleInfo.不显示:
                    lt_Title.Visible = false;
                    pl_contentBar.Visible = false;
                    break;
                default:
                    throw new Exception
                        (
                            "方法:"
                            + MethodBase.GetCurrentMethod().ReflectedType.FullName
                            + " "
                            + MethodBase.GetCurrentMethod().ToString()
                            + " 发生异常:枚举"
                            + emShowTitleInfoValue.GetType().FullName
                            + "."
                            + emShowTitleInfoValue.ToString()
                            + "尚未实现。"
                        );
            }
    
            pl_Detail.Visible = lt_Title.Visible;
    
            // 更新点击率 //
            AddNewsHits(model.ID, xdbHelper);
        }
    
        /// <summary>
        /// 获得下载文件信息
        /// </summary>
        /// <param name="newsId"></param>
        /// <param name="xdbHelper"></param>
        /// <returns></returns>
        protected string GetNewsFiles
            (
                long newsId,
                DBHelper xdbHelper
            )
        {
            StringBuilder theResult = null;
    
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                SlowX.NewsLib.Business.UTB_SLOWX_NEWS_FILE
                    bll = SlowX.NewsLib.Business.UTB_SLOWX_NEWS_FILE.instance;
    
                SlowX.NewsLib.Entity.UTB_SLOWX_NEWS_FILE
                    entity = new SlowX.NewsLib.Entity.UTB_SLOWX_NEWS_FILE();
    
                IQueryDriver iq = entity;
                IOrderByDriver iorder = entity;
    
                iq.AddIQueryItemWithEntityFieldInfo
                    (
                        entity._NewsId,
                        newsId
                    );
    
                iq.AddIQueryItemWithEntityFieldInfoByBoolean
                    (
                        entity._IsShow,
                        true
                    );
    
                iorder.AddOrderByEm(entity._ShowSeq, SlowX.Core.Enums.OrderBy.EmOrderBy.ASC);
                iorder.AddOrderByEm(entity._ID, SlowX.Core.Enums.OrderBy.EmOrderBy.ASC);
    
                List<BaseModel> theList = bll.ListBaseModel(entity, xdbHelper);
    
    
                if (theList != null && theList.Count > 0)
                {
                    theResult = new StringBuilder();
                    string fileUrl = null;
    
                    foreach (SlowX.NewsLib.Model.UTB_SLOWX_NEWS_FILE
                        model in theList)
                    {
                        if (model.FileUrl == null || model.FileUrl.Length == 0)
                            continue;
    
                        fileUrl = DBH.ConvertStrUrl(model.FileUrl);
                        theResult.Append("<a href=\"" + fileUrl + "\" target=\"_blank\" title=\"" + DBH.ConvertStr(model.TheName) + "\">" + model.TheName + "</a><br />");
                    }
                }
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                return "系统异常:" + err.Message;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            string returnResult = "";
    
            if (theResult != null)
            {
                returnResult = theResult.ToString();
            }
    
            if (returnResult.Length == 0)
                return "";
    
            return "<p class=\"contentText\"><b>相关附件:</b><br />" + returnResult + "</p>";
        }
    
        /// <summary>
        /// 绑定控件
        /// </summary>
        /// <param name="xdbHelper"></param>
        protected string DataBindTheControls
            (
                DBHelper xdbHelper
            )
        {
            string searchSortId = "";
    
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
              
                NewsSortBasicItem mainNewsSort = null;
    
                WebSiteBLL wi = WebSiteBLL.instance;
                 
    
                // 获得新闻ID //
                long newsId
                    =
                    HttpContextSlowXFunctions.GetLongParameter(DataColumnName.ID);
    
                SlowX.NewsLib.Model.UTB_SLOWX_NEWS newsModel = null;
    
                // 绑定新闻 //
                if (newsId != 0)
                {
                    // 获得新闻纪录 //
                    newsModel = DataBindNews(newsId, xdbHelper);
    
                    if (newsModel == null)
                    {
                        if (bIsCreate)
                            xdbHelper.EndDBHelper();
    
                        return "没有获得" + wi.GetNewsTitle();
                    }
    
                    newsSortItem = wi.GetNewsSortBasicItem
                        (
                            newsModel.SortId, 
                            xdbHelper
                        );
    
                    
    
                }
                else
                {
                    // 获得栏目ID //
                    long sortId
                        =
                        HttpContextSlowXFunctions.GetLongParameter(DataColumnName.SortId);
    
                    if (sortId != 0)
                    {
                        newsSortItem
                            =
                            wi.GetNewsSortBasicItem
                            (
                                sortId, 
                                xdbHelper
                            );
                    }
                    else
                    {
                        string theCode 
                            = 
                            HttpContextSlowXFunctions.GetParameter(DataColumnName.TheCode);
    
                        if (theCode.Length != 0)
                        {
                            newsSortItem = wi.GetNewsSortBasicItem
                                (
                                    theCode, 
                                    xdbHelper
                                );
                        }
                    }
    
    
                }
    
                if (newsSortItem == null)
                {
                    if (bIsCreate)
                        xdbHelper.EndDBHelper();
    
                    return "没有获得" + wi.GetNewsTitle() + "栏目";
                }
    
                // 
                curNewSortId = newsSortItem.ID;
    
                // 
                List<NewsSortBasicItem> listNewsSort
                    =
                    newsSortItem._ListNewsSortBasicItem;
    
                // 
                mainNewsSort
                    =
                    newsSortItem;
    
                if (listNewsSort == null || listNewsSort.Count == 0)
                {
                    if (newsSortItem._parent == null)
                    {
                        // 顶层 //
                        listNewsSort =
                            wi.GetListNewsSortBasicItem(xdbHelper);
                        // new List<NewsSortBasicItem>();
    
                    }
                    else
                    {
    
                        mainNewsSort = newsSortItem._parent;
    
                        listNewsSort
                            =
                            mainNewsSort._ListNewsSortBasicItem;
    
                    }
                }
    
                // 绑定左边导航 //
                rp_Nav.DataSource = listNewsSort;
                rp_Nav.DataBind();
    
               
    
                StringBuilder sbNav = new StringBuilder();
    
                NewsSortBasicItem itemNav = newsSortItem;
                string strNav = "";
    
                while (itemNav != null)
                {
                    strNav = HtmlSlowXFunctions.GetHref
                        (
                            itemNav.ListUrl,
                            itemNav.TheName,
                            itemNav.TheName,
                            "",
                            "NewsHrefSTYLE3"
                        );
    
                    sbNav.Insert(0, "&nbsp;&nbsp;&gt;&nbsp;&nbsp;" + strNav);
    
                    itemNav = itemNav._parent;
                }
    
                if (newsModel != null)
                {
                    sbNav.Append("&nbsp;&nbsp;&gt;&nbsp;&nbsp;" +
                        HtmlSlowXFunctions.GetHref(strCurUrl, "内容", newsModel.TheName, "", "NewsHrefSTYLE3")
                        );
                }
    
                newsSortNav = sbNav.ToString();
    
    
                if (newsModel != null)
                {
                    // 显示新闻 //
                    this.pl_Detail.Visible = true;
                    this.pl_DetailTwo.Visible = true;
                    this.pl_List.Visible = false;
    
                    SetWebPageTitle
                        (
                            DBH.CutStr(newsModel.TheName, 20) + "__" + newsSortItem.TheName
                        );
    
                    DataBindNewsPreNext
                        (
                            newsModel.ID,
                            newsSortItem,
                            xdbHelper
                        );
    
                    CurPageTitle = "新闻详情";
                }
                else
                {
                    // 绑定新闻列表 //
                    DataBindList(newsSortItem, xdbHelper);
    
                    SetWebPageTitle(newsSortItem.TheName);
    
                    CurPageTitle = newsSortItem.TheName;
                }
    
                if (searchSortId == null || searchSortId.Length == 0)
                    searchSortId = curNewSortId.ToString();
    
                preUrl = strPhyPath + "/newslist.aspx?sortid=" + searchSortId + "&kw=";
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                return "系统异常:" + err.Message;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
            return "";
        }
    
        /// <summary>
        /// 绑定新闻列表 
        /// </summary>
        /// <param name="newsUrlParamsValue"></param>
        /// <param name="xdbHelper"></param>
        protected void DataBindList
            (
                NewsSortBasicItem newsSortItem,
                DBHelper xdbHelper
            )
        {
            string kw = Request.QueryString["kw"];
    
            if (kw != null)
            {
                kw = kw.Trim();
                kw = Server.UrlDecode(kw);
            }
    
            txt_Search.Text = kw;
    
            WebSiteBLL wi = WebSiteBLL.instance;
            
    
            bool bIsCreate = true;
    
            if (xdbHelper == null)
            {
                xdbHelper = SlowX.DAL.Helpers.DBHelper.CreateDBHelper();
            }
            else
            {
                // 没有打开链接 //
                bIsCreate = xdbHelper.IsNotOpen();
            }
    
            try
            {
                if (bIsCreate)
                    xdbHelper.OpenDBHelper();
    
                int iPageIndex
                    =
                    HttpContextSlowXFunctions.GetIntParameter(mainAspNetPager.UrlPageIndexName, 1) - 1; // mainAspNetPager.CurrentPageIndex - 1;
    
                int iPageSize = mainAspNetPager.PageSize;
    
                if (iPageSize == 0)
                    iPageSize = int.MaxValue;
    
                int iRowCount = -1;
    
                NewsHrefValueParams nhvp = new NewsHrefValueParams();
                nhvp.CutSize = 92;
                nhvp.CssClass = "LiNewsHref";
                nhvp.KeyWord = kw;
    
                SlowX.NewsLib.Enums.NewsSortType.EmNewsSortType
                    EmNewsSortTypeValue
                    =
                     SlowX.NewsLib.Enums.NewsSortType.GetEmByInt(newsSortItem.EmNewsSortTypeValue);
    
                string strKw = kw;
                if(EmNewsSortTypeValue == SlowX.NewsLib.Enums.NewsSortType.EmNewsSortType.单条){
                    strKw = "";
                }
    
                List<NewsDetailListBasicItem> theList
                    =
                    wi.PageListNewsDetailListBasicItem
                      (
                          nhvp,
                          newsSortItem,
                          strKw,
                          false,
                          true,
                          true,
                          iPageIndex,
                          iPageSize,
                          ref iRowCount,
                          xdbHelper
                      );
    
                bool showDetail = false;
    
                if (iRowCount == 1 && iPageIndex == 0 
                    && theList != null && theList.Count == 1)
                {
                    switch (EmNewsSortTypeValue)
                    {
                        case SlowX.NewsLib.Enums.NewsSortType.EmNewsSortType.单条:
                        case SlowX.NewsLib.Enums.NewsSortType.EmNewsSortType.单条显示内容:
                            showDetail = true;
                            break;
                        default:
                            showDetail = false;
                            break;
                    }
                }
    
                if (showDetail)
                {
    
                    // 一条记录,显示内容 //
                    SlowX.NewsLib.Model.UTB_SLOWX_NEWS
                        model
                        =
                        SlowX.NewsLib.Business.UTB_SLOWX_NEWS.instance.GetCurModel(theList[0].ID, xdbHelper);
    
    
                    this.pl_Detail.Visible = true;
                    this.pl_DetailTwo.Visible = true;
                    this.pl_List.Visible = false;
    
                    SetNewsDetail
                        (
                            SlowX.NewsLib.Enums.ShowTitleInfo.GetEmByInt(model.EmShowTitleInfoValue),
                            model,
                            xdbHelper
                        );
    
                }
                else
                {
                    this.pl_Detail.Visible = false;
                    this.pl_DetailTwo.Visible = false;
                    this.pl_List.Visible = true;
    
                    rp_List.DataSource = theList;
                    rp_List.DataBind();
    
                    mainAspNetPager.RecordCount = iRowCount;
    
                    if (iPageSize == int.MaxValue || iPageSize == 0 || (iPageIndex == 0 && iPageSize >= iRowCount))
                    {
                        mainAspNetPager.CustomInfoHTML
                            = "第" + (iPageIndex + 1).ToString() + "/" + mainAspNetPager.PageCount.ToString() + "页&nbsp;共" + mainAspNetPager.RecordCount.ToString() + "条记录";
                    }
                    else
                    {
                        mainAspNetPager.CustomInfoHTML
                            = "第" + (iPageIndex + 1).ToString() + "/" + mainAspNetPager.PageCount.ToString() + "页&nbsp;共" + mainAspNetPager.RecordCount.ToString() + "条记录,每页" + iPageSize.ToString() + "条";
                    }
                }
    
                if (bIsCreate)
                    xdbHelper.EndDBHelper();
    
            }
            catch (Exception err)
            {
                if (bIsCreate)
                    xdbHelper.TranDBHelper();
    
                throw err;
            }
            finally
            {
                if (bIsCreate)
                    xdbHelper.FinallyDBHelper();
            }
    
    
        }
    
    
        /// <summary>
        /// 页面加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
    
            if (!this.IsPostBack)
            {
                // 数据绑定 //
                string str = DataBindTheControls(null);
    
                if (str != null && str.Length > 0)
                {
                    Response.Redirect(strPhyPath + "/error.aspx?msg=" + Server.UrlEncode(str));
                }
    
            }
        }
    }
    
    
    

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)