Esempio n. 1
0
        public void Create(FormCollection collection)
        {
            var msg = new Msg();

            try
            {
                // 初始化对象
                Entity.T_Notice notice = new Entity.T_Notice()
                {
                    Notice_title      = collection["title"],
                    Notice_content    = collection["content"],
                    Notice_login_name = (string)Session["login_name"],
                    //Notice_post_date = DateTime.Now,
                };
                var Notice = new Notices();
                if (Notice.Add(notice))
                {
                    msg.Message = "发布公告成功!";
                }
                else
                {
                    throw new Exception("发生未知错误,发布公告失败!");
                }
            }
            catch (Exception ex)
            {
                msg.Code    = -1;
                msg.Message = ex.Message;
            }
            Response.Write(msg.ToJson());
            Response.End();
        }
 public void Add(Notice notice)
 {
     if (Capacity == -1)
     {
         Notices.Add(notice); return;
     }
     else
     {
         if (Notices.Count == Capacity)
         {
             Notices.RemoveAt(Notices.Count - 1);
         }
         Notices.Add(notice);
     }
 }
Esempio n. 3
0
        public async void InitMainPage()
        {
            try
            {
                var api      = new ApiService().HseSupporterApi;
                var mainPage = await api.GetMainPage();

                Notices.Clear();
                Events.Clear();
                MainQuestions.Clear();

                AllNotices = mainPage.Notices;

                Profile = mainPage.Profile;
                foreach (var notice in mainPage.Notices.Where(notice => !notice.IsImportant))
                {
                    Notices.Add(notice);
                }
                foreach (var eEvent in mainPage.Events)
                {
                    Events.Add(eEvent);
                }
                foreach (var mainQuestion in mainPage.MainQuestions)
                {
                    MainQuestions.Add(mainQuestion);
                }

                IsBusy = false;
                OnLoad();
            }
            catch (HttpRequestException e)
            {
                OnError(ErrorType.ServerError);
            }
            catch (Exception e)
            {
                OnError(ErrorType.UnknownError);
            }
        }
Esempio n. 4
0
        //Inspector

        public void AddNotice(string message, string url, string linkText)
        {
            var notice = new NoticeViewModel
            {
                NoticeText          = message,
                NoticeHyperlinkUrl  = url,
                NoticeHyperlinkText = linkText
            };

            _inspectorWindow.Dispatcher.BeginInvoke((System.Windows.Forms.MethodInvoker) delegate { Notices.Add(notice); });
        }
Esempio n. 5
0
        public void NoticeCreate(string b)
        {
            var notice = new Notice(body: b, person: this);

            Notices.Add(notice);
        }
Esempio n. 6
0
 public void Add(Task notice)
 {
     Notices.Add(notice);
 }