예제 #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Text = "";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            this.htmlAppID = masterSettings.WeixinAppId;
            string weixinAppSecret = masterSettings.WeixinAppSecret;

            try
            {
                this.htmlToken = this.GetToken(this.htmlAppID, weixinAppSecret);
            }
            catch (Exception)
            {
            }
            this.htmlTimeStamp = WeixinSet.ConvertDateTimeInt(DateTime.Now).ToString();
            this.htmlSignature = this.GetSignature(this.htmlToken, this.htmlTimeStamp, this.htmlNonceStr, out this.htmlstring1);
            string token = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);

            MenuApi.GetMenus(token);
            base.Text = string.Concat(new string[]
            {
                "<script>wx.config({ debug: false,appId: '",
                this.htmlAppID,
                "',timestamp: '",
                this.htmlTimeStamp,
                "', nonceStr: '",
                this.htmlNonceStr,
                "',signature: '",
                this.htmlSignature,
                "',jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','getLocation']});</script>"
            });
            base.Render(writer);
        }
예제 #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            List <Menus> list = null;

            ControlHelper.ThreadRunExt(AppHelper.MainForm, () =>
            {
                var succ = true;
                var msg  = "";
                try
                {
                    ResponseModel responseModel = new ResponseModel();
                    MenuApi menuApi             = new MenuApi();
                    responseModel = menuApi.GetMenus();


                    if (responseModel.Code == 1)
                    {
                        if (responseModel.DataCount > 0)
                        {
                            list = JsonConvert.DeserializeObject <List <Menus> >(responseModel?.Data?.ToString());
                            ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                            {
                                if (list != null)
                                {
                                    CGridHelper.ClearGrid(dgv);
                                    CGridHelper.FillGrid <Menus>(dgv, list);
                                }
                            });
                        }
                        else
                        {
                            succ = false;
                            msg  = "查询数据为空!";
                        }
                    }
                    else
                    {
                        succ = false;
                        msg  = responseModel?.Message;
                    }
                }
                catch (Exception ex)
                {
                    succ = false;
                    msg  = ex.Message;
                }
                if (!succ)
                {
                    ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () =>
                    {
                        FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error);
                    });
                }
            }, null, AppHelper.MainForm, true, "正在查询……", 200);
        }
예제 #3
0
        private void Init()
        {
            List <Menus> menus = new List <Menus>();

            menus.Add(new Menus()
            {
                Id       = 0,
                MenuName = "请选择"
            });

            MenuApi menuApi  = new MenuApi();
            var     response = menuApi.GetMenus();

            if (response.Code == 1 && response.DataCount > 0)
            {
                var menus1 = JsonConvert.DeserializeObject <List <Menus> >(response.Data?.ToString());
                menus.AddRange(menus1);
            }
            combMenus.DataSource    = menus;
            combMenus.DisplayMember = "MenuName";
            combMenus.ValueMember   = "Id";
        }
예제 #4
0
 public string GetMenu()
 {
     return(MenuApi.GetMenus(this.GetToken()));
 }
예제 #5
0
        public string GetMenu()
        {
            string token = this.GetToken();

            return(MenuApi.GetMenus(token));
        }