DropDownList getGmTypeList(GMAccountItem gmInfo) { DropDownList dp = new DropDownList(); dp.ID = "gmType_" + gmInfo.m_user; dp.ClientIDMode = ClientIDMode.Static; List <AccountType> at_list = AccountMgr.getInstance().getAccountTypeList(); foreach (var item in at_list) { dp.Items.Add(new ListItem(item.m_name, item.m_type)); } for (int i = 0; i < dp.Items.Count; i++) { if (gmInfo.m_type == dp.Items[i].Value) { dp.SelectedIndex = i; break; } } return(dp); }
HtmlGenericControl getChannelList(GMAccountItem gmInfo) { HtmlGenericControl dp = new HtmlGenericControl(); dp.TagName = "select"; dp.Attributes.Add("multiple", "multiple"); dp.Attributes.Add("class", "form-control"); dp.ID = "channel_" + gmInfo.m_user; dp.ClientIDMode = ClientIDMode.Static; Dictionary <string, TdChannelInfo> data = TdChannel.getInstance().getAllData(); foreach (var item in data.Values) { HtmlGenericControl option = new HtmlGenericControl(); option.TagName = "option"; option.Attributes.Add("value", item.m_channelNo); option.InnerText = item.m_channelName; dp.Controls.Add(option); if (gmInfo.m_viewChannel.IndexOf(item.m_channelNo) >= 0) { option.Attributes.Add("selected", "selected"); } } return(dp); }
protected void genTable(Table result, GMUser user) { TableRow tr = new TableRow(); TableCell td = null; int i = 0, k = 0; result.Rows.Add(tr); // 列标题 for (i = 0; i < s_head.Length; i++) { td = new TableCell(); td.Text = s_head[i]; tr.Cells.Add(td); } OpRes res = user.doQuery(null, QueryType.queryTypeGmAccount); List <GMAccountItem> qresult = (List <GMAccountItem>)user.getQueryResult(QueryType.queryTypeGmAccount); // 添加内容 for (i = 0; i < qresult.Count; i++) { GMAccountItem item = qresult[i]; if (item.m_type == "admin") { continue; } tr = new TableRow(); result.Rows.Add(tr); // 第0列 td = new TableCell(); td.Text = Tool.getCheckBoxHtml("flag", item.m_user, false); tr.Cells.Add(td); // 第1列 td = new TableCell(); td.Text = item.m_user; tr.Cells.Add(td); // 第2列 td = new TableCell(); CheckBoxList chkList = getCheckBoxList(item); td.Controls.Add(chkList); tr.Cells.Add(td); } }
protected void Page_Load(object sender, EventArgs e) { RightMgr.getInstance().opCheck(RightDef.GM_TYPE_EDIT, Session, Response); GMUser user = (GMUser)Session["user"]; if (IsPostBack) { m_modifyFlagStr = Request["flag"]; if (m_modifyFlagStr == null) { m_modifyFlagStr = ""; } if (m_modifyFlagStr != "") { string[] arr = Tool.split(m_modifyFlagStr, ',', StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < arr.Length; i++) { GMAccountItem item = new GMAccountItem(); item.m_user = arr[i]; item.m_type = Request[item.m_user]; m_gmList.Add(item); } } } else { #if _OLD_RIGHT_ List <AccountType> account = AccountMgr.getInstance().getAccountTypeList(); #else List <AccountType> account = RightMgr.getInstance().getAllGmType(); #endif foreach (AccountType acc in account) { m_type.Items.Add(new ListItem(acc.m_name, acc.m_type)); } genTable(m_curAccount, user); } }
protected CheckBoxList getCheckBoxList(GMAccountItem user) { CheckBoxList chkList = new CheckBoxList(); chkList.RepeatDirection = RepeatDirection.Horizontal; chkList.ID = user.m_user; List <ChannelInfo> cList = Channel.getInstance().m_cList; foreach (var cinfo in cList) { ListItem item = new ListItem(); if (user.canViewChannel(cinfo.channelNo)) { item.Selected = true; } item.Text = cinfo.channelName; item.Value = cinfo.channelNo; chkList.Items.Add(item); } return(chkList); }
public override OpRes doQuery(object param, GMUser user) { m_result.Clear(); List <Dictionary <string, object> > data = DBMgr.getInstance().executeQuery(TableName.GM_ACCOUNT, 0, DbName.DB_ACCOUNT); if (data == null || data.Count <= 0) { return(OpRes.op_res_not_found_data); } int i = 0; for (i = 0; i < data.Count; i++) { GMAccountItem tmp = new GMAccountItem(); tmp.m_user = Convert.ToString(data[i]["user"]); tmp.m_type = Convert.ToString(data[i]["type"]); tmp.m_viewChannel = Convert.ToString(data[i]["viewChannel"]); m_result.Add(tmp); } return(OpRes.opres_success); }
private void genTable(Table table, GMUser user) { table.GridLines = GridLines.Both; TableRow tr = new TableRow(); table.Rows.Add(tr); TableCell td = null; QueryMgr mgr = user.getSys <QueryMgr>(SysType.sysTypeQuery); OpRes res = mgr.doQuery(null, QueryType.queryTypeGmAccount, user); if (res != OpRes.opres_success) { td = new TableCell(); tr.Cells.Add(td); td.Text = OpResMgr.getInstance().getResultString(res); return; } int i = 0, j = 0; // 表头 for (i = 0; i < s_head1.Length; i++) { td = new TableCell(); tr.Cells.Add(td); td.Text = s_head1[i]; } List <GMAccountItem> qresult = (List <GMAccountItem>)mgr.getQueryResult(QueryType.queryTypeGmAccount); for (i = 0; i < qresult.Count; i++) { if (qresult[i].m_type == "admin") { continue; } GMAccountItem item = qresult[i]; tr = new TableRow(); table.Rows.Add(tr); m_content[0] = item.m_user; #if _OLD_RIGHT_ AccountType att = AccountMgr.getInstance().getAccountTypeByType(item.m_type); if (att != null) { m_content[1] = att.m_name; } else { m_content[1] = ""; } #else m_content[1] = RightMgr.getInstance().getGmTypeName(item.m_type); #endif for (j = 0; j < s_head1.Length; j++) { td = new TableCell(); tr.Cells.Add(td); if (j == 2) { td.Controls.Add(getGmTypeList(i)); } else if (j == 3) { HtmlInputButton btn2 = new HtmlInputButton(); btn2.Attributes.Add("value", "修改类型"); btn2.Attributes.Add("id", "btnm" + i.ToString()); btn2.Attributes.Add("acc", item.m_user); td.Controls.Add(btn2); HtmlInputButton btn1 = new HtmlInputButton(); btn1.Attributes.Add("value", "删除"); btn1.Attributes.Add("id", "btnd" + i.ToString()); btn1.Attributes.Add("acc", item.m_user); td.Controls.Add(btn1); } else { td.Text = m_content[j]; } } } }