Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.menuList.DataSource = dal.GetList(" and bid =0 order by orderid desc");
            this.menuList.DataBind();

            this.ddlBid.DataSource     = dal.GetList(" and bid =0 order by orderid desc");
            this.ddlBid.DataTextField  = "MenuName";
            this.ddlBid.DataValueField = "MenuId";
            this.ddlBid.DataBind();
            this.ddlBid.Items.Add(new ListItem("一级菜单", "0"));
            this.ddlBid.SelectedValue = "0";


            //删除
            if (Request["action"] == "del")
            {
                int id = Common.TypeHelper.ObjectToInt(Request["id"], 0);
                if (dal.IsHave(id) > 0)
                {
                    JScript.alert("p", "该菜单下有子菜单,不能删除", "admin_Menu.aspx?" + menuUrl, this.Page);
                }
                else
                {
                    if (dal.Del(id) > 0)
                    {
                        JScript.Loction("p", "admin_Menu.aspx?" + menuUrl, this.Page);
                    }
                }
            }


            ///添加
            if (Request["action"] == "add")
            {
                int bid = Common.TypeHelper.ObjectToInt(Request["bid"], 0);
                this.ddlBid.SelectedValue = bid.ToString();
            }


            //修改

            if (Request["action"] == "update")
            {
                int id = Common.TypeHelper.ObjectToInt(Request["id"], 0);
                Model.MenuInfoModel model = dal.GetModel(id);
                this.txtMenuName.Text          = model.MenuName;
                this.txtMenuUrl.Text           = model.MenuUrl;
                this.txtOrderId.Text           = model.OrderId.ToString();
                this.ddlBid.SelectedValue      = model.Bid.ToString();
                this.radStatusId.SelectedValue = model.StatusId.ToString();
                this.hidId.Value = id.ToString();
            }
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.menuList.DataSource = group.GetList("");
            this.menuList.DataBind();
            int id = Common.TypeHelper.ObjectToInt(Request["id"], 0);
            if (id > 0)
            {
                Model.UserInfoGroupModel model = group.GetModel(id);
                if (model != null)
                {
                    this.txtgroupName.Text = model.GroupName;

                    this.hidId.Value = id.ToString();

                    DataTable     dt  = dal.GetList(" and bid=0 and statusid=1 ");
                    StringBuilder str = new StringBuilder();
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        str.Append("<div class='col-xs-12 widget-container-col ui-sortable'>");
                        str.Append("<div class='widget-box ui-sortable-handle'> ");
                        str.Append("<div class='widget-header'> ");
                        str.Append("<h5 class='widget-title smaller'>" + dt.Rows[i]["MenuName"].ToString() + "</h5> ");
                        str.Append("</div> ");

                        str.Append("<div class='widget-body'> ");
                        str.Append("	<div class='widget-main padding-6'> ");



                        DataTable dt2 = group.GetSelectMenuBid(model.GroupId, dt.Rows[i]["MENUID"].ToString());

                        for (int j = 0; j < dt2.Rows.Count; j++)
                        {
                            str.Append("<div class='checkbox' style='padding-left:10px;'>");
                            str.Append("<span>" + dt2.Rows[j]["MenuName"].ToString() + "</span> <a href='admin_group.aspx?id=" + id + "&perid=" + dt2.Rows[j]["PerId"].ToString() + "'><img src='../img/del.png' style='border:0' /></a> ");
                            str.Append("</div>");
                        }

                        dt2 = group.GetSelectMenu(model.GroupId, dt.Rows[i]["MENUID"].ToString());
                        for (int j = 0; j < dt2.Rows.Count; j++)
                        {
                            str.Append("<div class='checkbox' style='padding-left:30px;'>");
                            str.Append("<span><input type='checkbox' name='menu_select_id' value='" + dt2.Rows[j]["MenuId"].ToString() + "'>" + dt2.Rows[j]["MenuName"].ToString() + "</span> ");
                            str.Append("</div>");
                        }



                        str.Append("</div> ");
                        str.Append("</div> ");
                        str.Append("</div> ");
                        str.Append("</div> ");
                    }
                    this.qx.InnerHtml = str.ToString();
                }
            }
            else
            {
                DataTable     dt  = dal.GetList(" and bid=0 and statusid=1 ");
                StringBuilder str = new StringBuilder();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    str.Append("<h4 class='widget-title'>" + dt.Rows[i]["MenuName"].ToString() + "</h4>");
                    DataTable dt2 = dal.GetList(" and statusid =1 and bid=" + dt.Rows[i]["MenuId"].ToString());

                    str.Append("<div style='width:500px; background:#fff;  '>");
                    for (int j = 0; j < dt2.Rows.Count; j++)
                    {
                        str.Append("<div class='list2'><input type='checkbox' name='menu_select_id' value='" + dt2.Rows[j]["MenuId"].ToString() + "'>" + dt2.Rows[j]["MenuName"].ToString() + "</div>");
                    }
                    str.Append("</div>");
                    str.Append("<p style='clear:both'></p>");
                }
                this.qx.InnerHtml = str.ToString();
            }



            if (Request["perid"] != null)
            {
                int pid = Common.TypeHelper.ObjectToInt(Request["perid"], 0);

                int j = group.DelPer(pid);
                if (j > 0)
                {
                    JScript.Loction("a", "Admin_group.aspx?action=update&id=" + id, this.Page);
                }
            }

            if (Request["action"] == "del")
            {
                if (group.Del(id) > 0)
                {
                    JScript.Loction("a", "admin_group.aspx?", this.Page);
                }
            }
        }
    }