1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using CB.Common;
- using CB.Data;
- using CB.Entity;
- using CB.Framework;
- namespace CB.Admin.Plugins.Basic
- {
- public partial class TopicList : AdminPage
- {
- IList<TopicClassInfo> topicTypes = TopicClassService.ToList();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- InitData();
- }
- }
- protected override void InitData()
- {
- BindRepeaterList();
- base.InitData();
- }
- protected override void BindRepeaterList()
- {
- int recordCount;
- var list = CB.Data.TopicService.ToPaging(new Entity.TopicInfo()
- {
- Title = txtTitle.Text.Trim()
- }, AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, out recordCount);
- repeaterList.DataSource = list;
- repeaterList.DataBind();
- AspNetPager1.RecordCount = recordCount;
- }
- //查询
- protected void btnSearch_Click(object sender, EventArgs e)
- {
- AspNetPager1.CurrentPageIndex = 1;
- BindRepeaterList();
- }
- protected string GettopicTypesName(string id)
- {
- string name = "";
- var topic = topicTypes.FirstOrDefault(x => x.Cid == TypeConverter.StrToInt(id));
- if (topic != null) { name = topic.Name; }
- return name;
- }
- protected void repeaterList_ItemCommand(object source, RepeaterCommandEventArgs e)
- {
- if ("dndel" == e.CommandName)
- {
- CB.Data.TopicService.Delete(TypeConverter.ObjectToInt(e.CommandArgument));
- Logs("删除 ", string.Format("删除 [TID={0}]", e.CommandArgument));
- }
- BindRepeaterList();
- }
- //翻页
- protected void AspNetPager1_PageChanged(object sender, EventArgs e)
- {
- BindRepeaterList();
- }
- }
- }
|