예제 #1
0
        }         //

        public static void SetApplicationMessage(string title, string msgString, string cssClass, bool showPopup)
        {
            SetSessionItem("appMessage", msgString);
            //
            FormMessage formMessage = new FormMessage();

            formMessage.Text      = msgString;
            formMessage.Title     = title;
            formMessage.CssClass  = cssClass;
            formMessage.ShowPopup = showPopup;
            if (msgString.IndexOf("&lt;") > -1 || msgString.IndexOf("</") > -1)
            {
                formMessage.IsFormatted = true;
            }

            HttpContext.Current.Session["FormMessage"] = formMessage;
        }         //
예제 #2
0
        /// <summary>
        /// Set Application Message using passed resource manager, resource string and placeholder
        /// </summary>
        /// <param name="msgString">Message to be displayed</param>
        /// <param name="msgPlaceholder">PlaceHolder where message control will be loaded</param>
        public static void SetApplicationMessage(string msgString, PlaceHolder msgPlaceholder)
        {
            SetSessionItem("appMessage", msgString);
            //
            //assume error style for now
            string css = UtilityManager.GetAppKeyValue("errorMessageCss", "errorMessage");

            FormMessage formMessage = new FormMessage();

            formMessage.Text      = msgString;
            formMessage.Title     = "Application Error";
            formMessage.CssClass  = css;
            formMessage.ShowPopup = false;
            if (msgString.IndexOf("&lt;") > -1 || msgString.IndexOf("</") > -1)
            {
                formMessage.IsFormatted = true;
            }

            HttpContext.Current.Session["FormMessage"] = formMessage;
        }         //
예제 #3
0
        }         //

        /// <summary>
        /// Determine if an application message needs to be formatted. if so format using passed HTML container
        /// </summary>
        /// <param name="usingFormMessage">Set to Yes to use the FormMessage entity</param>
        /// <param name="container">The HTML control that will present the message, if present</param>
        public static void HandleAppMessage(string usingFormMessage, HtmlGenericControl container)
        {
            //bool usingFormMessage = true;
            if (usingFormMessage == "yes")
            {
                FormMessage message = new FormMessage();
                message = ( FormMessage )HttpContext.Current.Session["FormMessage"];
                if (message != null)
                {
                    if (message.ShowPopup)
                    {
                        DisplayMsgBox(message.Title, message.Text);
                    }

                    //if (message.CssClass.Length > 0)
                    //  container. = message.CssClass;

                    if (message.IsFormatted)
                    {
                        if (message.Title.Length > 0)
                        {
                            container.InnerHtml += message.Title;
                        }

                        if (message.Text.StartsWith("<p"))
                        {
                            container.InnerHtml += message.Text;
                        }
                        else
                        {
                            container.InnerHtml += "<p>" + message.Text + "</p>";
                        }
                    }
                    else
                    {
                        if (message.Title.Length > 0)
                        {
                            container.InnerHtml += "<h2>" + message.Title + "</h2>";
                        }

                        container.InnerHtml += "<p>" + message.Text + "</p>";
                    }
                    container.Visible = true;

                    //now clear out message
                    HttpContext.Current.Session.Remove("FormMessage");
                }
            }
            else
            {
                string appMessage = GetSessionItem("appMessage", "");

                if (appMessage.Length > 0)
                {
                    container.InnerHtml = appMessage;
                    container.Visible   = true;
                    //now clear out message
                    HttpContext.Current.Session.Remove("appMessage");
                }
            }
        }        //