示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bll         = new AppInfoService();
            aBll        = new WXAgentService(new AgentRepository());
            adminEntity = GetAdminInfo(); //取得管理员信息
            agent       = aBll.GetAgentModel(adminEntity.Id);
            if (!Page.IsPostBack)
            {
                int id = 0;

                if (!int.TryParse(Request.QueryString["id"] as string, out id))
                {
                    JscriptMsg("传输参数不正确!", "back", "Error");
                    return;
                }
                if (!bll.Exists(id))
                {
                    JscriptMsg("记录不存在或已被删除!", "back", "Error");
                    return;
                }
                returnPage = "wxcodemgr.aspx";
                //如果是从微用户管理里来的,还得判断下
                if (MyCommFun.QueryString("fpage").Trim().Length > 0 && MyCommFun.RequestInt("uid") > 0)
                {
                    returnPage = "weixin_list.aspx?id=" + MyCommFun.RequestInt("uid");
                }
                ShowInfo(id);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                _appInfoService = new AppInfoService();

                if (CurrentAction == MXEnums.ActionEnum.Edit)
                {
                    if (!int.TryParse(Request.QueryString["id"] as string, out this.Id))
                    {
                        JscriptMsg("传输参数不正确!", "back", "Error");
                        return;
                    }
                    if (!_appInfoService.Exists(this.Id))
                    {
                        JscriptMsg("记录不存在或已被删除!", "back", "Error");
                        return;
                    }
                }
                else
                {
                    //添加,则需要判断可以添加的微信号数量
                    if (IsChaoGuoWxNum())
                    {
                        return;
                    }
                }

                if (!IsPostBack)
                {
                    txtapiurl.Text = MyCommFun.getWebSite() + "/api/weixin/api.aspx";
                    //  ChkAdminLevel("manager_list", MXEnums.ActionEnum.View.ToString()); //检查权限
                    //1e2124dd04e11d01b9df2865f85944be
                    var model = GetAdminInfo();                        //取得管理员信息

                    if (this.CurrentAction == MXEnums.ActionEnum.Edit) //修改
                    {
                        ShowInfo(this.Id);
                    }
                    else
                    {
                        txtEncodingAESKey.Text = Utils.GetLetterOrNumberRandom(43);
                        txtwxToken.Text        = Utils.GetLetterOrNumberRandom(10);
                    }
                }
            }
            catch (Exception exception)
            {
                JscriptMsg(exception.Message, "back", "Error");
            }
        }