BBSNews.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:3k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections.Generic;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. public partial class BBS_BBSNews : System.Web.UI.Page
  12. {
  13.     Model.BBS MR = new Model.BBS();
  14.     BLL.BBS BR = new BLL.BBS();
  15.     public string ContentStr = "";
  16.     /// <summary>
  17.     /// 查询条件
  18.     /// </summary>
  19.     public string TiaoJian
  20.     {
  21.         get
  22.         {
  23.             if (ViewState["BBS_BBSNewsTiaoJian"] == null)
  24.             {
  25.                 return "";
  26.             }
  27.             else
  28.             {
  29.                 return ViewState["BBS_BBSNewsTiaoJian"].ToString();
  30.             }
  31.         }
  32.         set { ViewState["BBS_BBSNewsTiaoJian"] = value; }
  33.     }
  34.     protected void Page_Load(object sender, EventArgs e)
  35.     {
  36.         LoginLogic.MatchLoad("../", "BBS_BBSNews");
  37.         if (!IsPostBack)
  38.         {
  39.         if (Request.QueryString["type"] != null)
  40.         {
  41.             TiaoJian = "FL='" + Request.QueryString["type"].ToString() + "'";
  42.             MyDataBind(1);
  43.         }
  44.         else
  45.         {
  46.             
  47.                 TiaoJian = "";
  48.                 MyDataBind(1);
  49.            
  50.         }
  51.         }
  52.     }
  53.     public void GetList(List<Model.BBS> LRData)
  54.     {
  55.         ContentStr = "";
  56.         foreach (Model.BBS LR in LRData)
  57.         {
  58.             ContentStr += @"
  59.                         <tr class=""usertablerow2"">
  60.                             <td nowrap=""nowrap"">
  61.                                 </td>
  62.                             <td nowrap=""nowrap"" align=""center"">
  63.                                 <img src=""../BBS/Images/re.gif"" /></td>
  64.                             <td align=""middle"" style=""width: 343px"">
  65.                             <a href='BBSView.aspx?id="+LR.ID+@"'>" + LR.ZT+ @"</a></td>
  66.                             <td align=""middle"" nowrap=""nowrap"" style=""width: 61px"">
  67.                                  " + LR.ZTZZ + @"</td>
  68.                                   <td align=""center"" nowrap=""nowrap"">
  69.                                       " + LR.DJ.ToString() + @"</td>
  70.                             <td align=""center"" nowrap=""nowrap"">
  71.                                " + LR.HF.ToString() + @"</td>
  72.                             <td align=""middle"" nowrap=""nowrap"">
  73.                                 " + LR.ZHHF.ToString("yyyy-MM-dd HH:mm:ss") + @"
  74.                             </td>
  75.                         </tr>                       
  76.                     ";
  77.         }
  78.     }
  79.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  80.     {
  81.         MyDataBind(e.NewPageIndex);
  82.     }
  83.     /// <summary>
  84.     /// 获取信息
  85.     /// </summary>
  86.     /// <param name="pidx">页号</param>
  87.     public void MyDataBind(int pidx)
  88.     {
  89.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  90.         List<Model.BBS> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  91.         if (LRData.Count == 0)
  92.         {
  93.             Model.BBS MR = new Model.BBS();
  94.             LRData.Add(MR);
  95.         }
  96.         GetList(LRData);
  97.     }
  98. }