Example #1
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page        = MXRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            //   BLL.manager bll = new BLL.manager();
            BLL.wx_agent_info agentBll = new BLL.wx_agent_info();
            this.rptList.DataSource = agentBll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("agent_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Example #2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("manager_list", MXEnums.ActionEnum.Delete.ToString()); //检查权限

            bool isAgent = false;

            BLL.wx_agent_info   aBll        = new BLL.wx_agent_info();
            Model.manager       adminEntity = GetAdminInfo(); //取得管理员信息
            Model.wx_agent_info agent       = new Model.wx_agent_info();
            if (adminEntity.agentLevel > 0)
            {
                isAgent = true;
                agent   = aBll.GetAgentModel(adminEntity.id);
            }

            BLL.wx_userweixin wBll = new BLL.wx_userweixin();
            int sucCount           = 0;
            int errorCount         = 0;

            BLL.manager bll = new BLL.manager();
            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");
        }