//我收到的通知 public ActionResult getReceiveList(NoticeCondition condition) { User user = TheApp.currentUser; if (user == null) { return(Redirect("/Home/Login")); } int pagesize = int.Parse(Request["rows"]); int pagenum = int.Parse(Request["page"]); if (condition == null) { condition = new NoticeCondition(); } NoticeReceiverDao dao = new NoticeReceiverDao(); List <NoticeReceiver> list = dao.getReceiveNotice(user.Id, pagenum, pagesize, condition); int total = dao.getReceiveCount(user.Id); dao.Dispose(); JsonData data = new JsonData(); data.rows = list; data.total = total; return(Json(data)); }
public ActionResult getNoticeList(int pagenum, int pagesize, string userId, string type) { List <XinFangAndroid.Adapter.Notice> andNoticeList = new List <XinFangAndroid.Adapter.Notice>(); MyJsonResult result = new MyJsonResult(); pagenum = pagenum == 0 ? 1 : pagenum; pagesize = pagesize == 0 ? 5 : pagesize; //string type = Request.Form["type"]; //通知类型:1: 我发布的 2: 我收到的 if (string.IsNullOrEmpty(userId) || string.IsNullOrEmpty(type)) { result.message = "参数错误"; return(Json(result)); } int count; if (int.Parse(type) == 1) { NoticeDao dao = new NoticeDao(); List <Notice> list = dao.getRelease(int.Parse(userId), pagenum, pagesize, out count, null); foreach (var item in list) { XinFangAndroid.Adapter.Notice note = new XinFangAndroid.Adapter.Notice(item.Id, item.Sender, item.Title, item.Content, item.CreateTime); andNoticeList.Add(note); } dao.Dispose(); result.success = true; result.data = andNoticeList; return(Json(result)); } else if (int.Parse(type) == 2) { NoticeReceiverDao dao = new NoticeReceiverDao(); List <NoticeReceiver> list = dao.getReceiveNotice(int.Parse(userId), pagenum, pagesize, null); dao.Dispose(); result.success = true; result.data = list; return(Json(result)); } else { throw new ApplicationException("类型错误"); } }