protected void ddlSf_ID_SelectedIndexChanged(object sender, EventArgs e) { string Sf_ID = this.ddlSf_ID.SelectedItem.Value; if (Sf_ID.Equals("0")) { JscriptMsg("请选择要编辑子功能!", "", "Error"); return; } string sql = " Sf_ID = " + Sf_ID; BLL.CCOM.Son_function Bsf = new BLL.CCOM.Son_function(); Model.CCOM.Son_function Msf = Bsf.GetModel(Convert.ToInt32(Sf_ID)); this.txtTitle.Text = Msf.Sf_name; this.txtURL.Text = Msf.Sf_url; this.txtSort.Text = Msf.Sf_sort.ToString(); if (Msf.Sf_status == true) { this.optOpen.Checked = true; this.optClose.Checked = false; } else { this.optOpen.Checked = false; this.optClose.Checked = true; } }
protected void ddlFf2_ID_SelectedIndexChanged(object sender, EventArgs e) { clearTxt(); string Ff_fatherID = this.ddlFf2_ID.SelectedItem.Value; if (Ff_fatherID.Equals("0")) { this.ddlSf_ID.Items.Clear(); ListItem item1 = new ListItem("--请选择功能--", "0"); this.ddlSf_ID.Items.Insert(0, item1); JscriptMsg("请选择二级父功能!", "", "Error"); return; } string sql = " Ff_ID = " + Ff_fatherID; BLL.CCOM.Son_function Bsf = new BLL.CCOM.Son_function(); DataSet ds = Bsf.GetList(sql); this.ddlSf_ID.Items.Clear(); this.ddlSf_ID.DataSource = ds.Tables[0].DefaultView; this.ddlSf_ID.DataTextField = "Sf_name"; this.ddlSf_ID.DataValueField = "Sf_id"; this.ddlSf_ID.DataBind(); ListItem item = new ListItem("--请选择功能--", "0"); this.ddlSf_ID.Items.Insert(0, item); }
/// <summary> /// 传入url,取得跳转页面的fun_id /// </summary> public string get_fun_id(string url) { BLL.CCOM.Son_function Bsf = new BLL.CCOM.Son_function(); var sf = Bsf.GetModel("Sf_url='" + url + "'"); if (sf != null) { return(DESEncrypt.Encrypt(sf.Sf_id.ToString())); } return(""); }
protected JsonData createlevel3json(string Ff_sonID) { JsonData list3Data = new JsonData(); list3Data.SetJsonType(JsonType.Array); string sql_son = " Ff_ID =" + Ff_sonID + " order by Sf_sort"; BLL.CCOM.Son_function Bsf = new BLL.CCOM.Son_function(); var Sf_list = Bsf.GetModelList(sql_son); foreach (Model.CCOM.Son_function Sf in Sf_list) { BLL.CCOM.Role_permission apbll = new BLL.CCOM.Role_permission(); var aplist = apbll.GetModelList("Sf_id =" + Sf.Sf_id + " and Role_id=" + user_info.Role_id); if (aplist.Count > 0) { try { JsonData data = new JsonData(); data["id"] = DESEncrypt.Encrypt(Sf.Sf_id.ToString()); data["type"] = "S"; data["address"] = "/AdminMetro/" + Sf.Sf_url + "?fun_id=" + DESEncrypt.Encrypt(Sf.Sf_id.ToString()) + ""; data["name"] = Sf.Sf_name; list3Data.Add(data); if (data["name"].ToString() == "查阅新闻") { this.funid_news = DESEncrypt.Encrypt(Sf.Sf_id.ToString()); } if (data["name"].ToString() == "最新通知") { this.funid_notice = DESEncrypt.Encrypt(Sf.Sf_id.ToString()); } if (data["name"].ToString() == "活动大厅") { this.funid_activity = DESEncrypt.Encrypt(Sf.Sf_id.ToString()); } if (data["name"].ToString() == "投票") { this.funid_vote = DESEncrypt.Encrypt(Sf.Sf_id.ToString()); } } catch (Exception ex) { JscriptMsg("读取页面失败", "login_page.aspx", ex.Message); } } } return(list3Data); }
private string DoAdd(string title, bool status, string sort, string Ff_fatherID, string url) { try { var model = new Model.CCOM.Son_function(); model.Sf_name = title; model.Sf_status = status; model.Sf_sort = Convert.ToInt32(sort); model.Ff_ID = Convert.ToInt32(Ff_fatherID); model.Sf_url = url; BLL.CCOM.Son_function Bsf = new BLL.CCOM.Son_function(); Bsf.Add(model); } catch { return("数据更新异常"); } return(""); }
protected void BindFunction() { BLL.CCOM.Father_function ffbll = new BLL.CCOM.Father_function(); BLL.CCOM.Son_function sfbll = new BLL.CCOM.Son_function(); BLL.CCOM.Role_permission rpbll = new BLL.CCOM.Role_permission(); //BLL.CCOM.Admin_permission apbll = new BLL.CCOM.Admin_permission(); List <Model.CCOM.Father_function> ffmodel = ffbll.GetModelList("Ff_fatherID=0"); for (int i = 0; i < ffmodel.Count; i++) { HtmlGenericControl rowFluidDiv = new HtmlGenericControl(); rowFluidDiv.TagName = "div"; rowFluidDiv.Attributes["class"] = "row-fluid"; divControls.Controls.Add(rowFluidDiv); HtmlGenericControl span12Div = new HtmlGenericControl(); span12Div.TagName = "div"; span12Div.Attributes["class"] = "span12"; rowFluidDiv.Controls.Add(span12Div); HtmlGenericControl widgetPurpleDiv = new HtmlGenericControl(); widgetPurpleDiv.TagName = "div"; widgetPurpleDiv.Attributes["class"] = "widget purple"; span12Div.Controls.Add(widgetPurpleDiv); HtmlGenericControl widgetTitleDiv = new HtmlGenericControl(); widgetTitleDiv.TagName = "div"; widgetTitleDiv.Attributes["class"] = "widget-title"; widgetPurpleDiv.Controls.Add(widgetTitleDiv); HtmlGenericControl ff1NameH4 = new HtmlGenericControl(); ff1NameH4.TagName = "h4"; ff1NameH4.InnerHtml = ffmodel[i].Ff_name; widgetTitleDiv.Controls.Add(ff1NameH4); HtmlGenericControl toolsSpan = new HtmlGenericControl(); toolsSpan.TagName = "span"; toolsSpan.Attributes["class"] = "tools"; widgetTitleDiv.Controls.Add(toolsSpan); HtmlGenericControl iconA = new HtmlGenericControl(); iconA.TagName = "a"; iconA.Attributes["href"] = "javascript:;"; iconA.Attributes["class"] = "icon-chevron-down"; toolsSpan.Controls.Add(iconA); HtmlGenericControl widgetBodyDiv = new HtmlGenericControl(); widgetBodyDiv.TagName = "div"; widgetBodyDiv.Attributes["class"] = "widget-body"; widgetBodyDiv.Attributes["style"] = "display: block;"; widgetPurpleDiv.Controls.Add(widgetBodyDiv); HtmlGenericControl tableTable = new HtmlGenericControl(); tableTable.TagName = "table"; tableTable.Attributes["class"] = "table"; widgetBodyDiv.Controls.Add(tableTable); List <Model.CCOM.Father_function> ff2model = ffbll.GetModelList("Ff_fatherID=" + ffmodel[i].Ff_id); for (int j = 0; j < ff2model.Count; j++) { HtmlGenericControl thead = new HtmlGenericControl(); thead.TagName = "thead"; tableTable.Controls.Add(thead); HtmlGenericControl theadTr = new HtmlGenericControl(); theadTr.TagName = "tr"; thead.Controls.Add(theadTr); HtmlGenericControl theadTh = new HtmlGenericControl(); theadTh.TagName = "th"; theadTh.InnerHtml = ff2model[j].Ff_name; theadTr.Controls.Add(theadTh); HtmlGenericControl tbody = new HtmlGenericControl(); tbody.TagName = "tbody"; tableTable.Controls.Add(tbody); HtmlGenericControl tbodyTr = null; List <Model.CCOM.Son_function> sfmodel = sfbll.GetModelList("Ff_ID=" + ff2model[j].Ff_id + "ORDER BY Sf_sort"); int k; for (k = 0; k < sfmodel.Count; k++) { bool haveModel; haveModel = rpbll.GetModel("Role_id=" + id + "and Sf_ID=" + sfmodel[k].Sf_id) != null; //if (type == 0) //{ // haveModel = rpbll.GetModel("Role_id=" + id + "and Sf_ID=" + sfmodel[k].Sf_id) != null; //} //else //{ // haveModel = apbll.GetModel("User_id=" + id + "and Sf_ID=" + sfmodel[k].Sf_id) != null; //} if (k % 3 == 0) { tbodyTr = new HtmlGenericControl(); tbodyTr.TagName = "tr"; tbody.Controls.Add(tbodyTr); } HtmlGenericControl theadTd = new HtmlGenericControl(); theadTd.TagName = "td"; tbodyTr.Controls.Add(theadTd); CheckBox ckBox = new CheckBox(); ckBox.AutoPostBack = true; ckBox.CheckedChanged += btnAble_Click; ckBox.ID = sfmodel[k].Sf_id.ToString(); ckBox.Text = sfmodel[k].Sf_name; if (haveModel) { ckBox.Checked = true; } else { ckBox.Checked = false; } theadTd.Controls.Add(ckBox); } if (k != 0 && --k % 3 != 2) { while (k++ % 3 != 2) { HtmlGenericControl blankTd = new HtmlGenericControl(); blankTd.TagName = "td"; blankTd.InnerHtml = " "; tbodyTr.Controls.Add(blankTd); } } } } }
private void ManagePage_Load(object sender, EventArgs e) { //return; //判断后台是否登录 if (checkLogin && !IsAdminLogin()) { Redirect(MyEnums.RediirectErrorEnum.SessionNull); return; } if (checkLogin && checkUserStaus && (Session[MyKeys.SESSION_ADMIN_INFO] == null || Session[MyKeys.SESSION_USER_STATUSID] == null)) { //Response.Write("<script type=\"text/javascript\" src=\"/metro/js/ex-common-scripts.js\"></script><script>if(window.parent != window) getTopWindow().location.href='/adminmetro/index.aspx';" // + " else window.location.href='" + siteConfig.webpath + siteConfig.webmanagepath + "/Login.aspx';</script>"); Response.Write("<script type=\"text/javascript\" src=\"/metro/js/ex-common-scripts.js\"></script><script>if(window.parent != window) getTopWindow().location.href='/AdminMetro/index.aspx';" + " else window.location.href='/AdminMetro/login_page.aspx';</script>"); Response.End(); return; } if (checkFunID) { if (MyRequest.GetQueryString("fun_id") != "") { fun_id = DESEncrypt.Decrypt(MyRequest.GetQueryString("fun_id")); user_info = GetAdminInfo_CCOM(); //用户信息 String url = HttpContext.Current.Request.Url.AbsolutePath; url = url.Replace("/AdminMetro/", ""); BLL.CCOM.Son_function sfbll = new BLL.CCOM.Son_function(); Model.CCOM.Son_function sfModel = sfbll.GetModel("Sf_id =" + fun_id); if (sfModel.Sf_url != url) { InnerRedirect(MyEnums.RediirectErrorEnum.ParameterError); } //BLL.CCOM.Admin_permission bll = new BLL.CCOM.Admin_permission(); //Model.CCOM.Admin_permission model = bll.GetModel("Sf_id =" + fun_id + "and User_id =" + user_info.User_id); //if (model == null) //{ // InnerRedirect(MyEnums.RediirectErrorEnum.NotAdmin); //} //else //{ BLL.CCOM.Role rolebll = new BLL.CCOM.Role(); //Model.CCOM.Role roleModel = rolebll.GetModel("Role_id IN (SELECT Role_id FROM Role_permission WHERE User_id = " + user_info.User_id + ")"); Model.CCOM.Role roleModel = rolebll.GetModel("Role_id IN (SELECT Role_id FROM User_information WHERE User_id = " + user_info.User_id + ")"); if (!roleModel.Role_status) { BLL.CCOM.Role_permission rpbll = new BLL.CCOM.Role_permission(); List <Model.CCOM.Role_permission> rpmodel = rpbll.GetModelList("Sf_id =" + fun_id + "and Role_id =" + roleModel.Role_id); if (rpmodel.Count > 0) { InnerRedirect(MyEnums.RediirectErrorEnum.NotAdmin); } } } else { InnerRedirect(MyEnums.RediirectErrorEnum.FunIDNull); } } //标志首次登陆 if (Session[MyKeys.SESSION_FIRST_LOGIN] != null) { isFirstLogin = true; } //只要有操作就重写session Session[MyKeys.SESSION_ADMIN_INFO] = GetAdminInfo_CCOM(); Session.Timeout = 300; return; }
protected string createleftinneritem(Model.CCOM.Father_function Ff, JsonData listData) { string str = ""; str += "<li class=\"sub-menu\">"; str += "<a href=\"javascript:;\" class=\"\">"; // string icon = xn.Attributes["icon"].Value == "" ? "icon-file-alt" : xn.Attributes["icon"].Value; //string level1name = xn.Attributes["cff_name"].Value; string level1name = Ff.Ff_name; /* * if ((MyEnums.UserStatus)Session[MyKeys.SESSION_USER_TABLE] == * MyEnums.UserStatus.App_Universities_SchoolUser) * { * if (xn.Attributes["stuview_name"].Value != "") * level1name = xn.Attributes["stuview_name"].Value; * } */ str += "<span>" + level1name + "</span>"; str += "</a>"; str += " <ul class=\"sub\">"; string sql_Ff = " Ff_fatherID = " + Ff.Ff_id + " order by Ff_sort"; BLL.CCOM.Father_function Bff = new BLL.CCOM.Father_function(); var Ff_listSon = Bff.GetModelList(sql_Ff); bool hasSon = false; foreach (var Ff_son in Ff_listSon) { try { string sql_son = " Ff_ID =" + Ff_son.Ff_id; BLL.CCOM.Son_function Bsf = new BLL.CCOM.Son_function(); BLL.CCOM.Role_permission apbll = new BLL.CCOM.Role_permission(); var aplist = apbll.GetModelList("Sf_id in (select Sf_id from Son_function where Ff_ID = " + Ff_son.Ff_id + ") and Role_id=" + user_info.Role_id); if (aplist.Count > 0) { JsonData data = new JsonData(); data["id"] = DESEncrypt.Encrypt(Ff_son.Ff_id.ToString()); data["type"] = "F"; data["address"] = ""; data["name"] = Ff_son.Ff_name; data["functions"] = createlevel3json(Ff_son.Ff_id.ToString()); listData.Add(data); hasSon = true; Model.CCOM.Son_function Sf1 = Bsf.GetModel(aplist[0].Sf_id); string cff_name = Ff_son.Ff_name; str += "<li data-id=\"" + DESEncrypt.Encrypt(Ff_son.Ff_id.ToString()) + "\"><a onclick=\"SetTopContent('" + DESEncrypt.Encrypt(Sf1.Sf_id.ToString()) + "')\" target=\"sysMain\" class=\"\" href=\"/AdminMetro/" + Sf1.Sf_url + "?fun_id=" + DESEncrypt.Encrypt(Sf1.Sf_id.ToString()) + "\">" + cff_name + "</a></li>"; } } catch (Exception ex) { JscriptMsg("读取页面失败", "login_page.aspx", ex.Message); } } str += " </ul></li>"; if (hasSon) { return(str); } else { return(""); } }