public JsonResult Del(Int32 id) { if (entityDao.Del(id) > 0) { return(Success("删除成功!", null)); } else { return(Fail("删除失败!")); } }
//---------------删除任务、删除任务记录-------------- public ActionResult deleteC(String cid, String tid) { if (String.IsNullOrWhiteSpace(cid)) { return(Fail("error")); } String uid = Convert.ToString(Session["uid"]); T_Task_HistoryDAO deledao = new T_Task_HistoryDAO(); T_Task_History deleC = deledao.GetById(Convert.ToInt32(cid)); deleC.id = Convert.ToInt32(cid); if (deleC.descr == "发布任务") { int roleid = Convert.ToInt32(Session["roleid"]); if (roleid == 2) { List <T_Task_History> l = deledao.GetAllByModel(new T_Task_History() { taskId = Convert.ToInt32(tid) }); //-------- 一方管理员删除任务时,先删除所有的历史记录,再删除任务 foreach (T_Task_History t in l) { deledao.Del(Convert.ToInt32(t.id)); } T_TaskDAO tdao = new T_TaskDAO(); T_Task deleT = tdao.GetById(Convert.ToInt32(tid)); deleT.id = Convert.ToInt32(Session["tid"]); Session["fid"] = tid; int result = tdao.Del(Convert.ToInt32(Session["tid"])); if (result > 0) { return(Success("已删除!", null)); } else { return(Success("未通过!", null)); } } else { deledao.Del(Convert.ToInt32(cid)); T_TaskDAO tdao = new T_TaskDAO(); T_Task deleT = tdao.GetById(Convert.ToInt32(tid)); deleT.id = Convert.ToInt32(Session["tid"]); Session["fid"] = tid; int result = tdao.Del(Convert.ToInt32(Session["tid"])); if (result > 0) { return(Success("已删除!", null)); } else { return(Success("未通过!", null)); } } } else { //删除任务汇报 deledao.Del(Convert.ToInt32(cid)); } return(Success("已删除!", null)); }