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); } }
//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()); }