Example #1
0
        public IActionResult Detail(int noticeNo)
        {
            if (HttpContext.Session.GetString("USER_LOGIN_KEY") != "admin")
            {
                return(RedirectToAction("Signin", "Account"));
            }

            var notice = _noticeBll.GetNotice(noticeNo);

            return(View(notice));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strNoticeID = Request.QueryString["id"];

                NoticeBLL             noticeBLL = new NoticeBLL();
                RailExam.Model.Notice notice    = noticeBLL.GetNotice(int.Parse(strNoticeID));

                ViewState["Title"]      = notice.Title;
                ViewState["Author"]     = notice.EmployeeName;
                ViewState["Content"]    = notice.Content;
                ViewState["CreateTime"] = notice.CreateTime;
            }
        }
Example #3
0
        /// <summary>
        /// 获取通知
        /// </summary>
        /// <param name="session">用户session</param>
        /// <param name="noticeType">标志要请求的通知类型,0全部通知,1个人通知,2系统通知</param>
        /// <returns></returns>
        public Stream GetNotice(string session, string noticeType)
        {
            try
            {
                NoticeBLL noticeBLL = new NoticeBLL();
                string    resul     = noticeBLL.GetNotice(session, noticeType);

                if (!string.IsNullOrEmpty(resul))
                {
                    return(new MemoryStream(Encoding.UTF8.GetBytes(resul)));
                }
                else
                {
                    return(new MemoryStream(Encoding.UTF8.GetBytes("error")));
                }
            }
            catch (Exception err)
            {
                Logger.Error("GetNotice Error", err);
                return(new MemoryStream(Encoding.UTF8.GetBytes("error")));
            }
        }