コード例 #1
0
 //删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("user_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     BLL.user bll = new BLL.user();
     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);
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除产品分类数据"); //记录日志
     JscriptMsg("删除数据成功!", Utils.CombUrlTxt("user_list.aspx", "", ""));
 }
コード例 #2
0
ファイル: delete.ashx.cs プロジェクト: ueruoji/Bookhole_blog
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = 0;

            //图片
            if (context.Request["page"] == "img")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.img bll_img = new BLL.img();
                if (bll_img.Delete(id) == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //用户
            if (context.Request["page"] == "user")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.user bll_user = new BLL.user();
                if (bll_user.Delete(id) == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客评论
            if (context.Request["page"] == "tell")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.tell bll_tell    = new BLL.tell();
                bool     tell_delete = bll_tell.Delete(id);
                if (tell_delete == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客
            if (context.Request["page"] == "blog")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.blogs bll_blog    = new BLL.blogs();
                bool      blog_delete = bll_blog.Delete(id);
                if (blog_delete == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
            //博客类型
            if (context.Request["page"] == "type")
            {
                id = Convert.ToInt32(context.Request["id"]);
                BLL.blog_type bll_type = new BLL.blog_type();
                bool          a        = bll_type.Delete(id);
                if (a == true)
                {
                    context.Response.Write("删除成功");
                }
                else
                {
                    context.Response.Write("删除失败");
                }
            }
        }