private bool DoAdd()
        {
            string strErr = "";

            if (this.txtwxName.Text.Trim().Length == 0)
            {
                strErr += "公众帐号名称不能为空!";
            }
            if (this.txtwxId.Text.Trim().Length == 0)
            {
                strErr += "公众号原始id不能为空!";
            }

            if (this.txtweixinCode.Text.Trim().Length == 0)
            {
                strErr += "微信号不能为空!";
            }
            if (this.txtwxToken.Text.Trim().Length == 0)
            {
                strErr += "TOKEN值不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");

                return(false);
            }
            Model.manager manager = GetAdminInfo();
            int           uId     = manager.id;
            string        wxName  = this.txtwxName.Text;
            string        wxId    = this.txtwxId.Text;

            string   weixinCode = this.txtweixinCode.Text;
            string   wxPwd      = "";
            string   headerpic  = this.txtImgUrl.Text;
            string   apiurl     = "";
            string   wxToken    = this.txtwxToken.Text;
            string   wxProvince = "";
            string   wxCity     = "";
            string   AppId      = this.txtAppId.Text;
            string   AppSecret  = this.txtAppSecret.Text;
            DateTime createDate = DateTime.Now;
            DateTime endDate    = DateTime.Now.AddYears(1);


            Model.wx_userweixin model = new Model.wx_userweixin();

            model.uId            = uId;
            model.wxName         = wxName;
            model.wxId           = wxId;
            model.yixinId        = "";
            model.weixinCode     = weixinCode;
            model.wxPwd          = wxPwd;
            model.headerpic      = headerpic;
            model.apiurl         = apiurl;
            model.wxToken        = wxToken;
            model.wxProvince     = wxProvince;
            model.wxCity         = wxCity;
            model.AppId          = AppId;
            model.AppSecret      = AppSecret;
            model.Access_Token   = "";
            model.openIdStr      = "";
            model.createDate     = createDate;
            model.endDate        = endDate;
            model.wenziMaxNum    = -1;//-1为无限制
            model.tuwenMaxNum    = -1;
            model.yuyinMaxNum    = -1;
            model.wenziDefineNum = 0;
            model.tuwenDefineNum = 0;
            model.yuyinDefineNum = 0;
            model.requestTTNum   = 0;
            model.requestUsedNum = 0;
            model.smsTTNum       = 0;
            model.smsUsedNum     = 0;
            model.isDelete       = false;

            model.remark = "";
            model.seq    = 99;

            if (IsChaoGuoWxNum())
            {
                return(false);
            }

            int wId = bll.Add(model);

            this.id = wId;
            if (wId > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.id + ",微信号为:" + model.weixinCode); //记录日志
                return(true);
            }
            return(false);
        }
Exemple #2
0
        private bool DoAdd()
        {
            string strErr = "";

            if (this.txtwxName.Text.Trim().Length == 0)
            {
                strErr += "公众帐号名称不能为空!";
            }
            if (this.txtwxId.Text.Trim().Length == 0)
            {
                strErr += "公众号原始id不能为空!";
            }

            if (this.txtweixinCode.Text.Trim().Length == 0)
            {
                strErr += "微信号不能为空!";
            }
            if (this.txtwxToken.Text.Trim().Length == 0)
            {
                strErr += "TOKEN值不能为空!";
            }

            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");

                return(false);
            }
            Model.manager manager = GetAdminInfo();
            int           uId     = manager.id;
            string        wxName  = this.txtwxName.Text;
            string        wxId    = this.txtwxId.Text;

            string   weixinCode     = this.txtweixinCode.Text;
            string   wxPwd          = "";
            string   headerpic      = this.txtImgUrl.Text;
            string   apiurl         = "";
            string   wxToken        = this.txtwxToken.Text;
            string   wxProvince     = "";
            string   wxCity         = "";
            string   AppId          = this.txtAppId.Text;
            string   AppSecret      = this.txtAppSecret.Text;
            string   EncodingAESKey = txtEncodingAESKey.Text;
            DateTime createDate     = DateTime.Now;
            DateTime endDate        = DateTime.Now.AddYears(1);


            Model.wx_userweixin model = new Model.wx_userweixin();

            model.uId            = uId;
            model.wxName         = wxName;
            model.wxId           = wxId;
            model.yixinId        = "";
            model.weixinCode     = weixinCode;
            model.wxPwd          = wxPwd;
            model.headerpic      = headerpic;
            model.apiurl         = apiurl;
            model.wxToken        = wxToken;
            model.wxProvince     = wxProvince;
            model.wxCity         = wxCity;
            model.AppId          = AppId;
            model.AppSecret      = AppSecret;
            model.Access_Token   = "";
            model.openIdStr      = "";
            model.createDate     = createDate;
            model.endDate        = endDate;
            model.wenziMaxNum    = -1;//-1为无限制
            model.tuwenMaxNum    = -1;
            model.yuyinMaxNum    = -1;
            model.wenziDefineNum = 0;
            model.tuwenDefineNum = 0;
            model.yuyinDefineNum = 0;
            model.requestTTNum   = 0;
            model.requestUsedNum = 0;
            model.smsTTNum       = 0;
            model.smsUsedNum     = 0;
            model.isDelete       = false;
            model.extStr         = EncodingAESKey;//暂存入extStr字段里

            model.remark = "";
            model.seq    = 99;

            if (IsChaoGuoWxNum())
            {
                return(false);
            }

            int wId = bll.Add(model);

            this.id = wId;
            if (wId > 0)
            {
                Object obj = ConfigurationManager.AppSettings["industry_defaultAdd"];
                if (obj != null && obj.ToString() == "true")
                {
                    //根据登录者所在行业为微帐号添加相应默认模块
                    Model.manager mModel = GetAdminInfo(); //取得管理员信息
                    BLL.wx_industry_defaultModule idBll = new wx_industry_defaultModule();
                    idBll.addMouduleByRoleid(mModel.role_id, wId);
                }

                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.id + ",微信号为:" + model.weixinCode); //记录日志
                return(true);
            }
            return(false);
        }