public void SingleAnnouncementTest() { //PortalAnnouncement SingleAnnouncement(int itemId) DesktopModulesFacade facade = new DesktopModulesFacade(); facade.SingleAnnouncement(0); }
//**************************************************************** // // The Page_Load event on this Page is used to obtain the ModuleId // and ItemId of the announcement to edit. // // It then uses the Nairc.KPWPortal.AnnouncementsDB() data component // to populate the page's edit controls with the annoucement details. // //**************************************************************** protected void Page_Load(Object Sender, EventArgs e) { // Determine ModuleId of Announcements Portal Module moduleId = Int32.Parse(Request.Params["Mid"]); // Verify that the current user has access to edit this module if (PortalSecurity.HasEditPermissions(moduleId) == false) { Response.Redirect("~/Errors/EditAccessDenied.aspx"); } // Determine ItemId of Announcement to Update if (Request.Params["ItemId"] != null) { itemId = Int32.Parse(Request.Params["ItemId"]); } // If the page is being requested the first time, determine if an // announcement itemId value is specified, and if so populate page // contents with the announcement details if (Page.IsPostBack == false) { if (itemId != 0) { IDesktopModulesFacade facade = new DesktopModulesFacade(); // Obtain a single row of announcement information PortalAnnouncement announcement = facade.SingleAnnouncement(itemId); // Security check. verify that itemid is within the module. int dbModuleID = announcement.ModuleID; if (dbModuleID != moduleId) { Response.Redirect("~/Errors/EditAccessDenied.aspx"); } TitleField.Text = announcement.Title; MoreLinkField.Text = announcement.MoreLink; MobileMoreField.Text = announcement.MobileMoreLink; DescriptionField.Text = announcement.Description; ExpireField.Text = announcement.ExpireDate.Value.ToShortDateString(); CreatedBy.Text = announcement.CreatedByUser; CreatedDate.Text = announcement.CreatedDate.Value.ToShortDateString(); } // Store URL Referrer to return to portal ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } }