Exemple #1
0
 public ActionResult DeleteOneMessage(int id)
 {
     int count;
     bizUserMsg um = new bizUserMsg();
     List<UserMsgDetail> list = um.ListDetail(UserID, 0, 0, 50, out count);
     um.DeleteOneMessage(UserID, id);
     int index = 0;
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i].UserMsgID == id)
         {
             index = i;
             break;
         }
     }
     int msgID=0;
     if (list.Count > (index + 1))
         msgID = list[index + 1].UserMsgID;
     else if (index > 1)
         msgID = list[index - 1].UserMsgID;
     else
         msgID = 0;
     return Redirect("/bbsbar/UserMsg/" + msgID + ".html");
 }
Exemple #2
0
        public ActionResult UserMsg(int id)
        {
            int count;
            UserMsgDetail model;
            bizUserMsg um = new bizUserMsg();
            List<UserMsgDetail> list = um.ListDetail(UserID, 0, 0, 50, out count);

            if (list.Count == 0)
            {
                model = null;
                ViewData["prevID"] = 0;
                ViewData["nextID"] = 0;
                return View(model);
            }
            if(list.Count==1)
            {
                model = list[0];
                ViewData["prevID"] = 0;
                ViewData["nextID"] = 0;
                UserMsg modelMsg = um.Get(model.UserMsgID);
                modelMsg.Attach();
                modelMsg.Status = 1;
                modelMsg.Detach();
                um.Update(modelMsg);
                return View(model);
            }
            if (id == list[0].UserMsgID)
                id = 0;

            if (id == 0)
            {
                model = list[0];
                ViewData["prevID"] = 0;
                ViewData["nextID"] = list[1].UserMsgID;
            }
            else
            {
                int index=0;
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].UserMsgID == id)
                    {
                        index = i;
                        break;
                    }
                }

                model = list[index];
                ViewData["prevID"] = list[index-1].UserMsgID;
                if ((index+1) == list.Count)
                    ViewData["nextID"] = 0;
                else
                    ViewData["nextID"] = list[index + 1].UserMsgID;

            }
            if (model != null && model.Status == 0)
            {
                UserMsg modelMsg = um.Get(model.UserMsgID);
                modelMsg.Attach();
                modelMsg.Status = 1;
                modelMsg.Detach();
                um.Update(modelMsg);
            }
            return View(model);
        }
Exemple #3
0
        public ActionResult SelfMessage(int showType, int pageNo)
        {
            ViewData["CurrMenu"] = "���Ź���";
            int count;
            bizUserMsg um = new bizUserMsg();
            List<UserMsgDetail> list = um.ListDetail(UserID, showType, pageNo - 1, 5, out count);
            um.UpdateUnRead(UserID);
            ViewData["MsgBar"] = bbs.GetUserMsgBarHtml2(showType);
            //ViewData["UserName"] = UserName;
            ViewData["PageList"] = bbs.GetUserMsgPageList("/User/SelfMessage/" + showType, count, pageNo, 5);

            return View(list);
        }