Beispiel #1
0
        public ActionResult Cancel(TablesetEditorViewModel editorViewModel)
        {
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("LogOperation failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(editorViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("Authorize failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Direct user to list
            *---------------------------------------------------------------------------------------------------------------------------------*/
            return(RedirectToAction("Index", "Tablesets", PropagateQueryString(Request)));
        }
Beispiel #2
0
 public TablesetConfigurationModeler(HttpRequestBase httpRequestBase, UserSession userSession, TablesetEditorViewModel tablesetEditorViewModel)
     : base(httpRequestBase, userSession)
 {
     this._tablesetEditorViewModel = tablesetEditorViewModel;
     this._setupBaseViewModel      = tablesetEditorViewModel;
     initialize();
 }
        public questStatus Read(TablesetId tablesetId, out TablesetEditorViewModel tablesetEditorViewModel)
        {
            // Initialize
            questStatus status = null;

            tablesetEditorViewModel = null;


            // Read
            Quest.Functional.MasterPricing.Tableset tableset = null;
            TablesetsMgr tablesetsMgr = new TablesetsMgr(this.UserSession);

            status = tablesetsMgr.Read(tablesetId, out tableset);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Transfer model.
            tablesetEditorViewModel = new TablesetEditorViewModel(this.UserSession);
            BufferMgr.TransferBuffer(tableset, tablesetEditorViewModel);


            return(new questStatus(Severity.Success));
        }
Beispiel #4
0
        public ActionResult Database(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 for the database Id
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId tablesetId = new TablesetId(viewModel.Id);
            TablesetEditorViewModel tablesetEditorViewModel = null;
            TablesetEditorModeler   tablesetEditorModeler   = new TablesetEditorModeler(this.Request, this.UserSession);

            status = tablesetEditorModeler.Read(tablesetId, out tablesetEditorViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                tablesetsListViewModel             = new TablesetsListViewModel(this.UserSession, viewModel);
                tablesetsListViewModel.questStatus = status;
                return(View("Index", viewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            DatabaseEditorViewModel databaseEditorViewModel = new DatabaseEditorViewModel(this.UserSession, viewModel);

            databaseEditorViewModel.Id          = tablesetEditorViewModel.DatabaseId;
            databaseEditorViewModel.questStatus = new questStatus(Severity.Warning);
            return(View("~/Areas/Setup/Views/Database/Index.cshtml", databaseEditorViewModel));
        }
Beispiel #5
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));
        }
Beispiel #6
0
        public ActionResult Save(TablesetEditorViewModel tablesetEditorViewModel)
        {
            questStatus status = null;

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

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(tablesetEditorViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                tablesetEditorViewModel.questStatus = status;
                return(Json(tablesetEditorViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Perform operation.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            bool bInitialCreation = tablesetEditorViewModel.Id < BaseId.VALID_ID ? true : false;
            TablesetEditorModeler tablesetEditorModeler = new TablesetEditorModeler(this.Request, this.UserSession);

            status = tablesetEditorModeler.Save(tablesetEditorViewModel);
            if (!questStatusDef.IsSuccessOrWarning(status))
            {
                tablesetEditorViewModel.questStatus = status;
                return(Json(tablesetEditorViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return result.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            if (questStatusDef.IsWarning(status))
            {
                tablesetEditorViewModel.questStatus = status;
            }
            else
            {
                status = new questStatus(Severity.Success, "Tableset successfully" + (bInitialCreation ? " created" : " updated"));
            }
            tablesetEditorViewModel.questStatus = status;
            return(Json(tablesetEditorViewModel, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Index(TablesetEditorViewModel editorViewModel)
        {
            questStatus status = null;
            TablesetConfigurationViewModel tablesetConfigurationViewModel = null;

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

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

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Read tableset configuration.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId tablesetId = new TablesetId(editorViewModel.Id);
            TablesetConfigurationModeler tablesetConfigurationModeler = new TablesetConfigurationModeler(this.Request, this.UserSession, editorViewModel);

            status = tablesetConfigurationModeler.Read(tablesetId, out tablesetConfigurationViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                if (tablesetConfigurationViewModel == null)
                {
                    tablesetConfigurationViewModel = new TablesetConfigurationViewModel(this.UserSession, editorViewModel);
                }
                tablesetConfigurationViewModel.questStatus = status;
                return(View(tablesetConfigurationViewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            return(View(tablesetConfigurationViewModel));
        }
Beispiel #8
0
        public ActionResult Configuration(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 configuration.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetConfigurationViewModel tablesetConfigurationViewModel = null;
            TablesetId tablesetId = new TablesetId(viewModel.Id);
            TablesetConfigurationModeler tablesetConfigurationModeler = new TablesetConfigurationModeler(this.Request, this.UserSession, viewModel);

            status = tablesetConfigurationModeler.Read(tablesetId, out tablesetConfigurationViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                tablesetsListViewModel             = new TablesetsListViewModel(this.UserSession, viewModel);
                tablesetsListViewModel.questStatus = status;
                return(View("Index", viewModel));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            return(View("~/Areas/Setup/Views/TablesetConfiguration/Index.cshtml", tablesetConfigurationViewModel));
        }
Beispiel #9
0
        public ActionResult Read(TablesetEditorViewModel editorViewModel)
        {
            questStatus        status             = null;
            UserMessageModeler userMessageModeler = null;

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

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

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Perform operation.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId tablesetId = new TablesetId(editorViewModel.Id);
            TablesetEditorViewModel tablesetEditorViewModel = null;
            TablesetEditorModeler   tablesetEditorModeler   = new Modelers.TablesetEditorModeler(this.Request, this.UserSession);

            status = tablesetEditorModeler.Read(tablesetId, out tablesetEditorViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return result.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success);
            tablesetEditorViewModel.questStatus = status;
            return(Json(tablesetEditorViewModel, JsonRequestBehavior.AllowGet));
        }
Beispiel #10
0
        public ActionResult Delete(TablesetEditorViewModel tablesetEditorViewModel)
        {
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("LogOperation failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(tablesetEditorViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("Authorize failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Perform operation.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId            tablesetId            = new TablesetId(tablesetEditorViewModel.Id);
            TablesetEditorModeler tablesetEditorModeler = new TablesetEditorModeler(this.Request, this.UserSession);

            status = tablesetEditorModeler.Delete(tablesetId);
            if (!questStatusDef.IsSuccess(status))
            {
                tablesetEditorViewModel.questStatus = status;
                return(Json(tablesetEditorViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return result.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success, "Tableset successfully deleted");
            tablesetEditorViewModel.questStatus = status;
            return(Json(tablesetEditorViewModel, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Configuration(TablesetEditorViewModel editorViewModel)
        {
            questStatus status = null;

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

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

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Read tableset configuration.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetId tablesetId = new TablesetId(editorViewModel.Id);
            TablesetConfigurationViewModel tablesetConfigurationViewModel = null;
            TablesetConfigurationModeler   tablesetConfigurationModeler   = new TablesetConfigurationModeler(this.Request, this.UserSession, editorViewModel);

            status = tablesetConfigurationModeler.Read(tablesetId, out tablesetConfigurationViewModel);
            if (!questStatusDef.IsSuccess(status))
            {
                UserMessageModeler userMessageModeler = new UserMessageModeler(status);
                return(Json(userMessageModeler.UserMessage, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            return(View(tablesetConfigurationViewModel));
        }
Beispiel #12
0
        public ActionResult Index(TablesetEditorViewModel editorViewModel)
        {
            questStatus status = null;

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Log Operation
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = LogOperation();
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("LogOperation failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Authorize
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = Authorize(editorViewModel._ctx);
            if (!questStatusDef.IsSuccess(status))
            {
                // TODO
                throw new Exception("Authorize failed");
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            TablesetEditorViewModel tablesetEditorViewModel = new TablesetEditorViewModel(this.UserSession, editorViewModel);

            tablesetEditorViewModel.Id = editorViewModel.Id;
            if (editorViewModel.Id >= BaseId.VALID_ID)
            {
                tablesetEditorViewModel.questStatus = new questStatus(Severity.Warning);
            }
            else
            {
                tablesetEditorViewModel.questStatus = new questStatus(Severity.Success);
            }
            return(View(tablesetEditorViewModel));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/

        #region CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        // CRUD
        //----------------------------------------------------------------------------------------------------------------------------------
        public questStatus Save(TablesetEditorViewModel tablesetEditorViewModel)
        {
            // Initialize
            questStatus status = null;


            // Transfer model
            Quest.Functional.MasterPricing.Tableset tableset = new Functional.MasterPricing.Tableset();
            BufferMgr.TransferBuffer(tablesetEditorViewModel, tableset);


            // Determine if this is a create or update
            TablesetsMgr tablesetsMgr = new TablesetsMgr(this.UserSession);

            if (tablesetEditorViewModel.Id < BaseId.VALID_ID)
            {
                // Create
                TablesetId tablesetId = null;
                status = tablesetsMgr.Create(tableset, out tablesetId);
                if (!questStatusDef.IsSuccess(status))
                {
                    FormatErrorMessage(status, tablesetEditorViewModel);
                    return(status);
                }
                tablesetEditorViewModel.Id = tablesetId.Id;
            }
            else
            {
                // Update
                status = tablesetsMgr.Update(tableset);
                if (!questStatusDef.IsSuccess(status))
                {
                    FormatErrorMessage(status, tablesetEditorViewModel);
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }