News.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 InFos_News : System.Web.UI.Page
  12. {
  13.     Model.INFONews MR = new Model.INFONews();
  14.     BLL.INFONews BR = new BLL.INFONews();
  15.     public string ContentStr = "";
  16.     /// <summary>
  17.     /// 查询条件
  18.     /// </summary>
  19.     public string TiaoJian
  20.     {
  21.         get
  22.         {
  23.             if (ViewState["InFos_NewsTiaoJian"] == null)
  24.             {
  25.                 return "";
  26.             }
  27.             else
  28.             {
  29.                 return ViewState["InFos_NewsTiaoJian"].ToString();
  30.             }
  31.         }
  32.         set { ViewState["InFos_NewsTiaoJian"] = value; }
  33.     }
  34.     protected void Page_Load(object sender, EventArgs e)
  35.     {
  36.         LoginLogic.MatchLoad("../", "InFos_News");
  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.                 TiaoJian = "";
  47.                 MyDataBind(1);
  48.             }
  49.         }
  50.     }
  51.     public void GetList(List<Model.INFONews> LRData)
  52.     {
  53.         ContentStr = "";
  54.         foreach (Model.INFONews LR in LRData)
  55.         {
  56.             ContentStr += @"<tr class=""usertablerow2"">
  57.                      
  58.                             <td nowrap=""nowrap"" align=""center"">
  59.                                 <img src=""../BBS/Images/re.gif"" /></td>
  60.                             <td align=""middle"">
  61.                             <a href='InfoView.aspx?id=" + LR.ID.ToString()+ "'>" + LR.ZT + @"</a></td>
  62.                             <td align=""middle"" nowrap=""nowrap"">
  63.                              " + LR.ZZ + @"</td>
  64.                   
  65.                             <td align=""middle"" nowrap=""nowrap"" align=""center"">
  66.                              " + LR.SJ.ToString("yyyy-MM-dd HH:mm:ss") +@"
  67.                             </td>
  68.                         </tr>";
  69.         }
  70.     }
  71.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  72.     {
  73.         MyDataBind(e.NewPageIndex);
  74.     }
  75.     /// <summary>
  76.     /// 获取信息
  77.     /// </summary>
  78.     /// <param name="pidx">页号</param>
  79.     public void MyDataBind(int pidx)
  80.     {
  81.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  82.         List<Model.INFONews> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  83.         if (LRData.Count == 0)
  84.         {
  85.             Model.INFONews MR = new Model.INFONews();
  86.             LRData.Add(MR);
  87.         }
  88.         GetList(LRData);
  89.     }
  90. }