Exemple #1
0
 private string GetSystemNoticeList(HttpContext context)
 {
     try
     {
         BLLSystemNotice.NoticeType noticeType = (BLLSystemNotice.NoticeType) int.Parse(context.Request["noticeType"]);
         int pageIndex = int.Parse(context.Request["pageIndex"]);
         int pageSize  = int.Parse(context.Request["pageSize"]);
         List <SystemNotice> systemNoticeList = new BLLSystemNotice().GetUnReadMsgList(pageSize, pageIndex, currUserInfo.UserID, noticeType);
         if (systemNoticeList != null && systemNoticeList.Count > 0)
         {
             resp.Status = 0;
             resp.ExObj  = systemNoticeList;
         }
         else
         {
             resp.Status = -1;
             resp.Msg    = "没有数据";
         }
     }
     catch (Exception ex)
     {
         resp.Status = -1;
         resp.Msg    = ex.Message;
     }
     return(Common.JSONHelper.ObjectToJson(resp));
 }
Exemple #2
0
        public void ProcessRequest(HttpContext context)
        {
            int    rows    = Convert.ToInt32(context.Request["rows"]);
            int    page    = Convert.ToInt32(context.Request["page"]);
            string type    = context.Request["type"];
            string keyword = context.Request["keyword"];

            auto_read = Convert.ToInt32(context.Request["auto_read"]);

            BLLSystemNotice.NoticeType nType = new BLLSystemNotice.NoticeType();
            if (!string.IsNullOrWhiteSpace(type))
            {
                if (!Enum.TryParse(type, out nType))
                {
                    apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                    apiResp.msg  = "类型格式不能识别";
                    bll.ContextResponse(context, apiResp);
                    return;
                }
            }
            string userId = CurrentUserInfo.UserID;
            List <BLLJIMP.Model.SystemNotice> list = bll.GetMsgList(rows, page, CurrentUserInfo.UserID, nType, keyword, null, bll.WebsiteOwner);
            int total = bll.GetMsgCount(userId, nType);

            if (auto_read == 1 && list.Count > 0)
            {
                string nids = ZentCloud.Common.MyStringHelper.ListToStr(list.Select(p => p.AutoID).ToList(), "", ",");
                bll.SetReaded(nids);
            }

            apiResp.status = true;
            apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            apiResp.msg    = "查询完成";
            apiResp.result = new
            {
                list = from p in list
                       select new
                {
                    id      = p.AutoID,
                    title   = p.Title,
                    type    = p.NoticeType,
                    content = p.Ncontent,
                    time    = p.InsertTime.ToString("yyyy/MM/dd HH:mm:ss"),
                    read    = p.Readtime.HasValue
                },
                total = total
            };
            bll.ContextResponse(context, apiResp);
        }
Exemple #3
0
        public void ProcessRequest(HttpContext context)
        {
            string type = context.Request["type"];

            BLLSystemNotice.NoticeType nType = new BLLSystemNotice.NoticeType();
            if (!string.IsNullOrWhiteSpace(type))
            {
                if (!Enum.TryParse(type, out nType))
                {
                    apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                    apiResp.msg  = "类型格式不能识别";
                    bll.ContextResponse(context, apiResp);
                    return;
                }
            }
            string userId = CurrentUserInfo.UserID;
            int    total  = bll.GetUnReadMsgCount(userId, nType, bll.WebsiteOwner);

            apiResp.status = true;
            apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            apiResp.msg    = "查询完成";
            apiResp.result = total;
            bll.ContextResponse(context, apiResp);
        }