public ActionResult Index(AppIndex model) { if (!model.ID.HasValue) { return(new HttpNotFoundResult()); } var apConfig = ConfigBase.Settings.Applications.SelectForLoggedUser(User, model.ID.Value); if (apConfig == null) { return(new HttpNotFoundResult()); } App app = new App { ID = model.ID.Value, Name = apConfig.Name, Fields = apConfig.Fields, Config = apConfig }; ViewBag.AppActive = model.ID; ViewBag.AppName = app.Config.Name; return(View(app)); }
// GET: Vendors public ActionResult Index(AppIndex model) { var appSettings = settingsService.Get(); var app = applicationService.Get(model.ID.Value.ToString()); var dataJson = JsonConvert.SerializeObject(app, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, StringEscapeHandling = StringEscapeHandling.EscapeHtml, ContractResolver = new CamelCasePropertyNamesContractResolver(), Converters = new[] { new ApplicationJsonConverter() } }); ViewBag.NoAngular = true; var gridModel = new DataGridModel { DataJson = dataJson, RowsPerPage = appSettings.MaxPerPage }; return(View(gridModel)); }
public ActionResult Index(AppIndex model) { if (!model.ID.HasValue) { return(new HttpNotFoundResult()); } var apConfig = ConfigBase.Settings.Applications.SelectForLoggedUser(User, model.ID.Value); if (apConfig == null) { return(new HttpNotFoundResult()); } var config = configService.GetApplicationSettings(); if (apConfig.Type == ApplicationTypeEnum.DataGrid) { var gridModel = new DataGridModel(); gridModel.RowsPerPage = config.MaxPerPage; gridModel.DataJson = JsonConvert.SerializeObject(apConfig, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, StringEscapeHandling = StringEscapeHandling.EscapeHtml, Converters = new[] { new ApplicationJsonConverter() } }); ViewBag.NoAngular = true; return(View("DataGrid", gridModel)); } if (model.Form != null && model.Form.Count != 0) { if (!model.Page.HasValue) { model.Page = 1; } if (!string.IsNullOrWhiteSpace(model.Exporting) && model.Exporting == "1") { if (UserPermissionsEnum.ExportResults.IsUserAuthorized(User)) { Documents.ExportResults(apConfig, model.Form, User, model.Page.Value, model.Sort); } return(null); } else { return(Json(Documents.GetResults(apConfig, model.Form, User, model.Page.Value, model.Sort))); } } App app = new App() { ID = model.ID.Value, Name = apConfig.Name, Fields = apConfig.Fields, FieldsSettingJson = Utils.GetFieldsJson(apConfig.Fields), Config = apConfig, FormState = model.Form }; ViewBag.AppActive = model.ID; if (apConfig.Custom?.HideTab ?? false) { if (ConfigBase.Settings.Applications.FilterForLoggedUser(User) .Any(a => a.ID == apConfig.Custom?.SubApplicationId)) { ViewBag.AppActive = apConfig.Custom?.SubApplicationId; } } ViewBag.AppName = app.Config.Name; return(View(app)); }