ManagerADNews.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_ManagerADNews : System.Web.UI.Page
  12. {
  13.     Model.INFOADNews MR = new Model.INFOADNews();
  14.     BLL.INFOADNews BR = new BLL.INFOADNews();
  15.     public string ContentStr = "";
  16.     /// <summary>
  17.     /// 查询条件
  18.     /// </summary>
  19.     public string TiaoJian
  20.     {
  21.         get
  22.         {
  23.             if (ViewState["InFos_ADNewsTiaoJian"] == null)
  24.             {
  25.                 return "";
  26.             }
  27.             else
  28.             {
  29.                 return ViewState["InFos_ADNewsTiaoJian"].ToString();
  30.             }
  31.         }
  32.         set { ViewState["InFos_ADNewsTiaoJian"] = value; }
  33.     }
  34.     protected void Page_Load(object sender, EventArgs e)
  35.     {
  36.         LoginLogic.MatchLoad("../", "InFos_ManagerADNews");
  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.INFOADNews> LRData)
  52.     {
  53.         ContentStr = "";
  54.         foreach (Model.INFOADNews 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='AdInfoView.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='AdInfoEdit.aspx?id=" + LR.ID + @"'>编辑</a>&nbsp;&nbsp; <a href='AdInfoDel.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.INFOADNews> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  86.         if (LRData.Count == 0)
  87.         {
  88.             Model.INFOADNews MR = new Model.INFOADNews();
  89.             LRData.Add(MR);
  90.         }
  91.         GetList(LRData);
  92.     }
  93. }