Exemplo n.º 1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.users bll = new BLL.users();
     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)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords));
 }
Exemplo n.º 2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            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)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("user_list.aspx",
                                                                                        "site_id={0}&group_id={1}&start_time={2}&end_time={3}&keywords={4}",
                                                                                        this.site_id.ToString(), this.group_id.ToString(), this.start_time, this.end_time, this.keywords));
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("outlet_user_level", Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            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)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(Vincent._DTcms.DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
                       Vincent._DTcms.Utils.CombUrlTxt("outlet_user_details.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords), "Success");
        }
Exemplo n.º 4
0
        //批次刪除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevelEdit("user_list", "Edit");
            //ChkAdminLevel("user_list", TWEnums.ActionEnum.Delete.ToString()); //檢查許可權
            int sucCount   = 0;
            int errorCount = 0;

            BLL.users bll = new BLL.users();
            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)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(TWEnums.ActionEnum.Delete.ToString(), "刪除用戶" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
            JscriptMsg("刪除成功" + sucCount + "條,失敗" + errorCount + "條!",
                       Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}", this.group_id.ToString(), this.keywords));
        }
Exemplo n.º 5
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            var sucCount   = 0;
            var errorCount = 0;
            var bll        = new BLL.users();
            var context    = new Agp2pDataContext();

            for (var i = 0; i < rptList.Items.Count; i++)
            {
                var id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                var cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    //查询该用户钱包
                    var walletDel = context.li_wallets.FirstOrDefault(w => w.user_id == id);
                    if (walletDel != null)
                    {
                        var wallet_historiesDel = context.li_wallet_histories.Where(wh => wh.user_id == id).ToList();
                        //无资金流水的会员可以删除
                        if (!wallet_historiesDel.Any())
                        {
                            context.li_wallet_histories.DeleteAllOnSubmit(wallet_historiesDel);
                            context.li_wallets.DeleteOnSubmit(walletDel);
                            try
                            {
                                context.SubmitChanges();
                            }
                            catch (Exception ex)
                            {
                                AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户" + id + "失败:" + ex.Message);
                                errorCount += 1;
                                continue;
                            }
                        }
                    }

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

            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除用户" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
                       Utils.CombUrlTxt("user_audit.aspx", "keywords={0}", txtKeywords.Text), "Success");
        }
Exemplo n.º 6
0
 //批次刪除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權
     BLL.users bll = new BLL.users();
     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)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批次刪除成功啦!", Utils.CombUrlTxt("shop_list.aspx", "group_id={0}&keywords={1}",
                                             this.group_id.ToString(), this.keywords), "Success");
 }
Exemplo n.º 7
0
        protected int pagesize;   //每页记录条数

        protected void Page_Load(object sender, EventArgs e)
        {
            pagesize = GetPageSize(20); //每面数据
            string action = Request.QueryString["action"];

            if (!IsPostBack)
            {
                RptBind("1=1 " + CombSqlTxt("", "", ""));
            }

            if (!string.IsNullOrEmpty(action))
            {
                string id = Request.QueryString["ID"];
                bll.Delete(int.Parse(id));
            }
        }
Exemplo n.º 8
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("users", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.users bll = new BLL.users();
     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)
         {
             bll.Delete(id);
         }
     }
     JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("user_list.aspx", "group_id={0}&keywords={1}",
         this.group_id.ToString(), this.keywords), "Success");
 }
Exemplo n.º 9
0
        public ActionResult Delete(FormCollection collection)
        {
            string strJson = "";

            Model.users model = new Model.users();
            string      ids   = HttpContext.Request.Form["Id"];

            try
            {
                //事务保证同时更新状态
                using (TransactionScope ts = new TransactionScope())
                {
                    int      count = 0;//删除标识记录
                    string[] Ids   = ids.Split(',');
                    for (int i = 0; i < Ids.Length; i++)
                    {
                        model = bll.GetModel(Convert.ToInt32(Ids[i]));
                        if (model != null)
                        {
                            if (bll.Delete(Convert.ToInt32(Ids[i])))
                            {
                                count++;
                            }
                        }
                    }

                    if (Ids.Length == count)
                    {
                        ts.Complete();
                        strJson = "{\"type\":\"1\",\"msg\":\"删除成功!\"}";
                    }
                    else
                    {
                        strJson = "{\"type\":\"0\",\"msg\":\"删除失败!\"}";
                    }
                }
            }
            catch (Exception ex)
            {
                strJson = "{\"type\":\"0\",\"msg\":\"" + ex.Message + "\"}";
            }
            return(Content(strJson));
        }
Exemplo n.º 10
0
        public void DeleteUser()
        {
            string id     = Common.DTRequest.GetFormString("userid");
            string strmsg = "";

            if (!string.IsNullOrEmpty(id))
            {
                BLL.users bll = new BLL.users();
                if (bll.Delete(int.Parse(id)))
                {
                    strmsg = @"{Success:true,Msg:'删除成功'}";
                }
                else
                {
                    strmsg = @"{Success:false,Msg:'删除失败'}";
                }
            }
            object jsonobj = JsonConvert.DeserializeObject(strmsg);

            Context.Response.Write(jsonobj.ToString());
            Context.Response.End();
        }
Exemplo n.º 11
0
        public Int32 Delete(BOL.users obj)
        {
            if (obj != null)
            {
                try
                {
                    conn = new MySqlConnection(ConnectionString);
                    conn.Open();
                    trans = conn.BeginTransaction();

                    bll_users.Delete(obj, conn, trans);

                    trans.Commit();
                    conn.Close();
                    return(obj.Userid);
                }
                catch
                {
                    trans.Rollback();
                    conn.Close();
                }
            }
            return(0);
        }
Exemplo n.º 12
0
 /// <summary>
 /// 删除用户ID
 /// </summary>
 protected void deleteUserID(string id)
 {
     BLL.users bll = new BLL.users();
     bll.Delete(int.Parse(id));
 }