Ejemplo n.º 1
0
        /// <summary>
        ///  判断已经有的微信个数,若超过,则不能添加
        ///  1e2124dd04e11d01b9df2865f85944be
        /// </summary>
        /// <returns>超过为true,未超过为false</returns>
        private bool IsChaoGuoWxNum()
        {
            var manager = GetAdminInfo();
            int hasNum  = _appInfoService.GetUserWxNumCount(manager.Id);

            if (hasNum >= manager.WxNum)
            {
                JscriptMsg("你只能添加" + manager.WxNum + "个微信公众帐号,若想添加多个,请联系管理员!", "myweixinlist.aspx", "Error");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  判断已经有的微信个数,若超过,则不能添加
        /// </summary>
        /// <returns>超过为true,未超过为false</returns>
        private bool IsChaoGuoWxNum()
        {
            var mBll    = new ManagerInfoService();
            var manager = mBll.GetModel(this.uid);

            int hasNum = bll.GetUserWxNumCount(this.uid);

            if (hasNum >= manager.WxNum)
            {
                JscriptMsg("该用户只能添加" + manager.WxNum + "个微信公众帐号,若想添加多个,请联系管理员!", "weixin_list.aspx?id=" + uid, "Error");
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限

            bool isAgent     = false;
            var  aBll        = new WXAgentService(new AgentRepository());
            var  adminEntity = GetAdminInfo(); //取得管理员信息
            var  agent       = new AgentInfo();

            if (adminEntity.AgentLevel > 0)
            {
                isAgent = true;
                agent   = aBll.GetAgentModel(adminEntity.Id);
            }

            var wBll       = new AppInfoService();
            int sucCount   = 0;
            int errorCount = 0;

            var bll = new ManagerInfoService();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    int hasNum = wBll.GetUserWxNumCount(id);
                    if (hasNum > 0)
                    {
                        JscriptMsg("该用户已经添加微信号,无法删除!", "back", "Error");
                        return;
                    }
                }
            }

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    int hasNum = wBll.GetUserWxNumCount(id);


                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }

            if (isAgent && agent != null)
            {
                //如果为代理商,则将起用户数量减掉
                agent.UserNum -= sucCount;
                aBll.Update(agent);
            }
            AddAdminLog(MXEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("manager_list.aspx", "keywords={0}", this.keywords), "Success");
        }