Inheritance: IWxJsonResult
コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="message"></param>
        /// <param name="inner"></param>
        /// <param name="jsonResult"></param>
        /// <param name="url"></param>
        public ErrorJsonResultException(string message, Exception inner, WxJsonResult jsonResult, string url = null)
            : base(message, inner)
        {
            JsonResult = jsonResult;
            Url = url;

            WeixinTrace.ErrorJsonResultExceptionLog(this);
        }
コード例 #2
0
 public ErrorJsonResultException(string message, Exception inner, WxJsonResult jsonResult)
     : base(message, inner)
 {
     JsonResult = jsonResult;
 }
コード例 #3
0
        protected void btnok_Click(object sender, System.EventArgs e)
        {
            AccessTokenResult token = CommonApi.GetToken(SinGooCMS.Weixin.Config.AppID, SinGooCMS.Weixin.Config.AppSecret, "client_credential");

            System.Collections.Generic.List <WxMenuInfo>     list             = WxMenu.GetList(15, "", " RootID ASC,ParentID ASC,Sort ASC ") as System.Collections.Generic.List <WxMenuInfo>;
            System.Collections.Generic.Dictionary <int, int> repeaterSortDict = base.GetRepeaterSortDict(this.Repeater1, "txtsort", "autoid");
            foreach (WxMenuInfo current in list)
            {
                current.Sort = repeaterSortDict[current.AutoID];
            }
            list = (from p in list
                    orderby p.RootID
                    orderby p.ParentID
                    orderby p.Sort
                    select p).ToList <WxMenuInfo>();
            if (WxMenu.UpdateSort(repeaterSortDict))
            {
                PageBase.log.AddEvent(base.LoginAccount.AccountName, "更新微信菜单排序成功");
            }
            ButtonGroup buttonGroup = new ButtonGroup();

            foreach (WxMenuInfo level1 in list)
            {
                if (level1.ParentID.Equals(0))
                {
                    if (level1.ChildCount > 0)
                    {
                        SubButton subButton = new SubButton
                        {
                            name = level1.Name
                        };
                        System.Collections.Generic.IEnumerable <WxMenuInfo> enumerable = from p in list
                                                                                         where p.ParentID.Equals(level1.AutoID)
                                                                                         select p;
                        if (enumerable != null && enumerable.Count <WxMenuInfo>() > 0)
                        {
                            foreach (WxMenuInfo current2 in enumerable)
                            {
                                string type = current2.Type;
                                if (type != null)
                                {
                                    if (!(type == "click"))
                                    {
                                        if (type == "view")
                                        {
                                            subButton.sub_button.Add(new SingleViewButton
                                            {
                                                name = current2.Name,
                                                url  = current2.Url
                                            });
                                        }
                                    }
                                    else
                                    {
                                        subButton.sub_button.Add(new SingleClickButton
                                        {
                                            name = current2.Name,
                                            key  = current2.EventKey
                                        });
                                    }
                                }
                            }
                        }
                        buttonGroup.button.Add(subButton);
                    }
                    else
                    {
                        string type = level1.Type;
                        if (type != null)
                        {
                            if (!(type == "click"))
                            {
                                if (type == "view")
                                {
                                    buttonGroup.button.Add(new SingleViewButton
                                    {
                                        name = level1.Name,
                                        url  = level1.Url
                                    });
                                }
                            }
                            else
                            {
                                buttonGroup.button.Add(new SingleClickButton
                                {
                                    name = level1.Name,
                                    key  = level1.EventKey
                                });
                            }
                        }
                    }
                }
            }
            Senparc.Weixin.Entities.WxJsonResult wxJsonResult = Senparc.Weixin.MP.CommonAPIs.CommonApi.CreateMenu(token.access_token, buttonGroup, 10000);
            if (wxJsonResult.errcode == ReturnCode.请求成功)
            {
                PageBase.log.AddEvent(base.LoginAccount.AccountName, "更新微信菜单成功");
                base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công");
                this.BindData();
            }
            else
            {
                PageBase.log.AddErrLog("更新微信菜单出错了", wxJsonResult.errmsg);
                base.ShowAjaxMsg(this.UpdatePanel1, wxJsonResult.errmsg);
            }
        }
コード例 #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="message"></param>
 /// <param name="inner"></param>
 /// <param name="jsonResult"></param>
 /// <param name="url"></param>
 public ErrorJsonResultException(string message, Exception inner, WxJsonResult jsonResult, string url = null)
     : base(message, inner)
 {
     JsonResult = jsonResult;
     Url = url;
 }