Ejemplo n.º 1
0
 public override int Delete(FormM form, DFDictionary entity, ref string message)
 {
     try
     {
         var currentUser = Util.GetCurrentUser();
         var subAction   = entity["subAction"];
         if (subAction == "MarkAllRead")
         {
             MsgCenter.MarkAllRead(currentUser.UserId, currentUser.UserName);
             MsgCenter.RefreshUserMessage(currentUser.UserId);
             message = "全部标记已读成功";
         }
         else
         {
             var data = JsonSerializeHelper.DeserializeObject <List <Dictionary <string, string> > >(entity["data"]);
             if (data == null)
             {
                 throw new ArgumentNullException("data");
             }
             if (subAction == "MarkRead")
             {
                 MsgCenter.MarkRead(data.Select(a => a["MsgId"]).ToList(), currentUser.UserName);
                 MsgCenter.RefreshUserMessage(currentUser.UserId);
                 message = "标记已读成功";
             }
             else
             {
                 MsgCenter.DeleteMessage(data.Select(a => a["MsgId"]).ToList());
                 MsgCenter.RefreshUserMessage(currentUser.UserId);
                 message = "删除成功";
             }
         }
         return(DFPub.EXECUTE_SUCCESS);
     }
     catch (Exception ex)
     {
         message = ex.Message;
         return(DFPub.EXECUTE_ERROR);
     }
 }