Exemple #1
0
        public ActionResult List(DatabasesListViewModel databasesListViewModel)
        {
            questStatus status = null;

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

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

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Get list of items.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            DatabasesListViewModel databasesListViewModelNEW = null;
            DatabasesListModeler   databasesListModeler      = new DatabasesListModeler(this.Request, this.UserSession);

            status = databasesListModeler.List(out databasesListViewModelNEW);
            if (!questStatusDef.IsSuccess(status))
            {
                databasesListViewModel.questStatus = status;
                return(Json(databasesListViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return result view model or as Excel
            *---------------------------------------------------------------------------------------------------------------------------------*/
            if (databasesListViewModel.bExportToExcel)
            {
                string filename = "DatabasesLog_" + DateTime.Now.ToString();
                Response.ClearContent();
                Response.AddHeader("content-disposition", "atachment;filename=" + filename + ".xls");
                Response.AddHeader("Content-Type", "application/vnd.ms-excel");
                writeTsv(databasesListViewModelNEW, Response.Output);
                Response.Flush();
                Response.End();
                return(new EmptyResult());
            }
            else
            {
                status = new questStatus(Severity.Success);
                databasesListViewModelNEW.questStatus = status;
                return(Json(databasesListViewModelNEW, JsonRequestBehavior.AllowGet));
            }
        }
Exemple #2
0
        public ActionResult Next(DatabasesListViewModel databasesListViewModel)
        {
            questStatus status = null;


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

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

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Get list of items.
            *---------------------------------------------------------------------------------------------------------------------------------*/
            // TODO.
            DatabasesListViewModel tablesetsListViewModelNEW = null;
            DatabasesListModeler   usersListModeler          = new DatabasesListModeler(this.Request, this.UserSession);

            status = usersListModeler.List(out tablesetsListViewModelNEW);
            if (!questStatusDef.IsSuccess(status))
            {
                status = new questStatus(Severity.Success);
                databasesListViewModel.questStatus = status;
                return(Json(databasesListViewModel, JsonRequestBehavior.AllowGet));
            }

            /*----------------------------------------------------------------------------------------------------------------------------------
            * Return view
            *---------------------------------------------------------------------------------------------------------------------------------*/
            status = new questStatus(Severity.Success);
            tablesetsListViewModelNEW.questStatus = status;
            return(Json(tablesetsListViewModelNEW, JsonRequestBehavior.AllowGet));
        }