Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // string token=WeiXinUtil.Factory(this).getAccessToken();
        //Dictionary<string, List<MenuButton>> o = HttpUtil.getCurrMenu(token);
        // string content = HttpUtil.httpForm("", "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=" + token, "GET");
        //JavaScriptSerializer a = new JavaScriptSerializer();
        //Dictionary<string, List<MenuButton>> o = (Dictionary<string, List<MenuButton>>)a.DeserializeObject(content);
        if (!IsPostBack)
        {
            //List<WEC_CUSTOM_MENU> lstChnl = new List<WEC_CUSTOM_MENU>();
            //if (o.ContainsKey("menu")) {

            //}
            WEC_CUSTOM_MENU objVal  = new WEC_CUSTOM_MENU();
            WEC_CUSTOM_MENU objCond = new WEC_CUSTOM_MENU();
            objCond.PID = "0";
            objCond.AID = Convert.ToInt32(userBase2.Curraid);
            objVal.OrderBy(WEC_CUSTOM_MENU.Attribute.SORT_ID, Order.Asc);
            List <WEC_CUSTOM_MENU> lstChnl = BLLTable <WEC_CUSTOM_MENU> .Select(objVal, objCond);

            StringBuilder sb = new StringBuilder();
            if (lstChnl.Count > 0)
            {
                sb.Append("<li id=\"root_0\" data=\"{id:'0',pid:'0',sc:9999,name:'站点栏目管理'}\" class=\"root\"><div class=\"opened\"><b></b><em></em><a href=\"#\">站点栏目管理</a></div>");
                sb.Append("<ul>");
                for (int i = 0; i < lstChnl.Count; i++)
                {
                    StringBuilder sbData = new StringBuilder();
                    string        licls  = "";
                    if (i == lstChnl.Count - 1)
                    {
                        licls = "last";
                    }

                    if (licls != "")
                    {
                        licls = " class='" + licls + "'";
                    }
                    objCond     = new WEC_CUSTOM_MENU();
                    objCond.PID = lstChnl[i].ID;
                    objCond.AID = Convert.ToInt32(userBase2.Curraid);
                    int subcount = BLLTable <WEC_CUSTOM_MENU> .Factory(conn).Select(new WEC_CUSTOM_MENU(), objCond).Count;

                    sbData.Append("{rid:'0',id:'").Append(lstChnl[i].ID.ToString());
                    sbData.Append("',pid:'").Append(lstChnl[i].PID).Append("',no:").Append(lstChnl[i].SORT_ID.ToString());
                    sbData.Append(",sc:").Append(subcount);
                    sbData.Append(",name:'").Append(lstChnl[i].MENU_NAME).Append("'}");

                    sb.Append("<li " + licls + " id='node_" + lstChnl[i].ID + "' data=\"" + sbData.ToString() + "\"><div><b></b><em></em><a href='#'>" + lstChnl[i].MENU_NAME + "</a></div></li>");
                }
                sb.Append("</ul>");
                sb.Append("</li>");
            }
            else
            {
                sb.Append("<li id=\"root_0\" data=\"{id:'0',pid:'',sc:0,name:'站点栏目管理'}\" class=\"root\"><div><b></b><em></em><a href=\"#\">站点栏目管理</a></div></li>");
            }
            litChnl.Text = sb.ToString();
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //显示子节点
        if (Request["ShowSubNodes"] != null)
        {
            #region
            string          pid    = Request["id"];
            WEC_CUSTOM_MENU obj    = new WEC_CUSTOM_MENU();
            WEC_CUSTOM_MENU objval = new WEC_CUSTOM_MENU();
            obj.PID = pid;
            obj.AID = Convert.ToInt32(userBase2.Curraid);
            objval.OrderBy(WEC_CUSTOM_MENU.Attribute.SORT_ID, Order.Asc);

            List <WEC_CUSTOM_MENU> lst = BLLTable <WEC_CUSTOM_MENU> .Select(objval, obj);

            if (lst.Count > 0)
            {
                StringBuilder sb = new StringBuilder("[");
                for (int i = 0; i < lst.Count; i++)
                {
                    if (i > 0)
                    {
                        sb.Append(",");
                    }
                    obj     = new WEC_CUSTOM_MENU();
                    obj.PID = lst[i].ID;
                    obj.AID = Convert.ToInt32(userBase2.Curraid);
                    int subcount = BLLTable <WEC_CUSTOM_MENU> .Factory(conn).Select(new WEC_CUSTOM_MENU(), obj).Count;

                    sb.Append("{rid:'").Append(lst[i].PID).Append("',id:'").Append(lst[i].ID.ToString());
                    sb.Append("',pid:'").Append(lst[i].PID.ToString()).Append("',no:").Append(lst[i].SORT_ID);
                    sb.Append(",sc:").Append(subcount);
                    sb.Append(",name:'").Append(lst[i].MENU_NAME).Append("'}");
                }
                sb.Append("]");
                Response.Write(sb.ToString());
            }



            #endregion
        }

        //删除群组
        if (Request["DelNodeID"] != null)
        {
            string keyid = Request["id"];


            int re = BLLTable <WEC_CUSTOM_MENU> .Delete(WEC_CUSTOM_MENU.Attribute.ID, keyid);

            if (re > 0)
            {
            }
            Response.Write(re.ToString());
        }
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // string token=WeiXinUtil.Factory(this).getAccessToken();
        //Dictionary<string, List<MenuButton>> o = HttpUtil.getCurrMenu(token);
           // string content = HttpUtil.httpForm("", "https://api.weixin.qq.com/cgi-bin/menu/get?access_token=" + token, "GET");
        //JavaScriptSerializer a = new JavaScriptSerializer();
        //Dictionary<string, List<MenuButton>> o = (Dictionary<string, List<MenuButton>>)a.DeserializeObject(content);
        if (!IsPostBack)
        {

            //List<WEC_CUSTOM_MENU> lstChnl = new List<WEC_CUSTOM_MENU>();
            //if (o.ContainsKey("menu")) {

            //}
            WEC_CUSTOM_MENU objVal = new WEC_CUSTOM_MENU();
            WEC_CUSTOM_MENU objCond = new WEC_CUSTOM_MENU();
            objCond.PID = "0";
            objCond.AID = Convert.ToInt32(userBase2.Curraid);
            objVal.OrderBy(WEC_CUSTOM_MENU.Attribute.SORT_ID, Order.Asc);
            List<WEC_CUSTOM_MENU> lstChnl = BLLTable<WEC_CUSTOM_MENU>.Select(objVal, objCond);
            StringBuilder sb = new StringBuilder();
            if (lstChnl.Count > 0)
            {
                sb.Append("<li id=\"root_0\" data=\"{id:'0',pid:'0',sc:9999,name:'站点栏目管理'}\" class=\"root\"><div class=\"opened\"><b></b><em></em><a href=\"#\">站点栏目管理</a></div>");
                sb.Append("<ul>");
                for (int i = 0; i < lstChnl.Count; i++)
                {
                    StringBuilder sbData = new StringBuilder();
                    string licls = "";
                    if (i == lstChnl.Count - 1)
                    {
                        licls = "last";
                    }

                    if (licls != "") { licls = " class='" + licls + "'"; }
                     objCond = new WEC_CUSTOM_MENU();
                    objCond.PID = lstChnl[i].ID;
                    objCond.AID = Convert.ToInt32(userBase2.Curraid);
                    int subcount = BLLTable<WEC_CUSTOM_MENU>.Factory(conn).Select(new WEC_CUSTOM_MENU(), objCond).Count;
                    sbData.Append("{rid:'0',id:'").Append(lstChnl[i].ID.ToString());
                    sbData.Append("',pid:'").Append(lstChnl[i].PID).Append("',no:").Append(lstChnl[i].SORT_ID.ToString());
                    sbData.Append(",sc:").Append(subcount);
                    sbData.Append(",name:'").Append(lstChnl[i].MENU_NAME).Append("'}");

                    sb.Append("<li " + licls + " id='node_" + lstChnl[i].ID + "' data=\"" + sbData.ToString() + "\"><div><b></b><em></em><a href='#'>" + lstChnl[i].MENU_NAME + "</a></div></li>");
                }
                sb.Append("</ul>");
                sb.Append("</li>");
            }
            else
            {
                sb.Append("<li id=\"root_0\" data=\"{id:'0',pid:'',sc:0,name:'站点栏目管理'}\" class=\"root\"><div><b></b><em></em><a href=\"#\">站点栏目管理</a></div></li>");

            }
            litChnl.Text = sb.ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //显示子节点
        if (Request["ShowSubNodes"] != null)
        {
            #region
            string pid = Request["id"];
            WEC_CUSTOM_MENU obj = new WEC_CUSTOM_MENU();
            WEC_CUSTOM_MENU objval = new WEC_CUSTOM_MENU();
            obj.PID = pid;
            obj.AID = Convert.ToInt32(userBase2.Curraid);
            objval.OrderBy(WEC_CUSTOM_MENU.Attribute.SORT_ID, Order.Asc);

            List<WEC_CUSTOM_MENU> lst = BLLTable<WEC_CUSTOM_MENU>.Select(objval, obj);
            if (lst.Count > 0)
            {
                StringBuilder sb = new StringBuilder("[");
                for (int i = 0; i < lst.Count; i++)
                {
                    if (i > 0)
                    {
                        sb.Append(",");
                    }
                    obj = new WEC_CUSTOM_MENU();
                    obj.PID = lst[i].ID;
                    obj.AID = Convert.ToInt32(userBase2.Curraid);
                    int subcount = BLLTable<WEC_CUSTOM_MENU>.Factory(conn).Select(new WEC_CUSTOM_MENU(), obj).Count;
                    sb.Append("{rid:'").Append(lst[i].PID).Append("',id:'").Append(lst[i].ID.ToString());
                    sb.Append("',pid:'").Append(lst[i].PID.ToString()).Append("',no:").Append(lst[i].SORT_ID);
                    sb.Append(",sc:").Append(subcount);
                    sb.Append(",name:'").Append(lst[i].MENU_NAME).Append("'}");

                }
                sb.Append("]");
                Response.Write(sb.ToString());
            }

            #endregion
        }

        //删除群组
        if (Request["DelNodeID"] != null)
        {
            string keyid = Request["id"];

            int re = BLLTable<WEC_CUSTOM_MENU>.Delete(WEC_CUSTOM_MENU.Attribute.ID, keyid);
            if (re > 0)
            {

            }
            Response.Write(re.ToString());

        }
        Response.End();
    }
Exemple #5
0
    public static string GetNewMenuID(string parentid)
    {
        if (parentid == "")
        {
            parentid = "0";
        }
        string          code    = "0";
        WEC_CUSTOM_MENU objCond = new WEC_CUSTOM_MENU();

        objCond.PID = parentid;
        object ooo = BLLTable <WEC_CUSTOM_MENU> .Max(WEC_CUSTOM_MENU.Attribute.ID, objCond); //010203

        string mcode = ooo == null ? "" : ooo.ToString();                                    //010203

        if (mcode == null || mcode == "")
        {
            if (parentid == "0")
            {
                code = parentid + "1";
            }
            else
            {
                code = parentid + "01";
            }
        }
        else
        {
            string lasttwo    = mcode.Substring(mcode.Length - 2);
            int    ltwo       = Convert.ToInt32(lasttwo, 16) + 1;
            string newlasttwo = Convert.ToString(ltwo, 16);
            if (newlasttwo.Length < 2)
            {
                newlasttwo = "0" + newlasttwo;
            }
            else if (newlasttwo.Length > 2)//编号后两位达到上限FF,只能遍历是否有空位
            {
                string prefore = mcode.Substring(0, mcode.Length - 2);
                objCond.OrderBy(WEC_CUSTOM_MENU.Attribute.ID, Order.Asc);

                DataTable dt = BLLTable <WEC_CUSTOM_MENU> .SelectForDataTable(new WEC_CUSTOM_MENU(), objCond);

                DataView dv = new DataView();
                dv.Table = dt;
                string aaa = "";
                newlasttwo = "";
                for (int i = 1; i <= 255; i++)
                {
                    aaa = Convert.ToString(i, 16);
                    if (aaa.Length < 2)
                    {
                        aaa = "0" + aaa;
                    }
                    dv.RowFilter = "DEPT_ID='" + prefore + aaa + "'";
                    if (dv.Count <= 0)//找到空位
                    {
                        newlasttwo = aaa;
                        break;
                    }
                }
            }
            if (newlasttwo != "")//号码没有用完
            {
                code = mcode.Substring(0, mcode.Length - 2) + newlasttwo;
            }
        }
        return(code);
    }
    public static string GetNewMenuID(string parentid)
    {
        if (parentid == "")
        {
            parentid = "0";
        }
        string code = "0";
        WEC_CUSTOM_MENU objCond = new WEC_CUSTOM_MENU();
        objCond.PID = parentid;
        object ooo = BLLTable<WEC_CUSTOM_MENU>.Max(WEC_CUSTOM_MENU.Attribute.ID, objCond);//010203
        string mcode = ooo == null ? "" : ooo.ToString();//010203
        if (mcode == null || mcode == "")
        {
            if (parentid == "0")
            {
                code = parentid + "1";
            }
            else
            {
                code = parentid + "01";
            }
        }
        else
        {

            string lasttwo = mcode.Substring(mcode.Length - 2);
            int ltwo = Convert.ToInt32(lasttwo, 16) + 1;
            string newlasttwo = Convert.ToString(ltwo, 16);
            if (newlasttwo.Length < 2)
            {
                newlasttwo = "0" + newlasttwo;
            }
            else if (newlasttwo.Length > 2)//编号后两位达到上限FF,只能遍历是否有空位
            {
                string prefore = mcode.Substring(0, mcode.Length - 2);
                objCond.OrderBy(WEC_CUSTOM_MENU.Attribute.ID, Order.Asc);

                DataTable dt = BLLTable<WEC_CUSTOM_MENU>.SelectForDataTable(new WEC_CUSTOM_MENU(), objCond);
                DataView dv = new DataView();
                dv.Table = dt;
                string aaa = "";
                newlasttwo = "";
                for (int i = 1; i <= 255; i++)
                {
                    aaa = Convert.ToString(i, 16);
                    if (aaa.Length < 2)
                    {
                        aaa = "0" + aaa;
                    }
                    dv.RowFilter = "DEPT_ID='" + prefore + aaa + "'";
                    if (dv.Count <= 0)//找到空位
                    {
                        newlasttwo = aaa;
                        break;
                    }
                }
            }
            if (newlasttwo != "")//号码没有用完
            {
                code = mcode.Substring(0, mcode.Length - 2) + newlasttwo;
            }
        }
        return code;
    }