示例#1
0
        //我收到的通知
        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));
        }
示例#2
0
        public ActionResult setToRead(int id)
        {
            if (id == 0)
            {
                return(null);
            }
            NoticeReceiverDao dao = new NoticeReceiverDao();

            dao.setToRead(id);
            dao.Dispose();
            return(null);
        }
示例#3
0
        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("类型错误");
            }
        }
示例#4
0
        public ActionResult ReceiveDetail()
        {
            string idStr = Request["id"];

            if (string.IsNullOrEmpty(idStr))
            {
                throw new ApplicationException("未传入指定参数");
            }
            int id = int.Parse(idStr);
            NoticeReceiverDao dao  = new NoticeReceiverDao();
            NoticeReceiver    item = dao.get(id);

            if (item == null)
            {
                throw new ApplicationException("未找到该通知信息" + id);
            }
            if (item.Status == NoticeStatus.Unread)
            {
                dao.setToRead(id);
            }
            dao.Dispose();
            return(View(item));
        }