public ActionResult AddAnnouncementsAdmin() { if (Session["username"] == null) { return(RedirectToAction("Login", "User")); } Announcements a = new Announcements(); return(View(a)); }
public ActionResult Create([Bind(Include = "AnnouncementsId,AnnouncementName,AnnouncementDescription,AnnouncementAuthor")] Announcements announcements) { if (ModelState.IsValid) { db.Announcements.Add(announcements); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(announcements)); }
protected override void ShowPage() { pagetitle = "公告"; announcementlist = Announcements.GetAnnouncementList(nowdatetime, "2099-12-31 23:59:59"); if (announcementlist.Rows.Count == 0) { AddErrLine("当前没有任何公告"); return; } }
protected override void ShowPage() { pagetitle = "日志列表"; if (config.Enablespace != 1) { AddErrLine("个人空间功能已被关闭"); return; } newtopiclist = AggregationFacade.ForumAggregation.GetForumTopicList(10, 0, 0, TopicTimeType.All, TopicOrderType.PostDateTime, false, false); hottopiclist = AggregationFacade.ForumAggregation.GetForumTopicList(10, 0, 0, TopicTimeType.All, TopicOrderType.Views, false, false); recentupdatespacelist = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } rotatepicdata = AggregationFacade.BaseAggregation.GetRotatePicData(); currentpage = DNTRequest.GetInt("page", 1); blogsCount = AggregationFacade.SpaceAggregation.GetSpacePostsCount(); pagecount = blogsCount % pageSize == 0 ? blogsCount / pageSize : blogsCount / pageSize + 1; if (pagecount == 0) { pagecount = 1; } if (currentpage < 1) { currentpage = 1; } if (currentpage > pagecount) { currentpage = pagecount; } spacepostlist = AggregationFacade.SpaceAggregation.GetSpacePostList("Spaceindex"); pagenumbers = Utils.GetPageNumbers(currentpage, pagecount, "bloglist.aspx", 8); postslist = AggregationFacade.SpaceAggregation.SpacePostsList(pageSize, currentpage); if (config.Enablealbum == 1) { recommendalbumlist = AggregationFacade.AlbumAggregation.GetRecommandAlbumList("Spaceindex"); } topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments(); }
public async Task <IActionResult> Create([Bind("AnnouncementId,AnnouncementTitle,AnnouncementText,Date")] Announcements announcements) { if (ModelState.IsValid) { announcements.Date = DateTime.Now; _context.Add(announcements); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(announcements)); }
public ActionResult AddAnnouncement(Announcements announcements) { if (ModelState.IsValid) { db.Announcements.Add(announcements); return(RedirectToAction("AnnouncementList")); } else { return(View()); } }
public List <Announcements> GetAnnouncements(Announcements model) { var sql = "[Users].[GetAnnouncement]"; var queryParams = new DynamicParameters(); queryParams.Add("@DistrictId", model.DistrictId); queryParams.Add("@OrganizationId", model.OrganizationId); queryParams.Add("@LoginUserId", model.UserId); var result = Db.Query <Announcements>(sql, queryParams, commandType: CommandType.StoredProcedure).ToList(); return(result); }
public bool UpdateAnnouncement(Announcements anno) { bool result = false; var updatePlayerIDSql = "Update Announcements set AnnouncementTitle=@title,AnnouncementContent=@content,CreateDate=@date,Status=@status where ID=@id;"; int resultExecuteNonQuery = con.Execute(updatePlayerIDSql, new { title = anno.AnnouncementTitle, content = anno.AnnouncementContent, date = DateTime.Now, status = anno.Status }); if (resultExecuteNonQuery == 1) { result = true; } return(result); }
public bool AddAnnouncement(Announcements anno) { bool result = false; var sql = "INSERT INTO Announcements (AnnouncementTitle,AnnouncementContent,CreateDate,Status) values (@title,@content,@date,@status);"; int resultExecuteNonQuery = con.Execute(sql, new { title = anno.AnnouncementTitle, content = anno.AnnouncementContent, date = DateTime.Now, status = true }); if (resultExecuteNonQuery == 1) { result = true; } return(result); }
public IActionResult OnGet(int?id) { if (id == null) { return(NotFound()); } Announcement = applicationDbContext.Announcements.Find(id); if (Announcement == null) { return(NotFound()); } return(Page()); }
private void BindData(int annID) { Announcement ann = new Announcements(Globals.CurrentIdentity).GetInfo(annID); txtTitle.Text = ann.Title; txtDesc.Text = HTMLWizard.BRToLineBreak(ann.Description); lblCourseID.Text = ann.CourseID.ToString(); lblDate.Text = "Post Date: " + ann.Created; lblPoster.Text = "Poster: <b>" + ann.Poster + "</b>"; lblPreview.Text = ann.Description; }
//增加一条公告记录 public void AddAnnounce(long adminId, AnnouncementQO announceQO) { var newAnnounce = new Announcements { Content = announceQO.Content, UserId = adminId, Time = DateTime.Now, Title = announceQO.Title }; _context.Announcements.Add(newAnnounce); _context.SaveChanges(); }
private void DeleteAnnounce_Click(object sender, EventArgs e) { #region 除公告 if (this.CheckCookie()) { Announcements.DeleteAnnouncements(DNTRequest.GetString("id")); //记录日志 AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除公告", "删除公告,标题为:" + title.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_announcegrid.aspx';"); } #endregion }
public ActionResult Create(long?ID) { if (ID != null) { Announcements anno = help.GetAnnouncement((long)ID); if (anno == null) { return(HttpNotFound()); } return(View(anno)); } return(View()); }
public async void Get() { var jData = await DataService.Get($"Announcements"); if (jData == "ConnectionError") { StandardMessagesDisplay.NoConnectionToast(); } else if (jData == "null") { StandardMessagesDisplay.NoDataDisplayMessage(); } else if (jData == "Error") { StandardMessagesDisplay.Error(); } else if (jData == "ErrorTracked") { StandardMessagesDisplay.ErrorTracked(); } else { try { var data = JsonConvert.DeserializeObject <Dictionary <string, AnnouncementsModel> >(jData); if (data != null) { foreach (KeyValuePair <string, AnnouncementsModel> item in data) { Announcements?.Add( new AnnouncementsModel { Id = item.Value.Id, Content = item.Value.Content, IsActive = item.Value.IsActive, MessageDateTime = item.Value.MessageDateTime, Title = item.Value.Title, FId = item.Key } ); } } } catch (Exception ex) { Crashes.TrackError(ex); StandardMessagesDisplay.InputToast(ex.Message); } } }
// GET: Announcements/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Announcements announcements = db.Announcements.Find(id); if (announcements == null) { return(HttpNotFound()); } return(PartialView("_Edit", announcements)); }
/// <summary> /// Created By: Luke Frahm 4/22/2016 /// Update an existing announcement as changed by user and pass it to data access. /// </summary> /// <param name="announcement">Announcement object with all object details.</param> /// <returns>Boolean based on result from data access layer.</returns> public bool UpdateAnnouncement(Announcements announcement) { bool success; try { success = AnnouncementAccessor.UpdateAnnouncement(announcement); } catch (Exception) { throw; } return(success); }
// GET: Announcements/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Announcements announcements = db.Announcements.Find(id); if (announcements == null) { return(HttpNotFound()); } return(View(announcements)); }
public IActionResult OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Announcement = applicationDbContext.Announcements.Find(id); if (Announcement != null) { applicationDbContext.Announcements.Remove(Announcement); applicationDbContext.SaveChanges(); } return(RedirectToPage("./Index")); }
/// <summary> /// Add new addition to the announcement list /// </summary> /// <param name="newAnnouncement">New announcement to be added</param> public void setAnnouncement(string newAnnouncement) { char[] delimiterChars = { '[', ']' }; string[] words = newAnnouncement.Split(delimiterChars); var announcement = new Announcements(); announcement.Announcement = words[6]; announcement.Date = currentDate; announcement.Time = words[3]; announcement.Name = words[1]; announcementRecord.Add(announcement); }
public DiscordEventHandler(Logger logger, TriviaGames triviaGames, DiscordSocketClient client, CommandHandler commandHandler, ApplicationSettings applicationSettings, ListManager listManager, IOnboarding onboarding, BlogHandler blogHandler, Announcements announcements, MessageRewardHandler messageRewardHandler, RepeatedTaskFunctions repeatedTaskFunctions, GlobalGuildAccounts globalGuildAccounts) { _logger = logger; _client = client; _commandHandler = commandHandler; _applicationSettings = applicationSettings; _triviaGames = triviaGames; _listManager = listManager; _onboarding = onboarding; _blogHandler = blogHandler; _announcements = announcements; _messageRewardHandler = messageRewardHandler; _repeatedTaskFunctions = repeatedTaskFunctions; _globalGuildAccounts = globalGuildAccounts; }
public async Task <IActionResult> Create(Announcements announcements) { if (ModelState.IsValid) { var userId = User.FindFirstValue(ClaimTypes.NameIdentifier); announcements.CreatedBy = userId; announcements.CreatedAt = DateTime.Now; announcements.UpdateAt = DateTime.Now; _context.Add(announcements); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(announcements)); }
public void OnEnter(L2Player player) { if ((Announcements == null) || (Announcements.Count == 0)) { return; } CreatureSay cs = new CreatureSay(SayIDList.CHAT_ANNOUNCE); foreach (AnnouncementContract announcement in Announcements.Where(announcement => announcement.Type == 0)) { cs.Text = announcement.Text; player.SendPacket(cs); } }
public IActionResult Guncelle(string id, Announcements newAnouncements) { var item = announcementsRepository.GetById(id); if (ModelState.IsValid) { item.Title = newAnouncements.Title; item.CreatedDate = newAnouncements.CreatedDate; item.Content = newAnouncements.Content; announcementsRepository.UpdateModel(id, item); return(RedirectToAction("Index")); } return(View()); }
private void AddAnnounceInfo_Click(object sender, EventArgs e) { #region 添加公告 if (this.CheckCookie()) { Announcements.CreateAnnouncement(username, userid, title.Text, Utils.StrToInt(displayorder.Text, 0), starttime.Text, endtime.Text, DNTRequest.GetString("announcemessage_hidden")); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/SimplifiedAnnouncementList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加公告", "添加公告,标题为:" + title.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_announcegrid.aspx';"); } #endregion }
public ActionResult AddAnnouncement(FormCollection frm) { Announcements anc = new Announcements(); string tid = Session["username"].ToString(); string cid = frm["ClassID"].ToString(); anc.Teacher = school.Teachers.FirstOrDefault(m => m.TeacherID.Equals(tid)); anc.Date = DateTime.Now; anc.Message = frm["Message"].ToString(); anc.Topic = frm["Topic"].ToString(); anc.Class = school.Class.FirstOrDefault(m => m.ClassID.Equals(cid)); anc.Recepient = "student"; anc.userID = frm["UserID"].ToString(); TryUpdateModel(anc); if (frm["UserID"].ToString().Length != 0) { anc.Recepient = frm["UserID"].ToString(); if (school.Students.Include("Class").FirstOrDefault(m => m.StudentID.Equals(anc.userID) && m.Class.ClassID.Equals(cid)) == null) { ModelState.AddModelError("userID", "no such Student in this class"); } } else { anc.Recepient = frm["Recepient"].ToString(); } if (ModelState.IsValid) { Notification n = new Notification(); n.Recepient = anc.Recepient; n.SeenBy = ""; n.Status = "unseen"; n.UserID = anc.userID; n.Time = DateTime.Now.ToString(); school.Announcements.Add(anc); school.Notifications.Add(n); TempData["res"] = "added"; school.SaveChanges(); return(RedirectToAction("TeacherHome", "User")); } return(View(anc)); }
public IActionResult GetAnnouncements([FromBody] Announcements model) { try { model.UserId = base.CurrentUser.Id; var Announcements = _service.GetAnnouncements(model); return(Ok(Announcements)); } catch (Exception ex) { } finally { } return(null); }
/// <summary> /// Show the user a list of announcements /// </summary> /// <param name="announcements"></param> public void ShowAnnouncements(List <UserControl> announcements) { closedAnnouncements = false; announcementItems = announcements; Announcements.Content = announcementItems[0]; PreviousAnnouncement.Visibility = Visibility.Collapsed; if (announcementItems.Count == 1) { NextAnnouncement.Visibility = Visibility.Collapsed; } else { NextAnnouncement.Visibility = Visibility.Visible; } AnnouncementsContainer.Visibility = Visibility.Visible; Announcements.Focus(FocusState.Programmatic); }
public ActionResult Delete() { string ID = Request.QueryString["ID"]; if (ID == null) { return(HttpNotFound()); } Announcements ann = help.GetAnnouncement(long.Parse(ID)); if (ann == null) { return(HttpNotFound()); } Helper.Delete(ann); return(Redirect("/Announcements/Index?Status=DeleteSuccess")); }
public ActionResult Edit([Bind(Include = "AnnouncementId,Description,Expiration")] Announcements announcements) { try { if (ModelState.IsValid) { db.Entry(announcements).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (DataException) { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); } return(View(announcements)); }