public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     BLL.UserBLL helper = new BLL.UserBLL();
     //判断Session,验证权限
     if (context.Session["User"] != null&&context.Session["Admin"] != null)
     {
         int id = -1;
         int.TryParse(context.Request["id"], out id);
         if (id > 0)
         {
             if (helper.Delete(id))
             {
                 context.Response.Write("true");
             }
             else
             {
                 context.Response.Write("false");
             }
         }
         else
         {
             context.Response.Write("parameters error!");
         }
     }
     else
     {
         context.Response.Write("no permission!");
     }
 }
Example #2
0
        public string DeleteUser(int id)
        {
            BLL.UserBLL bll    = new BLL.UserBLL();
            bool        result = bll.Delete(id);

            if (result)
            {
                return("删除用户成功".ToJson());
            }
            else
            {
                return("删除用户失败!".ToJson());
            }
        }
        //删除数据
        protected void lbDel_Click(object sender, CommandEventArgs e)
        {
            User_Load("student-list");
            string oname = Getoname();

            Daiv_OA.BLL.StudentBLL studentBll = new Daiv_OA.BLL.StudentBLL();
            Daiv_OA.BLL.UserBLL    userBll    = new BLL.UserBLL();
            int sid = Convert.ToInt32(e.CommandArgument);

            Entity.StudentEntity studentEntity = studentBll.GetEntity(sid);
            studentBll.Delete(sid);
            Entity.UserEntity userEntity = userBll.GetEntity(studentEntity.Uid);
            userBll.Delete(studentEntity.Uid);//连同家长的账号也一起删除
            logHelper.logInfo("删除学生成功!操作人:" + oname);
            string stuStr  = Newtonsoft.Json.JsonConvert.SerializeObject(studentEntity);
            string userStr = Newtonsoft.Json.JsonConvert.SerializeObject(studentEntity);

            logHelper.logInfo("删除学生:" + stuStr);
            logHelper.logInfo("删除家长:" + userStr);
            Adminlogadd(oname);
            Bind();
        }