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(""); KeywordRowList rowlist = getKeywordRowList(row["FunctionCode"].ToString(), (i + 1)); int IsEnabledInt = 0; if (rowlist.IsEnabled == "启用") { IsEnabledInt = 1; } KeywordListHtmlTb.Append("" + " " + rowlist.RIndex.ToString() + "" + " " + row["FunctionName"].ToString() + "" + " " + row["FunctionCode"].ToString() + "" + " " + rowlist.KeywordList.ToString().Trim('、') + "" + "" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "" + " " + rowlist.IsEnabled + "" + " " + "" + "" + "" + "" + " "); 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("" + "     " + rowIndex.ToString() + "-" + (i + 1).ToString() + "" + " " + " " + " " + row["Keyword"].ToString() + "" + "" + Convert.ToDateTime(row["CreateTime"]).ToString("yyyy-MM-dd HH:mm") + "" + " " + ISEnabled + "" + " " + "" + "" + "" + "" + " "); } return krowlist; } } public class KeywordRowList { public KeywordRowList() { } int rIndex = 0; /// /// 当前父行索引 /// public int RIndex { get { return rIndex; } set { rIndex = value; } } string isEnabled = "禁用"; /// /// 是否启用字符串 /// public string IsEnabled { get { return isEnabled; } set { isEnabled = value; } } string iconName = "lock"; /// /// 状态图标 /// public string IconName { get { return iconName; } set { iconName = value; } } System.Text.StringBuilder _KeywordList = new System.Text.StringBuilder(); /// /// 关键字集合字符串 /// public System.Text.StringBuilder KeywordList { get { return _KeywordList; } set { _KeywordList = value; } } System.Text.StringBuilder _subTrKeywordString = new System.Text.StringBuilder(); /// /// 子行tr 字符串 /// public System.Text.StringBuilder SubTrKeywordString { get { return _subTrKeywordString; } set { _subTrKeywordString = value; } } } }