123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- namespace LYFZ.WeixinServers.WeiXinAPP
- {
- public partial class KeywordManagement : System.Web.UI.Page
- {
- public System.Text.StringBuilder KeywordListHtmlTb = new System.Text.StringBuilder();
- protected void Page_Load(object sender, EventArgs e)
- {
- CommonHandler.CheckLoginJump(this);
- if (Request.QueryString["type"] != null && Request.QueryString["type"].ToString() == "refresh")
- {
- Global.RefreshLoadKeywordDaTable();
- }
- for (int i = 0; i < Global.FunctionListDaTable.Rows.Count; i++)
- {
- DataRow row = Global.FunctionListDaTable.Rows[i];
- SelectOptionList.Append("<option value=\"" + row["FunctionCode"].ToString() + "\">" + row["FunctionName"].ToString() + "</option>");
-
- KeywordRowList rowlist = getKeywordRowList(row["FunctionCode"].ToString(), (i + 1));
- int IsEnabledInt = 0;
- if (rowlist.IsEnabled == "启用")
- {
- IsEnabledInt = 1;
- }
- KeywordListHtmlTb.Append("<tr id=\"ptr_" + i.ToString() + "\" class=\"tr_FunctionList\" mytag=\"tr_" + row["FunctionCode"].ToString() + "\">"
- + " <td>" + rowlist.RIndex.ToString() + "</td>"
- + " <td>" + row["FunctionName"].ToString() + "</td>"
- + " <td>" + row["FunctionCode"].ToString() + "</td>"
- + " <td>" + rowlist.KeywordList.ToString().Trim('、') + "</td>"
- + "<td>" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
- + " <td>" + rowlist.IsEnabled + "</td>"
- + " <td>"
- + "<a role=\"button\" onclick=\"setEnabled('" + IsEnabledInt + "@" + row["FunctionCode"].ToString() + "@function')\" style=\"margin-right:10px;\"><i class=\"icon-" + rowlist.IconName + "\"></i></a>"
- + "<a href=\"javascript:updateFunctionmodule('" + row["id"].ToString() + "','" + row["FunctionName"].ToString() + "','" + row["FunctionCode"].ToString() + "')\" style=\"margin-right:10px;\"><i class=\"icon-pencil\"></i></a>"
- + "<a href=\"#myModal\" role=\"button\" onclick=\"setModalValue('" + row["id"].ToString() +"@"+ row["FunctionCode"].ToString() + "@function')\" data-toggle=\"modal\"><i class=\"icon-remove\"></i></a>"
- + "</td>"
- + " </tr>");
- KeywordListHtmlTb.Append(rowlist.SubTrKeywordString.ToString());
- }
-
- }
- public System.Text.StringBuilder SelectOptionList = new System.Text.StringBuilder();
-
- KeywordRowList getKeywordRowList(string FunctionCode,int rowIndex)
- {
- KeywordRowList krowlist = new KeywordRowList();
- krowlist.RIndex = rowIndex;
- DataRow[] rows = Global.KeywordDaTable.Select("FunctionCode='" + FunctionCode + "'", "Keyword asc");
- for (int i = 0; i < rows.Length; i++)
- {
- DataRow row = rows[i];
- string ISEnabled = "禁用";
- string iconName = "lock";
- if (row["isEnabled"].ToString() == "1")
- {
- ISEnabled = "启用";
- iconName = "ok";
- krowlist.IsEnabled = ISEnabled;
- krowlist.IconName = iconName;
- }
-
- krowlist.KeywordList.Append(row["Keyword"].ToString()+"、");
- krowlist.SubTrKeywordString.Append("<tr id=\"subtr_"+i.ToString()+"\" class=\"tr_" + FunctionCode + "\" style=\" background-color:#F3F7FA;display:none;\">"
- + " <td> " + rowIndex.ToString() + "-" + (i + 1).ToString() + "</td>"
- + " <td></td>"
- + " <td></td>"
- + " <td>" + row["Keyword"].ToString() + "</td>"
- + "<td>" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "</td>"
- + " <td>" + ISEnabled + "</td>"
- + " <td>"
- + "<a onclick=\"setEnabled('" + row["isEnabled"].ToString() + "@" + row["Keyword"].ToString() + "@keyword')\" style=\"margin-right:10px;\"><i class=\"icon-" + iconName + "\"></i></a>"
- + "<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>"
- + "<a href=\"#myModal\" role=\"button\" onclick=\"setModalValue('" + row["id"].ToString() + "@" + row["Keyword"].ToString() + "@keyword')\" data-toggle=\"modal\"><i class=\"icon-remove\"></i></a>"
- + "</td>"
- + " </tr>");
- }
- return krowlist;
- }
- }
- public class KeywordRowList {
- public KeywordRowList() {
-
- }
- int rIndex = 0;
- /// <summary>
- /// 当前父行索引
- /// </summary>
- public int RIndex
- {
- get { return rIndex; }
- set { rIndex = value; }
- }
- string isEnabled = "禁用";
- /// <summary>
- /// 是否启用字符串
- /// </summary>
- public string IsEnabled
- {
- get { return isEnabled; }
- set { isEnabled = value; }
- }
- string iconName = "lock";
- /// <summary>
- /// 状态图标
- /// </summary>
- public string IconName
- {
- get { return iconName; }
- set { iconName = value; }
- }
- System.Text.StringBuilder _KeywordList = new System.Text.StringBuilder();
- /// <summary>
- /// 关键字集合字符串
- /// </summary>
- public System.Text.StringBuilder KeywordList
- {
- get { return _KeywordList; }
- set { _KeywordList = value; }
- }
- System.Text.StringBuilder _subTrKeywordString = new System.Text.StringBuilder();
- /// <summary>
- /// 子行tr 字符串
- /// </summary>
- public System.Text.StringBuilder SubTrKeywordString
- {
- get { return _subTrKeywordString; }
- set { _subTrKeywordString = value; }
- }
- }
- }
|