using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL;
|
using CY.BLL.Sys;
|
using System.Data;
|
using CY.Infrastructure.Common;
|
using CY.Model;
|
using CY.Infrastructure.Query;
|
namespace CY.WebForm.Pages.Templet.pingxuan
|
{
|
public partial class CompanyNewsList : TempletBasePage
|
{
|
Info_ContentBLL bll_Info_ContentBLL = null;
|
Info_SortBLL bll_Info_SortBLL = null;
|
Sys_DictionaryBLL bll_Sys_DictionaryBLL = null;
|
|
//初始化
|
public CompanyNewsList()
|
{
|
bll_Info_ContentBLL = new Info_ContentBLL();
|
bll_Info_SortBLL = new Info_SortBLL();
|
bll_Sys_DictionaryBLL = new Sys_DictionaryBLL();
|
|
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
this.Title += "-" + CurrentWeb().Name;
|
UCPager1.AspNetPager.PageChanged += AspNetPager1_PageChanged;
|
if (!IsPostBack)
|
{
|
InitialData();
|
BindList();
|
}
|
}
|
|
protected void InitialData()
|
{
|
this.TemplateList.InnerHtml = InitialSelectNewsData();
|
|
}
|
|
protected string InitialSelectNewsData()
|
{
|
DataTable ds = bll_Info_SortBLL.SelectList(CurrentWeb().MemberId.ToGuid2());
|
string SortTypeHtml = "<table width=\"170\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >";
|
if (ds != null && ds.Rows.Count > 0)
|
{
|
GetDataByLevelNews(ref SortTypeHtml, ds, bll_Sys_DictionaryBLL.GetKeyIdByKeyid(3, "网站资讯类型"), 1);
|
}
|
SortTypeHtml += "</table>";
|
return SortTypeHtml;
|
}
|
|
//遍历数据
|
public void GetDataByLevelNews(ref string SortTypeHtml, DataTable data, int? parentId, int level)
|
{
|
|
DataRow[] result = data.Select(string.Format("ParentId={0}", parentId));
|
|
foreach (var item in result)
|
{
|
SortTypeHtml += "<tr><td width=\"20\" align=\"center\" height=\"24\"><img src=\"images/tt.jpg\"></td><td><a href='/Pages/Templet/pingxuan/CompanyNewsList.aspx?i=" + CurrentWeb().bid + "&sortid=" + item["Keyid"] + "' class=\"hui\">" + item["Title"].ToString2().JSubString(32, "..") + "</a></td></tr>";
|
}
|
|
|
}
|
|
private void BindList()
|
{
|
int? sortid = Request["sortid"].ToInt32() ?? bll_Sys_DictionaryBLL.GetKeyIdByKeyid(3, "网站资讯类型").ToInt32();
|
Pagination pa = new Pagination();
|
pa.PageSize = UCPager1.AspNetPager.PageSize;
|
pa.PageIndex = UCPager1.AspNetPager.CurrentPageIndex;
|
this.RepClientList.DataSource = bll_Info_ContentBLL.SelectModelPage(pa, CurrentWeb().MemberId.ToGuid2(), bll_Sys_DictionaryBLL.GetKeyIdByKeyid(3, "网站资讯类型").ToInt32(), sortid, null, "OrderNum ASC");
|
this.RepClientList.DataBind();
|
UCPager1.AspNetPager.RecordCount = pa.RecordCount;
|
|
Info_Sort m_Info_Sort = bll_Info_SortBLL.SelectModelByKeyId(sortid);
|
if (m_Info_Sort != null)
|
{
|
this.spanTittle.InnerText= m_Info_Sort.Title;
|
|
}
|
}
|
|
//分页事件
|
protected void AspNetPager1_PageChanged(object src, EventArgs e)
|
{
|
BindList();
|
}
|
|
}
|
}
|