ManagerNews.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_ManagerNews : 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_ManagerNews");
  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"" style=""width:31px"">
  59.                                 <img src=""../BBS/Images/re.gif"" /></td>
  60.                             <td align=""middle"" style=""width: 343px"">
  61.                             <a href='InfoView.aspx?id=" + LR.ID.ToString()+ "'>" + LR.ZT + @"</a></td>
  62.                             <td align=""middle"" nowrap=""nowrap"" style=""width: 61px"">
  63.                              " + LR.ZZ + @"</td>
  64.                   
  65.                             <td align=""middle"" nowrap=""nowrap"" align=""center"" style=""width: 101px"">
  66.                              " + LR.SJ.ToString("yyyy-MM-dd HH:mm:ss") +@"
  67.                             </td>
  68.            <td align=""middle"" nowrap=""nowrap"">
  69.                               <a href='InfoEdit.aspx?id=" + LR.ID + @"'>编辑</a>&nbsp;&nbsp; <a href='InfoDel.aspx?id=" + LR.ID + @"'>删除</a>
  70.                             </td>
  71.                         </tr>";
  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.INFONews> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  86.         if (LRData.Count == 0)
  87.         {
  88.             Model.INFONews MR = new Model.INFONews();
  89.             LRData.Add(MR);
  90.         }
  91.         GetList(LRData);
  92.     }
  93. }