示例#1
0
        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);
        }
        protected void btnAble_Click(object sender, EventArgs e)
        {
            var CKx = sender as CheckBox;

            BLL.CCOM.Role_permission rpbll = new BLL.CCOM.Role_permission();
            //BLL.CCOM.Admin_permission apbll = new BLL.CCOM.Admin_permission();
            //if (type == 0)
            //{
            if (CKx.Checked == false)
            {
                rpbll.Delete("Role_id=" + id + "and Sf_id=" + CKx.ID.ToString());
            }
            else
            {
                Model.CCOM.Role_permission model;
                model         = new Model.CCOM.Role_permission();
                model.Role_id = id;
                model.Sf_id   = Convert.ToInt32(CKx.ID.ToString());
                rpbll.Add(model);
            }
            //}
            //else
            //{
            //    if (CKx.Checked == false)
            //    {
            //        apbll.Delete("User_id=" + id + "and Sf_id=" + CKx.ID.ToString());
            //    }
            //    else
            //    {
            //        Model.CCOM.Admin_permission model;
            //        model = new Model.CCOM.Admin_permission();
            //        model.User_id = id;
            //        model.Sf_id = Convert.ToInt32(CKx.ID.ToString());
            //        apbll.Add(model);
            //    }
            //}
        }
        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 = "&nbsp;";
                            tbodyTr.Controls.Add(blankTd);
                        }
                    }
                }
            }
        }
示例#4
0
        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;
        }
示例#5
0
        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("");
            }
        }