예제 #1
0
 public JsonResult AddMessageNew(string AcceptIDS, string Title, string Content)
 {
     AjaxResult result = new AjaxResult();
     Message msg = new Message();
     msg.Content = Content;
     msg.Title = Title;
     try
     {
         MessageRule msgR = new MessageRule();
         if (string.IsNullOrEmpty(msg.ID))//新增
         {
             msg.ID = Guid.NewGuid().ToString("N");
             msg.OperatorID = MyTicket.CurrentTicket.UserID;
             msg.CreateDate = DateTime.Now;
             msgR.Add(msg);
             //不选接收人,默认发送给所有人
             if (string.IsNullOrEmpty(AcceptIDS))
             {
                 List<Ajax.Model.Customer> acceptList = new CustomerRule().GetList("");
                 foreach (Ajax.Model.Customer c in acceptList)
                 {
                     AcceptIDS += c.OperatorID + ",";
                 }
             }
             string[] strAcceptIDs = AcceptIDS.Remove(AcceptIDS.Length - 1, 1).Split(',');//Request.Form["txtAcceptIDs"].Split(',');
             //接收人
             OperatorMsgRule omsgR = new OperatorMsgRule();
             List<OperatorMsg> oMsgList = new List<OperatorMsg>();
             foreach (string acceptID in strAcceptIDs)
             {
                 if (string.IsNullOrEmpty(acceptID)) continue;
                 OperatorMsg omsg = new OperatorMsg();
                 omsg.ID = Guid.NewGuid().ToString("N");
                 omsg.Status = 0;//默认为未读
                 omsg.MsgID = msg.ID;
                 omsg.OperatorID = acceptID;
                 oMsgList.Add(omsg);
             }
             omsgR.AddMul(oMsgList);
             result.Success = true;
             result.Message = "公告已经成功发出。";
         }
         else//编辑
         {
             result.Success = msgR.Update(msg);
             result.Message = result.Success ? "公告已经成功修改。" : "公告修改失败!";
         }
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.Message = "操作失败:" + ex.Message;
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
예제 #2
0
 public JsonResult DeleteMsg()
 {
     string[] msgIDs = Request.Form["msgIDs"].Split(',');
     try
     {
         bool flag1 = new MessageRule().DeleteMul(new List<string>(msgIDs));
         //bool flag2 = new OperatorMsgRule().DeleteMul(new List<string>(msgIDs));
     }
     catch
     {
         return Json("公告删除失败!", JsonRequestBehavior.AllowGet);
     }
     return Json("公告删除成功.", JsonRequestBehavior.AllowGet);
 }
예제 #3
0
 public JsonResult Search(EasyUIGridParamModel gridParam, int status)
 {
     int itemCount = 0;
     MessageRule msgR = new MessageRule();
     List<dynamic> list = msgR.GetSearchJson(gridParam, status, MyTicket.CurrentTicket.UserID, out itemCount);
     var listResult = from m in list
                      select new
                      {
                          ID = m.ID,
                          TITLE = "<a >" + m.TITLE + "</a>",
                          CREATEDATE = m.CREATEDATE,
                          STATUS = m.STATUS,
                          VIEW = "<b class='btnView'>查看</b>"
                      };
     return Json(new { total = itemCount, rows = listResult }, JsonRequestBehavior.AllowGet);
 }
예제 #4
0
 /// <summary>
 /// 加载最近10条公告
 /// </summary>
 /// <returns></returns>
 public ActionResult LoadSystemMsg()
 {
     if (MyTicket.CurrentTicket == null)
     {
         return new HomeController().Login();
     }
     var showList = new MessageRule().GetLatestMsg(10, MyTicket.CurrentTicket.UserID);
     return Json(showList, JsonRequestBehavior.AllowGet);
 }