TVUserList.aspx.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using CB.Common;
  8. using CB.Data;
  9. using CB.Entity;
  10. using CB.Framework;
  11. namespace CB.Admin.Plugins.TVServer
  12. {
  13. public partial class TVUserList : AdminPage
  14. {
  15. public IList<AreaInfo> ListArea = new List<AreaInfo>();
  16. public IList<LotteryInfo> ListLottery = new List<LotteryInfo>();
  17. public IList<TrendChartInfo> ListTrendChart = new List<TrendChartInfo>();
  18. protected void Page_Load(object sender, EventArgs e)
  19. {
  20. ListArea = AreaService.ToList();
  21. ListLottery = LotteryService.ToList();
  22. ListTrendChart = TrendChartService.ToList();
  23. if (!Page.IsPostBack)
  24. {
  25. InitData();
  26. }
  27. }
  28. protected override void InitData()
  29. {
  30. BindRepeaterList();
  31. }
  32. protected override void BindRepeaterList()
  33. {
  34. int recordCount;
  35. repeaterList.DataSource = null;
  36. var list = CB.Data.TVUserService.ToPaging(new Entity.TVUserInfo(), AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, out recordCount);
  37. repeaterList.DataSource = list;
  38. repeaterList.DataBind();
  39. }
  40. protected void repeaterList_ItemCommand(object source, RepeaterCommandEventArgs e)
  41. {
  42. if ("dndel" == e.CommandName)
  43. {
  44. if (CB.Data.TVUserService.Delete(TypeConverter.ObjectToInt(e.CommandArgument)))
  45. Logs("删除电视走势图用户成功", string.Format("用户[ID={0}]", e.CommandArgument));
  46. BindRepeaterList();
  47. }
  48. }
  49. protected void AspNetPager1_PageChanged(object sender, EventArgs e)
  50. {
  51. BindRepeaterList();
  52. }
  53. protected string BindAreaName(int AreaId)
  54. {
  55. foreach (var item in ListArea)
  56. {
  57. if (item.Id == AreaId)
  58. {
  59. return item.Name;
  60. }
  61. }
  62. return "";
  63. }
  64. protected string BindLotteryName(int LotteryId)
  65. {
  66. foreach (var item in ListLottery)
  67. {
  68. if (item.Id == LotteryId)
  69. {
  70. return item.Name;
  71. }
  72. }
  73. return "";
  74. }
  75. protected string BindTrendChartName(int ChartId)
  76. {
  77. foreach (var item in ListTrendChart)
  78. {
  79. if (item.Id == ChartId)
  80. {
  81. return item.Name;
  82. }
  83. }
  84. return "";
  85. }
  86. }
  87. }