示例#1
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 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 UpdateHtmlText(PortalHtmlText html)
        {
            // TODO: add access security here..
            // TODO: add argument validation here..

            // Run within the context of a database transaction.
            // The Decorator Design Pattern.
            using (TransactionDecorator transaction = new TransactionDecorator())
            {
                htmlTextDAO.UpdateHtmlText(html.ModuleID, html.DesktopHtml, html.MobileSummary, html.MobileDetails);
                transaction.Complete();
            }
        }