//*******************************************************
        //
        // The Page_Load event handler on this User Control is used to
        // obtain a DataReader of link information from the Links
        // table, and then databind the results to a templated DataList
        // server control.  It uses the Nairc.KPWPortal.LinkDB()
        // data component to encapsulate all data functionality.
        //
        //*******************************************************
        protected void Page_Load(Object sender, EventArgs e)
        {
            // Set the link image type
            if (IsEditable)
            {
                linkImage = "~/images/edit.gif";
            }
            else
            {
                linkImage = "~/images/navlink.gif";
            }

            // Obtain links information from the Links table
            // and bind to the list control
            IDesktopModulesFacade facade = new DesktopModulesFacade();
            myDataList.DataSource = facade.Links(ModuleId);
            myDataList.DataBind();

            // Ensure that only users in role may add links
            if (PortalSecurity.IsInRoles(ModuleConfiguration.AuthorizedEditRoles))
            {
                EditButton.Text = "ÐÂÔöÁ´½Ó";
                EditButton.NavigateUrl = "~/DesktopModules/EditLinks.aspx?mid=" + ModuleId.ToString();
            }
        }
        //****************************************************************
        //
        // The Page_Load event on this Page is used to obtain the ModuleId
        // of the xml module to edit.
        //
        // It then uses the Nairc.KPWPortal.HtmlTextDB() data component
        // to populate the page's edit controls with the text 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");
            }

            if (Page.IsPostBack == false)
            {
                // Obtain a single row of text information
                IDesktopModulesFacade facade=new DesktopModulesFacade();
                PortalHtmlText html = facade.HtmlText(moduleId);

                if (html!=null)
                {
                    DesktopText.Text = Server.HtmlDecode(html.DesktopHtml);
                    MobileSummary.Text = Server.HtmlDecode(html.MobileSummary);
                    MobileDetails.Text = Server.HtmlDecode(html.MobileDetails);
                }
                else
                {
                    DesktopText.Text = "Todo: Add Content...";
                    MobileSummary.Text = "Todo: Add Content...";
                    MobileDetails.Text = "Todo: Add Content...";
                }

                // Store URL Referrer to return to portal
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
            }
        }
        //*******************************************************
        //
        // The Page_Load event handler on this Page is used to
        // obtain obtain the contents of a document from the
        // Documents table, construct an HTTP Response of the
        // correct type for the document, and then stream the
        // document contents to the response.  It uses the
        // Nairc.KPWPortal.DocumentDB() data component to encapsulate
        // the data access functionality.
        //
        //*******************************************************
        protected void Page_Load(Object sender, EventArgs e)
        {
            if (Request.Params["DocumentId"] != null)
            {
                documentId = Int32.Parse(Request.Params["DocumentId"]);
            }

            if (documentId != -1)
            {
                // Obtain Document Data from Documents table
                IDesktopModulesFacade facade=new DesktopModulesFacade();
                PortalDocument dBContent = facade.DocumentContent(documentId);

                // Serve up the file by name
                Response.AppendHeader("content-disposition", "filename=" + dBContent.FileFriendlyName);

                // set the content type for the Response to that of the
                // document to display.  For example. "application/msword"
                Response.ContentType = dBContent.ContentType;

                // output the actual document contents to the response output stream
                Response.OutputStream.Write(dBContent.Content, 0, dBContent.ContentSize.Value);

                // end the response
                Response.End();
            }
        }
 //*******************************************************
 //
 // The Page_Load event handler on this User Control is used to
 // obtain a SqlDataReader of document information from the
 // Documents table, and then databind the results to a DataGrid
 // server control.  It uses the Nairc.KPWPortal.DocumentDB()
 // data component to encapsulate all data functionality.
 //
 //*******************************************************
 protected void Page_Load(Object sender, EventArgs e)
 {
     // Obtain Document Data from Documents table
     // and bind to the datalist control
     IDesktopModulesFacade facade = new DesktopModulesFacade();
     myDataGrid.DataSource = facade.Documents(ModuleId);
     myDataGrid.DataBind();
 }
 //*******************************************************
 //
 // The Page_Load event handler on this User Control is used to
 // obtain a DataReader of contact information from the Contacts
 // table, and then databind the results to a DataGrid
 // server control.  It uses the Nairc.KPWPortal.ContactsDB()
 // data component to encapsulate all data functionality.
 //
 //*******************************************************
 protected void Page_Load(Object sender, EventArgs e)
 {
     // Obtain contact information from Contacts table
     // and bind to the DataGrid Control
     IDesktopModulesFacade facade = new DesktopModulesFacade();
     myDataGrid.DataSource = facade.Contacts(ModuleId);
     myDataGrid.DataBind();
 }
Example #6
0
 //*******************************************************
 //
 // The Page_Load event handler on this User Control is used to
 // obtain a DataReader of event information from the Events
 // table, and then databind the results to a templated DataList
 // server control.  It uses the Nairc.KPWPortal.EventDB()
 // data component to encapsulate all data functionality.
 //
 //*******************************************************
 protected void Page_Load(Object sender, EventArgs e)
 {
     // Obtain the list of events from the Events table
     // and bind to the DataList Control
     IDesktopModulesFacade facade = new DesktopModulesFacade();
     myDataList.DataSource = facade.Events(ModuleId);
     myDataList.DataBind();
 }
 //*******************************************************
 //
 // The Page_Load event handler on this User Control is used to
 // obtain a DataSet of announcement information from the Announcements
 // table, and then databind the results to a templated DataList
 // server control.  It uses the Nairc.KPWPortal.AnnouncementsDB()
 // data component to encapsulate all data functionality.
 //
 //*******************************************************
 protected void Page_Load(Object sender, EventArgs e)
 {
     // Obtain announcement information from Announcements table
     // and bind to the datalist control
     // DataBind Announcements to DataList Control
     IDesktopModulesFacade facade = new DesktopModulesFacade();
     myDataList.DataSource = facade.Announcements(ModuleId);
     myDataList.DataBind();
 }
        //*******************************************************
        //
        // The Page_Load event handler on this User Control is
        // used to render a block of HTML or text to the page.
        // The text/HTML to render is stored in the HtmlText
        // database table.  This method uses the Nairc.KPWPortal.HtmlTextDB()
        // data component to encapsulate all data functionality.
        //
        //*******************************************************
        protected void Page_Load(Object sender, EventArgs e)
        {
            // Obtain the selected item from the HtmlText table
            IDesktopModulesFacade facade = new DesktopModulesFacade();
            PortalHtmlText html = facade.HtmlText(ModuleId);

            if (html != null)
            {
                // Dynamically add the file content into the page
                String content = Server.HtmlDecode(html.DesktopHtml);
                HtmlHolder.Controls.Add(new LiteralControl(content));
            }
        }
        //****************************************************************
        //
        // The DeleteBtn_Click event handler on this Page is used to delete an
        // a contact.  It  uses the Nairc.KPWPortal.ContactsDB()
        // data component to encapsulate all data functionality.
        //
        //****************************************************************
        protected void DeleteBtn_Click(Object sender, EventArgs e)
        {
            // Only attempt to delete the item if it is an existing item
            // (new items will have "ItemId" of 0)

            if (itemId != 0)
            {
                IDesktopModulesFacade facade = new DesktopModulesFacade();
                facade.DeleteContact(itemId);
            }

            // Redirect back to the portal home page
            Response.Redirect((String) ViewState["UrlReferrer"]);
        }
 public void AddEventTest()
 {
     //int AddEvent(int moduleId, int itemId, String userName, String title, DateTime expireDate,
     //         String description, String wherewhen)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalEvent portalevent = new PortalEvent();
     portalevent.ModuleID = 0;
     portalevent.ItemID = 0;
     portalevent.CreatedByUser = "******";
     portalevent.Title = "t";
     portalevent.ExpireDate = new DateTime(2011, 1, 1);
     portalevent.Description = "d";
     portalevent.WhereWhen = "ww";
     facade.AddEvent(portalevent);
 }
 public void AddContactTest()
 {
     //int AddContact(int moduleId, int itemId, String userName, String name, String role, String email,
     //           String contact1, String contact2)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalContact contact = new PortalContact();
     contact.ModuleID=0;
     contact.ItemID=0;
     contact.CreatedByUser="******";
     contact.Name="n";
     contact.Role="r";
     contact.Email="e";
     contact.Contact1="c1";
     contact.Contact2="c2";
     facade.AddContact(contact);
 }
 public void AddAnnouncementTest()
 {
     //int AddAnnouncement(int moduleId, int itemId, String userName, String title, DateTime expireDate,
     //                String description, String moreLink, String mobileMoreLink)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalAnnouncement announcement = new PortalAnnouncement();
     announcement.ModuleID = 0;
     announcement.ItemID = 0;
     announcement.CreatedByUser = "******";
     announcement.Title = "t";
     announcement.Description = "d";
     announcement.ExpireDate = new DateTime(2011, 1, 1);
     announcement.MoreLink = "ml";
     announcement.MobileMoreLink = "mml";
     facade.AddAnnouncement(announcement);
 }
Example #13
0
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to save
        // the text changes to the database.
        //
        //****************************************************************
        protected void UpdateBtn_Click(Object sender, EventArgs e)
        {
            // Update the text within the HtmlText table
            IDesktopModulesFacade facade = new DesktopModulesFacade();

            PortalHtmlText html = new PortalHtmlText();
            html.ModuleID =moduleId;
            html.DesktopHtml = Server.HtmlEncode(DesktopText.Text);
            html.MobileSummary = Server.HtmlEncode(MobileSummary.Text);
            html.MobileDetails = Server.HtmlEncode(MobileDetails.Text);

            facade.UpdateHtmlText(html);

            // Redirect back to the portal home page
            Response.Redirect((String) ViewState["UrlReferrer"]);
        }
 public void AddLinkTest()
 {
     // int AddLink(int moduleId, int itemId, String userName, String title, String url, String mobileUrl,
     //        int viewOrder, String description)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalLink link=new PortalLink();
     link.ModuleID = 0;
     link.ItemID = 0;
     link.CreatedByUser = "******";
     link.Title = "t";
     link.Url = "url";
     link.MobileUrl = "murl";
     link.ViewOrder = 0;
     link.Description = "d";
     facade.AddLink(link);
 }
Example #15
0
        //*******************************************************
        //
        // The Page_Load event handler on this User Control is used to
        // obtain a DataReader of link information from the Links
        // table, and then databind the results to a templated DataList
        // server control.  It uses the Nairc.KPWPortal.LinkDB()
        // data component to encapsulate all data functionality.
        //
        //*******************************************************
        protected void Page_Load(Object sender, EventArgs e)
        {
            // Set the link image type
            if (IsEditable)
            {
                linkImage = "~/images/edit.gif";
            }
            else
            {
                linkImage = "~/images/navlink.gif";
            }

            // Obtain links information from the Links table
            // and bind to the datalist control
            IDesktopModulesFacade facade = new DesktopModulesFacade();
            myDataList.DataSource = facade.Links(ModuleId);
            myDataList.DataBind();
        }
 public void EventsTest()
 {
     //IList<PortalEvent> Events(int moduleId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.Events(0);
 }
 public void LinksTest()
 {
     //IList<PortalLink> Links(int moduleId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.Links(0);
 }
 public void HtmlTextTest()
 {
     //PortalHtmlText HtmlText(int moduleId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.HtmlText(0);
 }
 public void UpdateHtmlTextTest()
 {
     //void UpdateHtmlText(int moduleId, String desktopHtml, String mobileSummary, String mobileDetails)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalHtmlText html = new PortalHtmlText();
     html.ModuleID = 0;
     html.DesktopHtml = "dh";
     html.MobileSummary = "ms";
     html.MobileDetails = "md";
     facade.UpdateHtmlText(html);
 }
 public void UpdateDocumentTest()
 {
     //void UpdateDocument(int moduleId, int itemId, String userName, String name, String url, String category,
     //                byte[] content, int size, String contentType)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalDocument doc=new PortalDocument();
     doc.ModuleID = 0;
     doc.ItemID = 0;
     doc.CreatedByUser = "******";
     doc.FileFriendlyName = "n";
     doc.FileNameUrl = "url";
     doc.Category = "c";
     doc.Content = new byte[] {};
     doc.ContentSize = 0;
     doc.ContentType = "ct";
     facade.UpdateDocument(doc);
 }
 public void TopLevelMessagesTest()
 {
     //IList<PortalDiscussion> TopLevelMessages(int moduleId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.TopLevelMessages(0);
 }
 public void ThreadMessagesTest()
 {
     //IList<PortalDiscussion> ThreadMessages(string parent)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.ThreadMessages("p");
 }
 public void SingleMessageTest()
 {
     //PortalDiscussion SingleMessage(int itemId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.SingleMessage(0);
 }
 public void AddMessageTest()
 {
     //int AddMessage(int moduleId, int parentId, String userName, String title, String body)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalDiscussion discussion = new PortalDiscussion();
     discussion.ModuleID = 0;
     discussion.CreatedByUser = "******";
     discussion.Title = "t";
     discussion.Body = "b";
     facade.AddMessage(discussion, 0);
 }
 public void AnnouncementsTest()
 {
     //IList<PortalAnnouncement> Announcements(int moduleId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.Announcements(0);
 }
 public void SingleContactTest()
 {
     //PortalContact SingleContact(int itemId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.SingleContact(0);
 }
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to either
        // create or update a contact.  It  uses the Nairc.KPWPortal.ContactsDB()
        // data component to encapsulate all data functionality.
        //
        //****************************************************************
        protected void UpdateBtn_Click(Object sender, EventArgs e)
        {
            // Only Update if Entered data is Valid
            if (Page.IsValid == true)
            {
                IDesktopModulesFacade facade = new DesktopModulesFacade();
                PortalContact contact = new PortalContact();
                contact.ModuleID =moduleId;
                contact.ItemID =itemId;
                contact.CreatedByUser =Context.User.Identity.Name;
                contact.Name =NameField.Text;
                contact.Role =RoleField.Text;
                contact.Email =EmailField.Text;
                contact.Contact1 = Contact1Field.Text;
                contact.Contact2 = Contact2Field.Text;

                if (itemId == 0)
                {
                    // Add the contact within the contacts table
                    facade.AddContact(contact);
                }
                else
                {
                    // Update the contact within the contacts table
                    facade.UpdateContact(contact);
                }

                // Redirect back to the portal home page
                Response.Redirect((String) ViewState["UrlReferrer"]);
            }
        }
 public void SingleEventTest()
 {
     //PortalEvent SingleEvent(int itemId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.SingleEvent(0);
 }
        //****************************************************************
        //
        // The Page_Load event on this Page is used to obtain the ModuleId
        // and ItemId of the contact to edit.
        //
        // It then uses the Nairc.KPWPortal.ContactsDB() data component
        // to populate the page's edit controls with the contact details.
        //
        //****************************************************************
        protected void Page_Load(Object Sender, EventArgs e)
        {
            // Determine ModuleId of Contacts 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 Contacts 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
            // contact itemId value is specified, and if so populate page
            // contents with the contact details

            if (Page.IsPostBack == false)
            {
                if (itemId != 0)
                {
                    // Obtain a single row of contact information
                    IDesktopModulesFacade facade = new DesktopModulesFacade();
                    PortalContact contact = facade.SingleContact(itemId);

                    // Security check.  verify that itemid is within the module.
                    int dbModuleID = contact.ModuleID;
                    if (dbModuleID != moduleId)
                    {
                        Response.Redirect("~/Errors/EditAccessDenied.aspx");
                    }

                    NameField.Text = contact.Name;
                    RoleField.Text = contact.Role;
                    EmailField.Text = contact.Email;
                    Contact1Field.Text = contact.Contact1;
                    Contact2Field.Text = contact.Contact2;
                    CreatedBy.Text = contact.CreatedByUser;
                    CreatedDate.Text = contact.CreatedDate.Value.ToShortDateString();
                }

                // Store URL Referrer to return to portal
                ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();
            }
        }
 public void SingleLinkTest()
 {
     //PortalLink SingleLink(int itemId)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     facade.SingleLink(0);
 }