KeywordManagement.aspx.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.UI;
  7. using System.Web.UI.WebControls;
  8. namespace LYFZ.WeixinServers.WeiXinAPP
  9. {
  10. public partial class KeywordManagement : System.Web.UI.Page
  11. {
  12. public System.Text.StringBuilder KeywordListHtmlTb = new System.Text.StringBuilder();
  13. protected void Page_Load(object sender, EventArgs e)
  14. {
  15. CommonHandler.CheckLoginJump(this);
  16. if (Request.QueryString["type"] != null && Request.QueryString["type"].ToString() == "refresh")
  17. {
  18. Global.RefreshLoadKeywordDaTable();
  19. }
  20. for (int i = 0; i < Global.FunctionListDaTable.Rows.Count; i++)
  21. {
  22. DataRow row = Global.FunctionListDaTable.Rows[i];
  23. SelectOptionList.Append("<option value=\"" + row["FunctionCode"].ToString() + "\">" + row["FunctionName"].ToString() + "</option>");
  24. KeywordRowList rowlist = getKeywordRowList(row["FunctionCode"].ToString(), (i + 1));
  25. int IsEnabledInt = 0;
  26. if (rowlist.IsEnabled == "启用")
  27. {
  28. IsEnabledInt = 1;
  29. }
  30. KeywordListHtmlTb.Append("<tr id=\"ptr_" + i.ToString() + "\" class=\"tr_FunctionList\" mytag=\"tr_" + row["FunctionCode"].ToString() + "\">"
  31. + " <td>" + rowlist.RIndex.ToString() + "</td>"
  32. + " <td>" + row["FunctionName"].ToString() + "</td>"
  33. + " <td>" + row["FunctionCode"].ToString() + "</td>"
  34. + " <td>" + rowlist.KeywordList.ToString().Trim('、') + "</td>"
  35. + "<td>" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
  36. + " <td>" + rowlist.IsEnabled + "</td>"
  37. + " <td>"
  38. + "<a role=\"button\" onclick=\"setEnabled('" + IsEnabledInt + "@" + row["FunctionCode"].ToString() + "@function')\" style=\"margin-right:10px;\"><i class=\"icon-" + rowlist.IconName + "\"></i></a>"
  39. + "<a href=\"javascript:updateFunctionmodule('" + row["id"].ToString() + "','" + row["FunctionName"].ToString() + "','" + row["FunctionCode"].ToString() + "')\" style=\"margin-right:10px;\"><i class=\"icon-pencil\"></i></a>"
  40. + "<a href=\"#myModal\" role=\"button\" onclick=\"setModalValue('" + row["id"].ToString() +"@"+ row["FunctionCode"].ToString() + "@function')\" data-toggle=\"modal\"><i class=\"icon-remove\"></i></a>"
  41. + "</td>"
  42. + " </tr>");
  43. KeywordListHtmlTb.Append(rowlist.SubTrKeywordString.ToString());
  44. }
  45. }
  46. public System.Text.StringBuilder SelectOptionList = new System.Text.StringBuilder();
  47. KeywordRowList getKeywordRowList(string FunctionCode,int rowIndex)
  48. {
  49. KeywordRowList krowlist = new KeywordRowList();
  50. krowlist.RIndex = rowIndex;
  51. DataRow[] rows = Global.KeywordDaTable.Select("FunctionCode='" + FunctionCode + "'", "Keyword asc");
  52. for (int i = 0; i < rows.Length; i++)
  53. {
  54. DataRow row = rows[i];
  55. string ISEnabled = "禁用";
  56. string iconName = "lock";
  57. if (row["isEnabled"].ToString() == "1")
  58. {
  59. ISEnabled = "启用";
  60. iconName = "ok";
  61. krowlist.IsEnabled = ISEnabled;
  62. krowlist.IconName = iconName;
  63. }
  64. krowlist.KeywordList.Append(row["Keyword"].ToString()+"、");
  65. krowlist.SubTrKeywordString.Append("<tr id=\"subtr_"+i.ToString()+"\" class=\"tr_" + FunctionCode + "\" style=\" background-color:#F3F7FA;display:none;\">"
  66. + " <td>&nbsp;&nbsp;&nbsp;&nbsp;" + rowIndex.ToString() + "-" + (i + 1).ToString() + "</td>"
  67. + " <td></td>"
  68. + " <td></td>"
  69. + " <td>" + row["Keyword"].ToString() + "</td>"
  70. + "<td>" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
  71. + " <td>" + ISEnabled + "</td>"
  72. + " <td>"
  73. + "<a onclick=\"setEnabled('" + row["isEnabled"].ToString() + "@" + row["Keyword"].ToString() + "@keyword')\" style=\"margin-right:10px;\"><i class=\"icon-" + iconName + "\"></i></a>"
  74. + "<a href=\"javascript:updateKeyword('" + row["id"].ToString() + "','" + row["FunctionCode"].ToString() + "','" + row["Keyword"].ToString() + "','" + row["isEnabled"].ToString() + "')\" style=\"margin-right:10px;\"><i class=\"icon-pencil\"></i></a>"
  75. + "<a href=\"#myModal\" role=\"button\" onclick=\"setModalValue('" + row["id"].ToString() + "@" + row["Keyword"].ToString() + "@keyword')\" data-toggle=\"modal\"><i class=\"icon-remove\"></i></a>"
  76. + "</td>"
  77. + " </tr>");
  78. }
  79. return krowlist;
  80. }
  81. }
  82. public class KeywordRowList {
  83. public KeywordRowList() {
  84. }
  85. int rIndex = 0;
  86. /// <summary>
  87. /// 当前父行索引
  88. /// </summary>
  89. public int RIndex
  90. {
  91. get { return rIndex; }
  92. set { rIndex = value; }
  93. }
  94. string isEnabled = "禁用";
  95. /// <summary>
  96. /// 是否启用字符串
  97. /// </summary>
  98. public string IsEnabled
  99. {
  100. get { return isEnabled; }
  101. set { isEnabled = value; }
  102. }
  103. string iconName = "lock";
  104. /// <summary>
  105. /// 状态图标
  106. /// </summary>
  107. public string IconName
  108. {
  109. get { return iconName; }
  110. set { iconName = value; }
  111. }
  112. System.Text.StringBuilder _KeywordList = new System.Text.StringBuilder();
  113. /// <summary>
  114. /// 关键字集合字符串
  115. /// </summary>
  116. public System.Text.StringBuilder KeywordList
  117. {
  118. get { return _KeywordList; }
  119. set { _KeywordList = value; }
  120. }
  121. System.Text.StringBuilder _subTrKeywordString = new System.Text.StringBuilder();
  122. /// <summary>
  123. /// 子行tr 字符串
  124. /// </summary>
  125. public System.Text.StringBuilder SubTrKeywordString
  126. {
  127. get { return _subTrKeywordString; }
  128. set { _subTrKeywordString = value; }
  129. }
  130. }
  131. }