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));
            }
        }
Beispiel #2
0
        public static bool AddUpdateQuestion(string[] qid, string responsevalue, string responsetext, HttpSessionStateBase Session)
        {
            string thevalue = string.Empty;

            if (responsevalue.Contains("|"))
            {
                string[] responses = responsevalue.Split('|');
                for (int i = 0; i < qid.Length; i++)
                {
                    thevalue = SPutilities.ReplaceObjectsandQuestions(Session, responses[i], false);
                    if (thevalue.Contains("Value was not found"))
                    {
                        thevalue = string.Empty;
                    }
                    AddUpdateQuestion(qid[i], thevalue, thevalue, Session);
                }
            }
            else
            {
                thevalue = SPutilities.ReplaceObjectsandQuestions(Session, responsevalue, false);
                foreach (string q in qid)
                {
                    AddUpdateQuestion(q, responsevalue, responsetext, Session);
                }
            }

            return(true);
        }
        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 Render(decimal id, ControllerContext ContCont)
        {
            ViewBag.DataViewID = id;

            ScreenViewer.API.Elements.DataViewController DVC = new API.Elements.DataViewController();
            var actionResult = DVC.GetScriptDataView(id);

            var response = actionResult as OkNegotiatedContentResult <Data.ScriptDataView>;

            Data.ScriptDataView theDataView = response.Content;
            DataObjectManager   DOM         = new DataObjectManager();

            ScreenViewer.API.DataObjectController DOC = new API.DataObjectController();

            ViewBag.OID = response.Content.ScriptDataViewID.ToString();

            switch (theDataView.DataViewType)
            {
            case "R":
                DataObjectLoader DOL = new API.ExternalData.DataObjectLoader();

                string      objectname    = System.Text.RegularExpressions.Regex.Split(theDataView.DataViewSource, "::")[1];
                DataObjects DisplayObject = (DataObjects)SessionManager.GetDataObject(ContCont.HttpContext.Session, objectname);

                //Models.DataObjects DisplayObject = (Models.DataObjects)SessionControl.SessionManager.GetDataObject(HttpContext.Session,theDataView.DataViewObjectSource);
                if (DisplayObject != null)
                {
                    return(RenderHelper.RenderViewToString(ContCont, "~/Views/DataView/_DataView_Record.cshtml", DisplayObject.Details, ViewData));
                    //return PartialView("_DataView_Record", DisplayObject.Details);
                }
                else
                {
                    return(string.Empty);
                }

            case "C":

                string objectcolletion = System.Text.RegularExpressions.Regex.Split(theDataView.DataViewSource, "::")[1];
                string dataobname      = System.Text.RegularExpressions.Regex.Split(objectcolletion, "\\.")[0];

                if (SessionManager.GetDataObject(ContCont.HttpContext.Session, dataobname) != null)
                {
                    string tabledata = SPutilities.GenerateGridData3(objectcolletion, ContCont.HttpContext.Session);
                    ViewBag.Table = tabledata;
                    return(RenderHelper.RenderViewToString(ContCont, "~/Views/DataView/_DataView_Grid.cshtml", null, ViewData));
                }
                else
                {
                    ViewBag.Table = string.Empty;
                    return(RenderHelper.RenderViewToString(ContCont, "~/Views/DataView/_DataView_Grid.cshtml", null, ViewData));
                }

            case "S":
                return(string.Empty);

            default:
                return(string.Empty);
            }
        }
        private DataTable CreateObjectSelectList(Data.ScriptQuestion theQuestion, HttpSessionStateBase theSession)
        {
            DataTable dt = SPutilities.GetSelectGridCols(theQuestion.DOValueColumn, theQuestion.DODisplayColumns);

            //DataTable dt = SPutilities.GeneratePickDataCollection(theQuestion.DataObjectField, theQuestion.DOValueColumn, theQuestion.DODisplayColumns, theSession);

            return(dt);
        }
        //HttpContext.Session
        // GET: /DataView/Details/5
        public ActionResult Display(decimal id)
        {
            ViewBag.DataViewID = id;

            ScreenViewer.API.Elements.DataViewController DVC = new API.Elements.DataViewController();
            var actionResult = DVC.GetScriptDataView(id);



            var response = actionResult as OkNegotiatedContentResult <Data.ScriptDataView>;

            //Assert.IsNotNull(response);
            Data.ScriptDataView theDataView = response.Content;
            DataObjectManager   DOM         = new DataObjectManager();

            ScreenViewer.API.DataObjectController DOC = new API.DataObjectController();
            switch (theDataView.DataViewType)
            {
            case "R":
                DataObjectLoader DOL = new API.ExternalData.DataObjectLoader();

                string objectname = System.Text.RegularExpressions.Regex.Split(theDataView.DataViewSource, "::")[1];

                DataObjects DisplayObject = (DataObjects)SessionManager.GetDataObject(HttpContext.Session, objectname);

                //Models.DataObjects DisplayObject = (Models.DataObjects)SessionControl.SessionManager.GetDataObject(HttpContext.Session,theDataView.DataViewObjectSource);
                if (DisplayObject != null)
                {
                    return(PartialView("_DataView_Record", DisplayObject.Details));
                }

                break;

            case "C":

                string objectcolletion = System.Text.RegularExpressions.Regex.Split(theDataView.DataViewSource, "::")[1];
                string dataobname      = System.Text.RegularExpressions.Regex.Split(objectcolletion, "\\.")[0];
                string tabledata       = SPutilities.GenerateGridData2(objectcolletion, HttpContext.Session);
                ViewBag.Table = tabledata;
                return(PartialView("_DataView_Grid", ViewData));

            case "S":

                break;

            default:
                break;
            }


            return(View());
        }
        private List <SelectListItem> CreateDobList(Data.ScriptQuestion theQuestion, HttpSessionStateBase theSession)
        {
            List <SelectListItem> DDItemList = new List <SelectListItem>();
            List <string>         theList    = SPutilities.GeneratePickData1(theQuestion.DataObjectField, theQuestion.DOValueColumn, theQuestion.DODisplayColumns, theSession);

            foreach (string item in theList)
            {
                string[] thevals = Regex.Split(item, @"\|\|");
                DDItemList.Add(new SelectListItem()
                {
                    Text = thevals[1], Value = thevals[0]
                });
            }

            return(DDItemList);
        }
        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 Grid_Create([DataSourceRequest] DataSourceRequest request, string id)
        {
            ScreenViewer.API.Elements.QuestionController QC = new API.Elements.QuestionController();
            var actionResult = QC.GetScriptQuestion(Convert.ToDecimal(id));

            ViewBag.OID = id.ToString();

            var response = actionResult as OkNegotiatedContentResult <Data.ScriptQuestion>;

            //Assert.IsNotNull(response);
            Data.ScriptQuestion theQuestion = response.Content;


            DataTable dt = SPutilities.GeneratePickDataCollection(theQuestion.DataObjectField, theQuestion.DOValueColumn, theQuestion.DODisplayColumns, HttpContext.Session);

            return(Json(dt.ToDataSourceResult(request)));
        }
        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));
        }
        //public ActionResult Display(decimal ID)
        //{
        //    ViewBag.QuestionID = ID;

        //    var pview = RenderQuestion(ID);
        //    ViewBag.PartialView = pview;
        //    //return RedirectToAction(RenderQuestion(ID));
        //    return RedirectToAction("RenderQuestion", new { ID = ID });

        //    //return View("_Question");

        //}
        //public ActionResult Display(decimal ID)
        //{
        //    return Display(ID, "false");
        //}
        //public ActionResult Display(decimal ID,bool criticalelement)
        //{
        //    ViewBag.QuestionID = ID;
        //    ViewBag.DisplayLabel = true;
        //    ScreenViewer.API.Elements.QuestionController QC = new API.Elements.QuestionController();
        //    var actionResult = QC.GetScriptQuestion(ID);



        //    var response = actionResult as OkNegotiatedContentResult<Data.ScriptQuestion>;
        //    //Assert.IsNotNull(response);
        //    Data.ScriptQuestion theQuestion = response.Content;
        //    ViewBag.QuestionDisplay = SPutilities.ReplaceObjectsandQuestions(HttpContext.Session, theQuestion.QuestionText,true);
        //    ViewBag.QuestionID = theQuestion.ScriptQuestionID;
        //    ViewBag.ControlName = "SPQuestion_" + theQuestion.ScriptQuestionID;
        //    if (criticalelement)
        //    {
        //        ViewBag.ControlName += "_C";
        //    }
        //    string cresp = SessionControl.SessionManager.GetQuestionResponse(ID.ToString(), HttpContext.Session);

        //    ViewBag.ReturnType = theQuestion.ResponseType;
        //    ViewBag.AnswerRequired = theQuestion.AnswerRequired.Value ? "required" : string.Empty;

        //    switch (theQuestion.QuestionType)
        //    {
        //        case FREE_TEXT:
        //            ViewBag.CurrentResponse = cresp;
        //            ViewBag.ValidatorRegex = null;
        //            if (theQuestion.ScriptValidatorID != null && theQuestion.ScriptValidatorID != 0)
        //            {
        //                var result = QC.GetScriptTextValidator(theQuestion.ScriptValidatorID.Value);
        //                var ValidatorResponse = result as OkNegotiatedContentResult<Data.ScriptValidator>;
        //                Data.ScriptValidator scriptTextValidator = ValidatorResponse.Content;
        //                ViewBag.ValidatorRegex = scriptTextValidator.ValidatorRegex;
        //                ViewBag.ValidatorDesc = scriptTextValidator.ValidatorDesc;
        //            }
        //            switch (theQuestion.ResponseType)
        //            {
        //                case "Date":
        //                case "DateTime":
        //                case "Time":
        //                    return PartialView("_DateTimeQuestion");
        //                 case "Number":

        //                    if (theQuestion.MinimumValue != null)
        //                    {
        //                        ViewBag.MinValue = theQuestion.MinimumValue;
        //                    }
        //                    if (theQuestion.MaximumValue != null)
        //                    {

        //                       ViewBag.MaxValue = theQuestion.MaximumValue;
        //                    }
        //                    return PartialView("_NumericQuestion");
        //                case "String":
        //                    ViewBag.MaxLength = theQuestion.MaxLength;
        //                    return PartialView("_TextQuestion");
        //            }
        //            break;
        //        case CONFIRM:
        //           ViewBag.CurrentResponse = cresp;
        //           ViewBag.Checked = cresp == "True" ? "Checked" : "";
        //            return PartialView("_ConfirmQuestion");
        //        case YES_NO:
        //            ViewBag.CurrentResponse = cresp;
        //            ViewBag.YesCheck = cresp == "Yes" ? "Checked" : "";
        //            ViewBag.NoCheck = cresp == "No" ? "Checked" : "";

        //            return PartialView("_YesNoQuestion");
        //        case PICK_ONE_ALT:
        //        case PICK_ONE:
        //            ViewBag.CurrentResponse = cresp == null ? null :cresp;
        //            if (!string.IsNullOrEmpty(theQuestion.DataObjectField))
        //            {


        //            }
        //            else
        //            {

        //                List<SelectListItem> pickList = CreateDOList(theQuestion.Choices);
        //                ViewBag.PickList = pickList;
        //                ViewBag.PickLength = pickList.Count;
        //                ViewBag.ControlID = "listquestion_" + theQuestion.ScriptQuestionID.ToString();

        //                return PartialView("_PickOneQuestion");
        //            }
        //            break;
        //        case PICK_MANY:
        //            ViewBag.CurrentResponse = cresp == null ? null : Regex.Split(cresp, ",").ToList();
        //            if (!string.IsNullOrEmpty(theQuestion.DataObjectField))
        //            {


        //            }
        //            else
        //            {
        //                List<SelectListItem> pickList = CreateDOList(theQuestion.Choices);
        //                ViewBag.PickList = pickList;
        //                ViewBag.PickLength = pickList.Count;
        //                ViewBag.ID = theQuestion.ScriptQuestionID.ToString();
        //                ViewBag.ControlID = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
        //                return PartialView("_PickManyQuestion");

        //            }
        //            break;
        //        default:
        //            break;


        //    }
        //    return Content("Blah Blah");
        //}
        public ScreenViewer.Models.Elements.QuestionLayout RenderQuestionParts(decimal ID, bool criticalelement, ControllerContext ContCont)
        {
            ScreenViewer.Models.Elements.QuestionLayout questionLayout = new Models.Elements.QuestionLayout();

            ViewBag.QuestionID   = ID;
            ViewBag.DisplayLabel = false;
            ScreenViewer.API.Elements.QuestionController QC = new API.Elements.QuestionController();
            var actionResult = QC.GetScriptQuestion(ID);



            var response = actionResult as OkNegotiatedContentResult <Data.ScriptQuestion>;

            //Assert.IsNotNull(response);
            Data.ScriptQuestion theQuestion = response.Content;
            ViewBag.QuestionDisplay = SPutilities.ReplaceObjectsandQuestions(ContCont.HttpContext.Session, theQuestion.QuestionText, true);
            ViewBag.QuestionID      = theQuestion.ScriptQuestionID;
            ViewBag.ControlName     = "SPQuestion_" + theQuestion.ScriptQuestionID;
            if (criticalelement)
            {
                ViewBag.ControlName += "_C";
            }
            string cresp = SessionControl.SessionManager.GetQuestionResponse(ID.ToString(), ContCont.HttpContext.Session);

            if (string.IsNullOrEmpty(cresp) && !string.IsNullOrEmpty(theQuestion.KeyCodes))
            {
                if (theQuestion.KeyCodes.StartsWith("DO."))
                {
                    string[] holdKeyCode = theQuestion.KeyCodes.Split('.');
                    string   dataObject  = holdKeyCode[1];
                    ScreenViewer.Models.DataObjects ScriptDataObject = (ScreenViewer.Models.DataObjects)SessionControl.SessionManager.GetDataObject(ContCont.HttpContext.Session, dataObject);

                    if (ScriptDataObject != null)
                    {
                        foreach (var detail in ScriptDataObject.Details)
                        {
                            if (detail.DetailName == holdKeyCode[2] && detail.DetailValue != null)
                            {
                                cresp = detail.DetailValue.ToString();
                            }
                        }
                    }
                }
            }

            ViewBag.ReturnType = theQuestion.ResponseType;

            try
            {
                ViewBag.AnswerRequired = ((bool)theQuestion.AnswerRequired) ? "required" : string.Empty;
            }
            catch
            {
                ViewBag.AnswerRequired = string.Empty;
            }
            questionLayout.QuestionLabelText = ViewBag.QuestionDisplay;//theQuestion.QuestionText;


            switch (theQuestion.QuestionType)
            {
            case FREE_TEXT:
                ViewBag.Type            = "text";
                ViewBag.CurrentResponse = cresp;
                ViewBag.ValidatorRegex  = null;

                if (theQuestion.QuestionDesc.Substring(theQuestion.QuestionDesc.Length - 1) == "$")
                {
                    ViewBag.Type = "password";
                }

                if (theQuestion.ScriptValidatorID != null && theQuestion.ScriptValidatorID != 0)
                {
                    var result            = QC.GetScriptTextValidator(theQuestion.ScriptValidatorID.Value);
                    var ValidatorResponse = result as OkNegotiatedContentResult <Data.ScriptValidator>;
                    Data.ScriptValidator scriptTextValidator = ValidatorResponse.Content;
                    ViewBag.ValidatorRegex = scriptTextValidator.ValidatorRegex;
                    ViewBag.ValidatorDesc  = scriptTextValidator.ValidatorDesc;
                }

                switch (theQuestion.ResponseType)
                {
                case "Date":
                case "DateTime":
                case "Time":
                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_DateTimeQuestion.cshtml", theQuestion, ViewData);
                    break;

                case "Number":

                    if (theQuestion.MinimumValue != null)
                    {
                        ViewBag.MinValue = theQuestion.MinimumValue;
                    }
                    if (theQuestion.MaximumValue != null)
                    {
                        ViewBag.MaxValue = theQuestion.MaximumValue;
                    }
                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_NumericQuestion.cshtml", theQuestion, ViewData);
                    break;

                case "String":
                    ViewBag.MaxLength = theQuestion.MaxLength;

                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_TextQuestion.cshtml", theQuestion, ViewData);
                    break;
                }
                break;

            case CONFIRM:
                ViewBag.CurrentResponse     = cresp;
                ViewBag.Checked             = cresp == "True" ? "Checked" : "";
                questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_ConfirmQuestion.cshtml", theQuestion, ViewData);
                break;


            case YES_NO:
                ViewBag.CurrentResponse = cresp;
                ViewBag.YesCheck        = cresp == "Yes" ? "Checked" : "";
                ViewBag.NoCheck         = cresp == "No" ? "Checked" : "";

                questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_YesNoQuestion.cshtml", theQuestion, ViewData);
                break;

            case PICK_ONE_ALT:
            case PICK_ONE:

                ViewBag.CurrentResponse = cresp == null ? null : cresp;
                ViewBag.QuestionType    = theQuestion.QuestionType;
                ViewBag.MaxLength       = theQuestion.MaxLength;
                if (!string.IsNullOrEmpty(theQuestion.DataObjectField))
                {
                    List <string> displayItems = Regex.Split(theQuestion.DODisplayColumns, "~").ToList();
                    if (displayItems.Count > 1)
                    {
                        DataTable listtable = CreateObjectSelectList(theQuestion, ContCont.HttpContext.Session);
                        ViewBag.ValueColumn         = theQuestion.DOValueColumn;
                        ViewBag.DataTable           = listtable;
                        ViewBag.ControlID           = "gridquestion_" + theQuestion.ScriptQuestionID.ToString();
                        ViewBag.OID                 = theQuestion.ScriptQuestionID.ToString();
                        questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_ObjectSelector.cshtml", theQuestion, ViewData);
                    }
                    else
                    {
                        List <SelectListItem> pickList = CreateDobList(theQuestion, ContCont.HttpContext.Session);
                        ViewBag.PickList            = pickList;
                        ViewBag.PickLength          = pickList.Count;
                        ViewBag.ControlID           = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
                        questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_PickOneQuestion.cshtml", theQuestion, ViewData);
                        break;
                    }
                }
                else if (theQuestion.ScriptLookupID != null && theQuestion.ScriptLookupID.Value != 0.0M)
                {
                    List <SelectListItem> pickList = CreateLookupList(theQuestion, ContCont.HttpContext.Session);
                    ViewBag.PickList            = pickList;
                    ViewBag.PickLength          = pickList.Count;
                    ViewBag.ControlID           = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_PickOneQuestion.cshtml", theQuestion, ViewData);
                    break;
                }
                else
                {
                    List <SelectListItem> pickList = CreateDOList(theQuestion.Choices);
                    ViewBag.PickList            = pickList;
                    ViewBag.PickLength          = pickList.Count;
                    ViewBag.ControlID           = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_PickOneQuestion.cshtml", theQuestion, ViewData);
                    break;
                }
                break;

            case PICK_MANY:
                ViewBag.CurrentResponse = cresp == null ? null : Regex.Split(cresp, ",").ToList();
                ViewBag.CurrentResponse = cresp == null ? null : Regex.Split(cresp, "~").ToList();
                ViewBag.MaxLength       = theQuestion.MaxLength;

                //string pmResponse = string.Empty;
                //List<string> holdList = cresp == null ? null : Regex.Split(cresp, ",").ToList();
                //if (holdList != null && holdList.Count > 0)
                //{
                //    foreach (var item in holdList)
                //    {
                //        pmResponse = string.Format("{0}'{1}',", pmResponse, item);
                //    }

                //    pmResponse = pmResponse.TrimEnd(',');
                //    ViewBag.CurrentResponse = System.Web.HttpUtility.JavaScriptStringEncode(pmResponse);
                //}
                //else
                //    ViewBag.CurrentResponse = pmResponse;

                List <string> displayItems2 = null;
                if (theQuestion.DODisplayColumns != null)
                {
                    displayItems2 = Regex.Split(theQuestion.DODisplayColumns, "~").ToList();
                }

                if (!string.IsNullOrEmpty(theQuestion.DataObjectField))
                {
                    if (displayItems2.Count > 1)
                    {
                        DataTable listtable = CreateObjectSelectList(theQuestion, ContCont.HttpContext.Session);
                        ViewBag.DataTable           = listtable;
                        ViewBag.ControlID           = "gridquestion_" + theQuestion.ScriptQuestionID.ToString();
                        questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_ObjectSelector.cshtml", theQuestion, ViewData);
                    }
                    else
                    {
                        List <SelectListItem> pickList = CreateDobList(theQuestion, ContCont.HttpContext.Session);
                        ViewBag.PickList            = pickList;
                        ViewBag.PickLength          = pickList.Count;
                        ViewBag.ID                  = theQuestion.ScriptQuestionID.ToString();
                        ViewBag.ControlID           = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
                        questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_PickManyQuestion.cshtml", theQuestion, ViewData);
                    }
                }
                else if (theQuestion.ScriptLookupID != null && theQuestion.ScriptLookupID.Value != 0.0M)
                {
                    List <SelectListItem> pickList = CreateLookupList(theQuestion, ContCont.HttpContext.Session);
                    ViewBag.PickList            = pickList;
                    ViewBag.PickLength          = pickList.Count;
                    ViewBag.ID                  = theQuestion.ScriptQuestionID.ToString();
                    ViewBag.ControlID           = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_PickManyQuestion.cshtml", theQuestion, ViewData);
                }
                else
                {
                    List <SelectListItem> pickList = CreateDOList(theQuestion.Choices);
                    ViewBag.PickList            = pickList;
                    ViewBag.PickLength          = pickList.Count;
                    ViewBag.ID                  = theQuestion.ScriptQuestionID.ToString();
                    ViewBag.ControlID           = "listquestion_" + theQuestion.ScriptQuestionID.ToString();
                    questionLayout.QuestionHTML = RenderHelper.RenderViewToString(ContCont, "~/Views/Question/_PickManyQuestion.cshtml", theQuestion, ViewData);
                    break;
                }
                break;

            default:
                break;
            }
            return(questionLayout);
        }