public ActionResult Display(int ID)
        {
            ScreenViewer.API.Elements.TextHTMLController TC = new API.Elements.TextHTMLController();
            var actionResult = TC.GetScriptTextHTML(Convert.ToDecimal(ID));

            var tresponse = actionResult as OkNegotiatedContentResult <Data.ScriptTextHTML>;

            //Assert.IsNotNull(response);
            Data.ScriptTextHTML theText = tresponse.Content;

            var TextHTML = SPutilities.ReplaceObjectsandQuestions(HttpContext.Session, theText.TextHTMLContent, true);

            ViewBag.TextTitle = theText.TextHTMLDesc;
            ViewBag.Content   = TextHTML;
            ViewBag.TextID    = theText.ScriptTextHTMLID;
            bool whatif;

            try
            {
                whatif = (bool)theText.ShowDescTooltip;
            }
            catch
            {
                whatif = false;
            }
            if (whatif)
            {
                return(PartialView("_TextHTMLpop"));
            }
            else
            {
                return(PartialView("_TextHTML"));
            }
        }
        public string RenderHtml(int ID, ControllerContext ContCont)
        {
            ScreenViewer.API.Elements.TextHTMLController TC = new API.Elements.TextHTMLController();
            var actionResult = TC.GetScriptHTML(Convert.ToDecimal(ID));

            var tresponse = actionResult as OkNegotiatedContentResult <Data.ScriptHTML>;

            Data.ScriptHTML theText = tresponse.Content;

            var TextHTML = SPutilities.ReplaceObjectsandQuestions(ContCont.HttpContext.Session, theText.HTMLContent, true);

            ViewBag.TextID    = theText.ScriptHTMLID;
            ViewBag.TextTitle = theText.HTMLDesc;
            ViewBag.Content   = TextHTML;

            bool whatif;

            try
            {
                whatif = (bool)theText.ShowDescTooltip;
            }
            catch
            {
                whatif = false;
            }

            if (whatif)
            {
                return(RenderHelper.RenderViewToString(ContCont, "~/Views/TextHTML/_TextHTMLpop.cshtml", theText, ViewData));
            }
            else
            {
                return(RenderHelper.RenderViewToString(ContCont, "~/Views/TextHTML/_TextHTML.cshtml", theText, ViewData));
            }
        }
        public string Render(int ID, ControllerContext ContCont)
        {
            ScreenViewer.API.Elements.TextHTMLController TC = new API.Elements.TextHTMLController();
            var actionResult = TC.GetScriptTextHTML(Convert.ToDecimal(ID));

            var tresponse = actionResult as OkNegotiatedContentResult <Data.ScriptTextHTML>;

            //Assert.IsNotNull(response);
            Data.ScriptTextHTML theText = tresponse.Content;

            var TextHTML  = SPutilities.ReplaceObjectsandQuestions(ContCont.HttpContext.Session, theText.TextHTMLContent, true);
            var TextHTML2 = SPutilities.ReplaceObjectsandQuestions(ContCont.HttpContext.Session, theText.TextHTMLAltContent, true);


            ViewBag.TextID    = theText.ScriptTextHTMLID;
            ViewBag.TextTitle = theText.TextHTMLDesc;

            if (!string.IsNullOrEmpty(SessionControl.SessionManager.ReturnParameter(ContCont.HttpContext.Session, "SwitchLanguage")))
            {
                ViewBag.Content = !string.IsNullOrEmpty(TextHTML2) ? TextHTML2 : TextHTML;
            }
            else
            {
                ViewBag.Content = TextHTML;
            }



            bool whatif;

            try
            {
                whatif = (bool)theText.ShowDescTooltip;
            }
            catch
            {
                whatif = false;
            }
            if (whatif)
            {
                return(RenderHelper.RenderViewToString(ContCont, "~/Views/TextHTML/_TextHTMLpop.cshtml", theText, ViewData));
            }
            else
            {
                return(RenderHelper.RenderViewToString(ContCont, "~/Views/TextHTML/_TextHTML.cshtml", theText, ViewData));
            }
        }
        public ActionResult SearchKnowledgeBase(string SearchPhrase)
        {
            ScreenViewer.API.Elements.TextHTMLController TC = new API.Elements.TextHTMLController();
            string clientID     = SessionControl.SessionManager.GetClientId(HttpContext.Session);
            var    actionResult = TC.GetKBSearchResults(SearchPhrase, clientID);

            var tresponse = actionResult as OkNegotiatedContentResult <List <Data.KBSearch_Result> >;
            List <Data.KBSearch_Result> sr = tresponse.Content;

            foreach (Data.KBSearch_Result KR in sr)
            {
                KR.TextHTMLContent = SPutilities.ReplaceObjectsandQuestions(HttpContext.Session, KR.TextHTMLContent, true);
                KR.TextHTMLContent = KR.TextHTMLContent.Replace("\r", "");
                KR.TextHTMLContent = KR.TextHTMLContent.Replace("\n", "");
                KR.TextHTMLContent = KR.TextHTMLContent.Replace(@"""", @"\""");
                KR.TextHTMLContent = KR.TextHTMLContent.Replace(@"\\", @"\");
                KR.TextHTMLContent = KR.TextHTMLContent.Replace("</script>", string.Format("\" + {0} + \"", "unescape('%3C/script%3E')"));
                KR.TextHTMLContent = KR.TextHTMLContent.Replace("'s", "&apos;s");
            }
            ViewBag.SearchTerm = SearchPhrase;
            return(PartialView("KBResultView", sr));
        }