public ActionResult Entities(DataMgrTablesetViewModel viewModel)
        {
            questStatus status = null;
            DataMgrTablesetViewModel dataMgrTablesetViewModel = null;
            UserMessageModeler       userMessageModeler       = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(viewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Redirect to Tablesets if no tablesetId specified.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            if (viewModel.Id < BaseId.VALID_ID)
            {
                status             = new questStatus(Severity.Error, "Invalid Id value.  Must be 1 or greater.");
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Read tableset data management info.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId          tablesetId          = new TablesetId(viewModel.Id);
            TablesetDataModeler tablesetDataModeler = new TablesetDataModeler(this.Request, this.UserSession, viewModel);

            status = tablesetDataModeler.Read(tablesetId, out dataMgrTablesetViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                dataMgrTablesetViewModel             = new DataMgrTablesetViewModel(this.UserSession, viewModel);
                dataMgrTablesetViewModel.questStatus = status;
                return(View(dataMgrTablesetViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success);
            dataMgrTablesetViewModel.questStatus = status;
            return(Json(dataMgrTablesetViewModel, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index(DataMgrTablesetViewModel viewModel)
        {
            questStatus status = null;
            DataMgrTablesetViewModel dataMgrTablesetViewModel = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                dataMgrTablesetViewModel             = new DataMgrTablesetViewModel(this.UserSession, viewModel);
                dataMgrTablesetViewModel.questStatus = status;
                return(View(dataMgrTablesetViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(viewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                dataMgrTablesetViewModel             = new DataMgrTablesetViewModel(this.UserSession, viewModel);
                dataMgrTablesetViewModel.questStatus = status;
                return(View(dataMgrTablesetViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Redirect to Tablesets if no tablesetId specified.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            if (viewModel.Id < BaseId.VALID_ID)
            {
                return(RedirectToAction("Index", "DataMgr", PropagateQueryString(Request)));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Read tableset data management info.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId          tablesetId          = new TablesetId(viewModel.Id);
            TablesetDataModeler tablesetDataModeler = new TablesetDataModeler(this.Request, this.UserSession, viewModel);

            status = tablesetDataModeler.Read(tablesetId, out dataMgrTablesetViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                dataMgrTablesetViewModel             = new DataMgrTablesetViewModel(this.UserSession, viewModel);
                dataMgrTablesetViewModel.questStatus = status;
                return(View(dataMgrTablesetViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            return(View(dataMgrTablesetViewModel));
        }
Exemplo n.º 3
0
        public ActionResult Filters(TablesetEditorViewModel viewModel)
        {
            questStatus            status = null;
            TablesetsListViewModel tablesetsListViewModel = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                tablesetsListViewModel             = new TablesetsListViewModel(this.UserSession, viewModel);
                tablesetsListViewModel.questStatus = status;
                return(View("Index", viewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(viewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                tablesetsListViewModel             = new TablesetsListViewModel(this.UserSession, viewModel);
                tablesetsListViewModel.questStatus = status;
                return(View("Index", viewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Read tableset data management info.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            DataMgrBaseViewModel dataMgrBaseViewModel = new DataMgrBaseViewModel(this.UserSession);

            BufferMgr.TransferBuffer(viewModel, dataMgrBaseViewModel);

            TablesetId tablesetId = new TablesetId(viewModel.Id);
            DataMgrTablesetViewModel dataMgrTablesetViewModel = null;
            TablesetDataModeler      tablesetDataModeler      = new TablesetDataModeler(this.Request, this.UserSession, dataMgrBaseViewModel);

            status = tablesetDataModeler.Read(tablesetId, out dataMgrTablesetViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                dataMgrTablesetViewModel             = new DataMgrTablesetViewModel(this.UserSession, viewModel);
                dataMgrTablesetViewModel.questStatus = status;
                return(View(dataMgrTablesetViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            return(View("~/Areas/DataMgr/Views/Tableset/Index.cshtml", dataMgrTablesetViewModel));
        }