MyBBS.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_MyBBS : 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_MyBBS");
  37.         if (!IsPostBack)
  38.         {
  39.                 TiaoJian = "ZTZZ='"+SessionInclude.SessionId+"'";
  40.                 MyDataBind(1);
  41.            
  42.      
  43.         }
  44.     }
  45.     public void GetList(List<Model.BBS> LRData)
  46.     {
  47.         ContentStr = "";
  48.         foreach (Model.BBS LR in LRData)
  49.         {
  50.             ContentStr += @"
  51.                         <tr class=""usertablerow2"">
  52.                             <td nowrap=""nowrap"">
  53.                                 </td>
  54.                             <td nowrap=""nowrap"" align=""center"">
  55.                                 <img src=""../BBS/Images/re.gif"" /></td>
  56.                             <td align=""middle"" style=""width: 343px"">
  57.                             <a href='BBSView.aspx?id="+LR.ID+@"'>" + LR.ZT+ @"</a></td>
  58.                             <td align=""middle"" nowrap=""nowrap"" style=""width: 61px"">
  59.                                  " + LR.ZTZZ + @"</td>
  60.                                   <td align=""center"" nowrap=""nowrap"">
  61.                                       " + LR.DJ.ToString() + @"</td>
  62.                             <td align=""center"" nowrap=""nowrap"">
  63.                                " + LR.HF.ToString() + @"</td>
  64.                             <td align=""middle"" nowrap=""nowrap"">
  65.                                 " + LR.ZHHF.ToString("yyyy-MM-dd HH:mm:ss") + @"
  66.                             </td>
  67.            <td align=""middle"" nowrap=""nowrap"">
  68.                               <a href='BBSEdit.aspx?id=" + LR.ID + @"'>编辑</a>&nbsp;&nbsp; <a href='BBSDel.aspx?id=" + LR.ID + @"'>删除</a>
  69.                             </td>
  70.                         </tr>                       
  71.                     ";
  72.         }
  73.     }
  74.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  75.     {
  76.         MyDataBind(e.NewPageIndex);
  77.     }
  78.     /// <summary>
  79.     /// 获取信息
  80.     /// </summary>
  81.     /// <param name="pidx">页号</param>
  82.     public void MyDataBind(int pidx)
  83.     {
  84.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  85.         List<Model.BBS> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  86.         if (LRData.Count == 0)
  87.         {
  88.             Model.BBS MR = new Model.BBS();
  89.             LRData.Add(MR);
  90.         }
  91.         GetList(LRData);
  92.     }
  93. }