public void test() { UserDao d = new UserDao(); User u = d.get(79); d.Dispose(); WarningDao dao = new WarningDao(); //var q = dao.getWarningList(u); dao.Dispose(); }
public ActionResult getList() { User user = TheApp.currentUser; if (user == null) { return(Redirect("/Home/Login")); } int pagesize = int.Parse(Request["rows"]); int pagenum = int.Parse(Request["page"]); WarningDao dao = new WarningDao(); List <Warning> list = dao.getWarningList(user, pagesize, pagenum); int total = dao.getCount(user); dao.Dispose(); JsonData data = new JsonData(); data.rows = list; data.total = total; return(Json(data)); }
public ActionResult Detail() { string idStr = Request["warningId"]; if (string.IsNullOrEmpty(idStr)) { throw new ApplicationException("未传入指定参数"); } int warningId = int.Parse(idStr); WarningDao dao = new WarningDao(); Warning warning = dao.get(warningId); dao.Dispose(); if (warning == null) { throw new ApplicationException("未找到该预警信息" + warningId); } List <string> list = StringUtil.ImageSplit(warning.Image); ViewData["ImageList"] = list; return(View(warning)); }