public ActionResult ExportRun(FilterRunViewModel viewModel) { questStatus status = null; /*---------------------------------------------------------------------------------------------------------------------------------- * Log Operation *---------------------------------------------------------------------------------------------------------------------------------*/ status = LogOperation(); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Authorize *---------------------------------------------------------------------------------------------------------------------------------*/ status = Authorize(viewModel._ctx); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Perform operation. *---------------------------------------------------------------------------------------------------------------------------------*/ FilterRunViewModel filterRunViewModel = null; ResultsSet resultsSet = null; FilterPanelModeler filterPanelModeler = new FilterPanelModeler(Request, this.UserSession, viewModel); status = filterPanelModeler.Run(viewModel, out filterRunViewModel, out resultsSet); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Return result view model or as Excel *---------------------------------------------------------------------------------------------------------------------------------*/ Response.ClearContent(); Response.AddHeader("content-disposition", "atachment;filename=" + filterRunViewModel.Name.Replace(" ", "_") + ".xls"); Response.AddHeader("Content-Type", "application/vnd.ms-excel"); WriteTsv(resultsSet, Response.Output); Response.Flush(); Response.End(); return(new EmptyResult()); }
public ActionResult Run(FilterEditorViewModel viewModel) { questStatus status = null; /*---------------------------------------------------------------------------------------------------------------------------------- * Log Operation *---------------------------------------------------------------------------------------------------------------------------------*/ status = LogOperation(); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Authorize *---------------------------------------------------------------------------------------------------------------------------------*/ status = Authorize(viewModel._ctx); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Perform operation. *---------------------------------------------------------------------------------------------------------------------------------*/ RunFilterRequest runFilterRequest = new RunFilterRequest(); runFilterRequest.FilterId.Id = viewModel.FilterId; runFilterRequest.RowLimit = viewModel._ResultsOptions.RowLimit; runFilterRequest.ColLimit = viewModel._ResultsOptions.ColLimit; FilterRunViewModel filterRunViewModel = null; FilterPanelModeler filterPanelModeler = new FilterPanelModeler(Request, this.UserSession, viewModel); status = filterPanelModeler.Run(runFilterRequest, out filterRunViewModel); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Return result. *---------------------------------------------------------------------------------------------------------------------------------*/ status = new questStatus(Severity.Success, "Filter successfully run"); filterRunViewModel.questStatus = status; return(Json(filterRunViewModel, JsonRequestBehavior.AllowGet)); }
public ActionResult Run(FilterRunViewModel viewModel) { questStatus status = null; /*---------------------------------------------------------------------------------------------------------------------------------- * Log Operation *---------------------------------------------------------------------------------------------------------------------------------*/ status = LogOperation(); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Authorize *---------------------------------------------------------------------------------------------------------------------------------*/ status = Authorize(viewModel._ctx); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Perform operation. *---------------------------------------------------------------------------------------------------------------------------------*/ if (viewModel.Items.Count == 0) { string items = Request.Form["Items"].ToString(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); List <FilterItemViewModel> itemsList = javaScriptSerializer.Deserialize <List <FilterItemViewModel> >(items); viewModel.Items = itemsList; string resultsOptions = Request.Form["_ResultsOptions"].ToString(); ResultsOptionsViewModel _ResultsOptions = javaScriptSerializer.Deserialize <ResultsOptionsViewModel>(resultsOptions); viewModel._ResultsOptions = _ResultsOptions; } FilterRunViewModel filterRunViewModel = null; ResultsSet resultsSet = null; FilterPanelModeler filterPanelModeler = new FilterPanelModeler(Request, this.UserSession, viewModel); status = filterPanelModeler.Run(viewModel, out filterRunViewModel, out resultsSet); if (!questStatusDef.IsSuccess(status)) { viewModel.questStatus = status; return(Json(viewModel, JsonRequestBehavior.AllowGet)); } /*---------------------------------------------------------------------------------------------------------------------------------- * Return result view model or as Excel *---------------------------------------------------------------------------------------------------------------------------------*/ if (viewModel.bExportToExcel) { Response.ClearContent(); Response.AddHeader("content-disposition", "atachment;filename=" + filterRunViewModel.Name.Replace(" ", "_") + ".xls"); Response.AddHeader("Content-Type", "application/vnd.ms-excel"); WriteTsv(resultsSet, Response.Output); Response.Flush(); Response.End(); return(new EmptyResult()); } else { status = new questStatus(Severity.Success, "Filter successfully run"); filterRunViewModel.questStatus = status; return(Json(filterRunViewModel, JsonRequestBehavior.AllowGet)); } }