public BaseUserSessionViewModel(UserSession UserSession, BaseViewModel baseViewModel) : base(baseViewModel) { this._userSession = UserSession; this._ctx = UserSession.Id; this.UserSession = new UserSessionViewModel(); BufferMgr.TransferBuffer(this._userSession, this.UserSession, true); BufferMgr.TransferBuffer(this._userSession.User, this.UserSession.User); initialize(); }
/*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus List(UserId userId, out TablesetListViewModel tablesetListViewModel) { // Initialize questStatus status = null; tablesetListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchField searchField = new SearchField(); searchField.Name = "bEnabled"; searchField.SearchOperation = SearchOperation.Equal; searchField.Type = typeof(bool); searchField.Value = "1".ToString(); searchFieldList.Add(searchField); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // Get DataMgr tablesets List <Tableset> tablesetList = null; TablesetMgr tablesetMgr = new TablesetMgr(); status = tablesetMgr.List(queryOptions, out tablesetList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort by name tablesetList.Sort(delegate(Tableset i1, Tableset i2) { return(i1.Name.CompareTo(i2.Name)); }); // Build model tablesetListViewModel = new TablesetListViewModel(this.UserSession); foreach (Tableset tableset in tablesetList) { TablesetLineItemViewModel tablesetLineItemViewModel = new TablesetLineItemViewModel(); BufferMgr.TransferBuffer(tableset, tablesetLineItemViewModel); tablesetListViewModel.Items.Add(tablesetLineItemViewModel); } return(new questStatus(Severity.Success)); }
private questStatus create(MasterPricingEntities dbContext, List <Quest.Functional.MasterPricing.Table> tableList, out List <Quest.Functional.MasterPricing.Table> tableIdList) { // Initialize questStatus status = null; tableIdList = null; // Perform create try { List <Quest.Services.Dbio.MasterPricing.Tables> _tableList = new List <Tables>(); foreach (Quest.Functional.MasterPricing.Table table in tableList) { Quest.Services.Dbio.MasterPricing.Tables _table = new Quest.Services.Dbio.MasterPricing.Tables(); BufferMgr.TransferBuffer(table, _table); _tableList.Add(_table); } dbContext.Tables.AddRange(_tableList); dbContext.SaveChanges(); tableIdList = new List <Table>(); foreach (Quest.Services.Dbio.MasterPricing.Tables _table in _tableList) { Quest.Functional.MasterPricing.Table table = new Table(); BufferMgr.TransferBuffer(_table, table); tableIdList.Add(table); } } catch (DbEntityValidationException ex) { var errorMessages = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage); String fullErrorMessage = string.Join("; ", errorMessages); String exceptionMessage = string.Concat(ex.Message, fullErrorMessage); status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, exceptionMessage)); LogException(ex, status); return(status); } catch (System.Exception ex) { status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); LogException(ex, status); return(status); } return(new questStatus(Severity.Success)); }
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)); }
public questStatus TransferResults(RunFilterRequest runFilterRequest, ResultsSet resultsSet, out FilterRunViewModel filterRunViewModel) { // Initialize questStatus status = null; filterRunViewModel = null; // Get number of entities. int numEntities = 0; status = GetNumEntities(resultsSet, out numEntities); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model filterRunViewModel = new FilterRunViewModel(); filterRunViewModel.NumRows = resultsSet.NumRows; filterRunViewModel.QueryResponse.TotalRecords = resultsSet.NumRows; filterRunViewModel.Id = runFilterRequest != null ? runFilterRequest.FilterId.Id : BaseId.INVALID_ID; filterRunViewModel.FilterId = runFilterRequest != null ? runFilterRequest.FilterId.Id : BaseId.INVALID_ID; foreach (KeyValuePair <string, Column> kvp in resultsSet.ResultColumns) { ColumnHeaderViewModel columnHeaderViewModel = new ColumnHeaderViewModel(); BufferMgr.TransferBuffer(kvp.Value, columnHeaderViewModel, true); columnHeaderViewModel.Name = kvp.Value.Name; columnHeaderViewModel.Label = MakeColumnLabel(kvp, numEntities); columnHeaderViewModel.Type = kvp.Value.DataTypeName; filterRunViewModel.Results.Columns.Add(columnHeaderViewModel); } foreach (dynamic _dynRow in resultsSet.Data) { DynamicRowViewModel dynamicRowViewModel = new DynamicRowViewModel(); int cidx = 0; foreach (KeyValuePair <string, object> kvp in _dynRow) { ColumnValueViewModel columnValueViewModel = new ColumnValueViewModel(); columnValueViewModel.Name = string.IsNullOrEmpty(filterRunViewModel.Results.Columns[cidx].Label) ? filterRunViewModel.Results.Columns[cidx].Name : filterRunViewModel.Results.Columns[cidx].Label; columnValueViewModel.Label = filterRunViewModel.Results.Columns[cidx].Label; columnValueViewModel.Value = kvp.Value == null ? "(null)" : kvp.Value.ToString(); dynamicRowViewModel.ColumnValues.Add(columnValueViewModel); cidx += 1; } filterRunViewModel.Results.Items.Add(dynamicRowViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.Lookup> lookupList, out QueryResponse queryResponse) { // Initialize questStatus status = null; lookupList = null; queryResponse = null; using (MasterPricingEntities dbContext = new MasterPricingEntities()) { using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted)) { try { PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.Lookups).GetProperties().ToArray(); int totalRecords = dbContext.vwLookupsList4.Where(BuildWhereClause(queryOptions, dbProperties)).Count(); List <Quest.Services.Dbio.MasterPricing.vwLookupsList4> _lookupsList = dbContext.vwLookupsList4.Where(BuildWhereClause(queryOptions, dbProperties)) .OrderBy(BuildSortString(queryOptions.SortColumns)) .Skip(queryOptions.Paging.PageSize * (queryOptions.Paging.PageNumber - 1)) .Take(queryOptions.Paging.PageSize).ToList(); if (_lookupsList == null) { return(new questStatus(Severity.Warning)); } lookupList = new List <Quest.Functional.MasterPricing.Lookup>(); foreach (Quest.Services.Dbio.MasterPricing.vwLookupsList4 _lookup in _lookupsList) { Quest.Functional.MasterPricing.Lookup lookup = new Quest.Functional.MasterPricing.Lookup(); BufferMgr.TransferBuffer(_lookup, lookup); lookupList.Add(lookup); } status = BuildQueryResponse(totalRecords, queryOptions, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } } catch (System.Exception ex) { status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); LogException(ex, status); return(status); } } } return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Properties *=================================================================================================================================*/ #endregion #region Public Methods /*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.Tableset> tablesetList, out QueryResponse queryResponse) { // Initialize questStatus status = null; tablesetList = null; queryResponse = null; string assemblyName = Assembly.GetCallingAssembly().FullName; // Get tablesets using (MasterPricingEntities dbContext = new MasterPricingEntities()) { using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted)) { try { PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.Tablesets).GetProperties().ToArray(); int totalRecords = dbContext.Tablesets.Where(BuildWhereClause(queryOptions, dbProperties)).Count(); List <Quest.Services.Dbio.MasterPricing.Tablesets> _tablesetList = dbContext.Tablesets.Where(BuildWhereClause(queryOptions, dbProperties)) .OrderBy(BuildSortString(queryOptions.SortColumns)) .Skip(queryOptions.Paging.PageSize * (queryOptions.Paging.PageNumber - 1)) .Take(queryOptions.Paging.PageSize).ToList(); if (_tablesetList == null) { return(new questStatus(Severity.Warning)); } tablesetList = new List <Tableset>(); foreach (Quest.Services.Dbio.MasterPricing.Tablesets _instantMessageContact in _tablesetList) { Tableset tableset = new Tableset(); BufferMgr.TransferBuffer(_instantMessageContact, tableset); tablesetList.Add(tableset); } status = BuildQueryResponse(totalRecords, queryOptions, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } } catch (System.Exception ex) { return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.InnerException != null ? ex.InnerException.Message : ex.Message))); } } } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out List <Privilege> privilegeList, out QueryResponse queryResponse) { // Initialize questStatus status = null; privilegeList = null; queryResponse = null; using (FMSEntities dbContext = new FMSEntities()) { using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted)) { try { PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.FMS.Privileges).GetProperties().ToArray(); int totalRecords = dbContext.Privileges.Where(BuildWhereClause(queryOptions, dbProperties)).Count(); List <Quest.Services.Dbio.FMS.Privileges> _privilegesList = dbContext.Privileges.Where(BuildWhereClause(queryOptions, dbProperties)) .OrderBy(BuildSortString(queryOptions.SortColumns)) .Skip(queryOptions.Paging.PageSize * (queryOptions.Paging.PageNumber - 1)) .Take(queryOptions.Paging.PageSize).ToList(); if (_privilegesList == null) { return(new questStatus(Severity.Warning)); } privilegeList = new List <Privilege>(); foreach (Quest.Services.Dbio.FMS.Privileges _privilege in _privilegesList) { Privilege privilege = new Privilege(); BufferMgr.TransferBuffer(_privilege, privilege); privilegeList.Add(privilege); } status = BuildQueryResponse(totalRecords, queryOptions, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } } catch (System.Exception ex) { return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.InnerException != null ? ex.InnerException.Message : ex.Message))); } } } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out HTTPRequestsListViewModel httpRequestsListViewModel) { // Initialize questStatus status = null; httpRequestsListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.Logging.HTTPRequestLog> httpRequestLogList = null; HTTPRequestLogsMgr httpRequestLogsMgr = new HTTPRequestLogsMgr(this.UserSession); status = httpRequestLogsMgr.List(queryOptions, out httpRequestLogList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort if sort not specified. if (queryOptions.SortColumns.Columns.Count == 0) { httpRequestLogList.Sort(delegate(Quest.Functional.Logging.HTTPRequestLog i1, Quest.Functional.Logging.HTTPRequestLog i2) { return(i2.Created.CompareTo(i1.Created)); }); } // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. httpRequestsListViewModel = new HTTPRequestsListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } httpRequestsListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.Logging.HTTPRequestLog httpRequestLog in httpRequestLogList) { HTTPRequestLineItemViewModel httpRequestLineItemViewModel = new HTTPRequestLineItemViewModel(); BufferMgr.TransferBuffer(httpRequestLog, httpRequestLineItemViewModel); httpRequestsListViewModel.Items.Add(httpRequestLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out DatabasesListViewModel databasesListViewModel) { // Initialize questStatus status = null; databasesListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.MasterPricing.Database> databaseList = null; DatabasesMgr databasesMgr = new DatabasesMgr(this.UserSession); status = databasesMgr.List(queryOptions, out databaseList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort databaseList.Sort(delegate(Quest.Functional.MasterPricing.Database i1, Quest.Functional.MasterPricing.Database i2) { return(i1.Name.CompareTo(i2.Name)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. databasesListViewModel = new DatabasesListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } databasesListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.MasterPricing.Database database in databaseList) { DatabaseLineItemViewModel databaseLineItemViewModel = new DatabaseLineItemViewModel(); BufferMgr.TransferBuffer(database, databaseLineItemViewModel); databaseLineItemViewModel.LastRefresh = database.LastRefresh.HasValue ? database.LastRefresh.Value.ToString("MM/dd/yyyy HH:mm:ss") : ""; databasesListViewModel.Items.Add(databaseLineItemViewModel); } return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus Save(FilterEditorViewModel filterEditorViewModel) { // Initialize questStatus status = null; // Validate if (filterEditorViewModel.TablesetId < BaseId.VALID_ID) { return(new questStatus(Severity.Error, "Invalid Tableset Id")); } // Transfer model Quest.Functional.MasterPricing.Filter filter = new Functional.MasterPricing.Filter(); BufferMgr.TransferBuffer(filterEditorViewModel, filter); // Determine if this is a create or update FiltersMgr filtersMgr = new FiltersMgr(this.UserSession); if (filterEditorViewModel.Id < BaseId.VALID_ID) { // Create FilterId filterId = null; status = filtersMgr.Create(filter, out filterId); if (!questStatusDef.IsSuccess(status)) { FormatErrorMessage(status, filterEditorViewModel); return(status); } filterEditorViewModel.Id = filterId.Id; } else { // Update status = filtersMgr.Update(filter); if (!questStatusDef.IsSuccess(status)) { FormatErrorMessage(status, filterEditorViewModel); return(status); } } return(new questStatus(Severity.Success)); }
/*---------------------------------------------------------------------------------------------------------------------------------- * Lookups *---------------------------------------------------------------------------------------------------------------------------------*/ private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.Lookup lookup, out LookupId lookupId) { // Initialize questStatus status = null; lookupId = null; // Perform create try { Quest.Services.Dbio.MasterPricing.Lookups _lookup = new Quest.Services.Dbio.MasterPricing.Lookups(); BufferMgr.TransferBuffer(lookup, _lookup); dbContext.Lookups.Add(_lookup); dbContext.SaveChanges(); if (_lookup.Id == 0) { return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.Lookup not created")); } lookupId = new LookupId(_lookup.Id); } catch (DbEntityValidationException ex) { var errorMessages = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage); String fullErrorMessage = string.Join("; ", errorMessages); String exceptionMessage = string.Concat(ex.Message, fullErrorMessage); status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, exceptionMessage)); LogException(ex, status); return(status); } catch (System.Exception ex) { status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); LogException(ex, status); return(status); } return(new questStatus(Severity.Success)); }
private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.TablesetColumn tablesetColumn) { // Initialize questStatus status = null; try { // Read the record. TablesetColumnId tablesetColumnId = new TablesetColumnId(tablesetColumn.Id); Quest.Services.Dbio.MasterPricing.TablesetColumns _tablesetColumn = null; status = read(dbContext, tablesetColumnId, out _tablesetColumn); if (!questStatusDef.IsSuccess(status)) { return(status); } // Update the record. BufferMgr.TransferBuffer(tablesetColumn, _tablesetColumn); dbContext.SaveChanges(); } catch (DbEntityValidationException ex) { var errorMessages = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage); String fullErrorMessage = string.Join("; ", errorMessages); String exceptionMessage = string.Concat(ex.Message, fullErrorMessage); status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, exceptionMessage)); LogException(ex, status); return(status); } catch (System.Exception ex) { status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}", this.GetType().Name, MethodBase.GetCurrentMethod().Name, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); LogException(ex, status); return(status); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out GroupsListViewModel groupsListViewModel) { // Initialize questStatus status = null; groupsListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.ASM.Group> groupList = null; GroupsMgr groupsMgr = new GroupsMgr(this.UserSession); status = groupsMgr.List(queryOptions, out groupList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort groupList.Sort(delegate(Quest.Functional.ASM.Group i1, Quest.Functional.ASM.Group i2) { return(i1.Name.CompareTo(i2.Name)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. groupsListViewModel = new GroupsListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } groupsListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.ASM.Group group in groupList) { GroupLineItemViewModel groupLineItemViewModel = new GroupLineItemViewModel(); BufferMgr.TransferBuffer(group, groupLineItemViewModel); groupsListViewModel.Items.Add(groupLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out GroupsListViewModel groupsListViewModel) { // Initialize questStatus status = null; groupsListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.ASM.Group> groupList = null; GroupsMgr groupsMgr = new GroupsMgr(this.UserSession); status = groupsMgr.List(queryOptions, out groupList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. groupsListViewModel = new GroupsListViewModel(this.UserSession); foreach (Quest.Functional.ASM.Group group in groupList) { GroupLineItemViewModel groupLineItemViewModel = new GroupLineItemViewModel(); BufferMgr.TransferBuffer(group, groupLineItemViewModel); groupsListViewModel.Items.Add(groupLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out PortalRequestsListViewModel portalRequestsListViewModel) { // Initialize questStatus status = null; portalRequestsListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.Logging.PortalRequestLog> portalRequestLogList = null; PortalRequestLogsMgr portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession); status = portalRequestLogsMgr.List(queryOptions, out portalRequestLogList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort portalRequestLogList.Sort(delegate(Quest.Functional.Logging.PortalRequestLog i1, Quest.Functional.Logging.PortalRequestLog i2) { return(i2.Created.CompareTo(i1.Created)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. portalRequestsListViewModel = new PortalRequestsListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } portalRequestsListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.Logging.PortalRequestLog portalRequestLog in portalRequestLogList) { PortalRequestLineItemViewModel portalRequestLineItemViewModel = new PortalRequestLineItemViewModel(); BufferMgr.TransferBuffer(portalRequestLog, portalRequestLineItemViewModel); portalRequestsListViewModel.Items.Add(portalRequestLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out PrivilegesListViewModel privilegesListViewModel) { // Initialize questStatus status = null; privilegesListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.ASM.Privilege> privilegeList = null; PrivilegesMgr privilegesMgr = new PrivilegesMgr(this.UserSession); status = privilegesMgr.List(queryOptions, out privilegeList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort privilegeList.Sort(delegate(Quest.Functional.ASM.Privilege i1, Quest.Functional.ASM.Privilege i2) { return(i1.Name.CompareTo(i2.Name)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. privilegesListViewModel = new PrivilegesListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } privilegesListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.ASM.Privilege privilege in privilegeList) { PrivilegeLineItemViewModel privilegeLineItemViewModel = new PrivilegeLineItemViewModel(); BufferMgr.TransferBuffer(privilege, privilegeLineItemViewModel); privilegesListViewModel.Items.Add(privilegeLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out PrivilegesListViewModel privilegesListViewModel) { // Initialize questStatus status = null; privilegesListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.ASM.Privilege> privilegeList = null; PrivilegesMgr privilegesMgr = new PrivilegesMgr(this.UserSession); status = privilegesMgr.List(queryOptions, out privilegeList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. privilegesListViewModel = new PrivilegesListViewModel(this.UserSession); foreach (Quest.Functional.ASM.Privilege privilege in privilegeList) { PrivilegeLineItemViewModel privilegeLineItemViewModel = new PrivilegeLineItemViewModel(); BufferMgr.TransferBuffer(privilege, privilegeLineItemViewModel); privilegesListViewModel.Items.Add(privilegeLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out UsersListViewModel usersListViewModel) { // Initialize questStatus status = null; usersListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.ASM.User> userList = null; UsersMgr usersMgr = new UsersMgr(this.UserSession); status = usersMgr.List(queryOptions, out userList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort userList.Sort(delegate(Quest.Functional.ASM.User i1, Quest.Functional.ASM.User i2) { return(i1.LastName.CompareTo(i2.LastName)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. usersListViewModel = new UsersListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } usersListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.ASM.User user in userList) { UserLineItemViewModel userLineItemViewModel = new UserLineItemViewModel(); BufferMgr.TransferBuffer(user, userLineItemViewModel); usersListViewModel.Items.Add(userLineItemViewModel); } return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus DoBulkInsert(BulkInsertViewModel bulkInsertViewModel) { // Initialize questStatus status = null; // Build bulk insert request BulkInsertRequest bulkInsertRequest = new BulkInsertRequest(); BufferMgr.TransferBuffer(bulkInsertViewModel, bulkInsertRequest, true); bulkInsertRequest.TablesetId = bulkInsertViewModel.TablesetId; foreach (BulkInsertRowDataViewModel RowData in bulkInsertViewModel.Rows) { BulkInsertRow bulkInsertRow = new BulkInsertRow(); foreach (NameValueViewModel nameValueViewModel in RowData.Columns) { BulkInsertColumnValue bulkInsertColumnValue = new BulkInsertColumnValue(); bulkInsertColumnValue.Name = nameValueViewModel.ColumnName; if ((string.IsNullOrWhiteSpace(nameValueViewModel.ColumnValue)) && (nameValueViewModel.ColumnValue != null)) { bulkInsertColumnValue.Value = nameValueViewModel.ColumnValue.Trim(); } else { bulkInsertColumnValue.Value = nameValueViewModel.ColumnValue; } bulkInsertRow.Columns.Add(bulkInsertColumnValue); } bulkInsertRequest.Rows.Add(bulkInsertRow); } // Perform bulk insert. BulkInsertMgr bulkInsertMgr = new BulkInsertMgr(this.UserSession); status = bulkInsertMgr.PerformBulkInsert(bulkInsertRequest); if (!questStatusDef.IsSuccess(status)) { return(status); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out TypeListsListViewModel typeListsListViewModel) { // Initialize questStatus status = null; typeListsListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.MasterPricing.TypeList> typeListList = null; TypeListsMgr typeListsMgr = new TypeListsMgr(this.UserSession); status = typeListsMgr.List(queryOptions, out typeListList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort typeListList.Sort(delegate(Quest.Functional.MasterPricing.TypeList i1, Quest.Functional.MasterPricing.TypeList i2) { return(i1.Name.CompareTo(i2.Name)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. typeListsListViewModel = new TypeListsListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } typeListsListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.MasterPricing.TypeList typeList in typeListList) { TypeListLineItemViewModel typeListLineItemViewModel = new TypeListLineItemViewModel(); BufferMgr.TransferBuffer(typeList, typeListLineItemViewModel); typeListsListViewModel.Items.Add(typeListLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out LookupsListViewModel lookupsListViewModel) { // Initialize questStatus status = null; lookupsListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.MasterPricing.Lookup> lookupList = null; LookupsMgr lookupsMgr = new LookupsMgr(this.UserSession); status = lookupsMgr.List(queryOptions, out lookupList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort lookupList.Sort(delegate(Quest.Functional.MasterPricing.Lookup i1, Quest.Functional.MasterPricing.Lookup i2) { return(i1.Name.CompareTo(i2.Name)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. lookupsListViewModel = new LookupsListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } lookupsListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.MasterPricing.Lookup lookup in lookupList) { LookupLineItemViewModel lookupLineItemViewModel = new LookupLineItemViewModel(); BufferMgr.TransferBuffer(lookup, lookupLineItemViewModel); lookupsListViewModel.Items.Add(lookupLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out FiltersListViewModel filtersListViewModel) { // Initialize questStatus status = null; filtersListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.Logging.FilterLog> filterLogList = null; FilterLogsMgr filterLogsMgr = new FilterLogsMgr(this.UserSession); status = filterLogsMgr.List(queryOptions, out filterLogList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. filtersListViewModel = new FiltersListViewModel(this.UserSession); foreach (Quest.Functional.Logging.FilterLog filterLog in filterLogList) { FilterLineItemViewModel filterLineItemViewModel = new FilterLineItemViewModel(); BufferMgr.TransferBuffer(filterLog, filterLineItemViewModel); filtersListViewModel.Items.Add(filterLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out SessionsListViewModel sessionsListViewModel) { // Initialize questStatus status = null; sessionsListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.ASM.UserSession> userSessionList = null; UserSessionMgr userSessionMgr = new UserSessionMgr(this.UserSession); status = userSessionMgr.List(queryOptions, out userSessionList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. sessionsListViewModel = new SessionsListViewModel(this.UserSession); foreach (Quest.Functional.ASM.UserSession user in userSessionList) { SessionLineItemViewModel sessionLineItemViewModel = new SessionLineItemViewModel(); BufferMgr.TransferBuffer(user, sessionLineItemViewModel); sessionsListViewModel.Items.Add(sessionLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out LookupsListViewModel lookupsListViewModel) { // Initialize questStatus status = null; lookupsListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.MasterPricing.Lookup> lookupList = null; LookupsMgr lookupsMgr = new LookupsMgr(this.UserSession); status = lookupsMgr.List(queryOptions, out lookupList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. lookupsListViewModel = new LookupsListViewModel(this.UserSession); foreach (Quest.Functional.MasterPricing.Lookup lookup in lookupList) { LookupLineItemViewModel lookupLineItemViewModel = new LookupLineItemViewModel(); BufferMgr.TransferBuffer(lookup, lookupLineItemViewModel); lookupsListViewModel.Items.Add(lookupLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus Page(out TablesListViewModel tablesListViewModel) { // Initialize questStatus status = null; tablesListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.MasterPricing.Table> tableList = null; TablesMgr tablesMgr = new TablesMgr(this.UserSession); status = tablesMgr.List(queryOptions, out tableList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. tablesListViewModel = new TablesListViewModel(this.UserSession); foreach (Quest.Functional.MasterPricing.Table table in tableList) { TableLineItemViewModel tableLineItemViewModel = new TableLineItemViewModel(); BufferMgr.TransferBuffer(table, tableLineItemViewModel); tablesListViewModel.Items.Add(tableLineItemViewModel); } return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Public Methods *=================================================================================================================================*/ #region CRUD //---------------------------------------------------------------------------------------------------------------------------------- // CRUD //---------------------------------------------------------------------------------------------------------------------------------- public questStatus Save(DatabaseEditorViewModel databaseEditorViewModel) { // Initialize questStatus status = null; // Transfer model Quest.Functional.MasterPricing.Database database = new Quest.Functional.MasterPricing.Database(); BufferMgr.TransferBuffer(databaseEditorViewModel, database); // Determine if this is a create or update DatabaseMgr databaseMgr = new DatabaseMgr(this.UserSession); if (databaseEditorViewModel.Id < BaseId.VALID_ID) { // Create DatabaseId databaseId = null; status = databaseMgr.Create(database, out databaseId); if (!questStatusDef.IsSuccess(status)) { if (databaseId != null && databaseId.Id >= BaseId.VALID_ID) { databaseEditorViewModel.Id = databaseId.Id; } FormatErrorMessage(status, databaseEditorViewModel); return(status); } databaseEditorViewModel.Id = databaseId.Id; } else { // Update status = databaseMgr.Update(database); if (!questStatusDef.IsSuccess(status)) { FormatErrorMessage(status, databaseEditorViewModel); return(status); } } return(new questStatus(Severity.Success)); }
public questStatus Page(out ViewsListViewModel viewsListViewModel) { // Initialize questStatus status = null; viewsListViewModel = null; // Set up query options. // TEMPORARY: OPTIMIZE THIS List <SearchField> searchFieldList = new List <SearchField>(); SearchOptions searchOptions = new SearchOptions(); searchOptions.SearchFieldList = searchFieldList; QueryOptions queryOptions = new QueryOptions(100, 1); queryOptions.SearchOptions = searchOptions; QueryResponse queryResponse = null; // List List <Quest.Functional.MasterPricing.Database> databaseList = null; DatabasesMgr databasesMgr = new DatabasesMgr(this.UserSession); status = databasesMgr.List(queryOptions, out databaseList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Transfer model. viewsListViewModel = new ViewsListViewModel(this.UserSession); foreach (Quest.Functional.MasterPricing.Database database in databaseList) { ViewLineItemViewModel viewLineItemViewModel = new ViewLineItemViewModel(); BufferMgr.TransferBuffer(database, viewLineItemViewModel); viewsListViewModel.Items.Add(viewLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out FiltersListViewModel filtersListViewModel) { // Initialize questStatus status = null; filtersListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.Logging.FilterLog> filterLogList = null; FilterLogsMgr filterLogsMgr = new FilterLogsMgr(this.UserSession); status = filterLogsMgr.List(queryOptions, out filterLogList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort filterLogList.Sort(delegate(Quest.Functional.Logging.FilterLog i1, Quest.Functional.Logging.FilterLog i2) { return(i2.Created.CompareTo(i1.Created)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. filtersListViewModel = new FiltersListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } filtersListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.Logging.FilterLog filterLog in filterLogList) { FilterLineItemViewModel filterLineItemViewModel = new FilterLineItemViewModel(); BufferMgr.TransferBuffer(filterLog, filterLineItemViewModel); filtersListViewModel.Items.Add(filterLineItemViewModel); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out BulkUpdatesListViewModel bulkUpdatesListViewModel) { // Initialize questStatus status = null; bulkUpdatesListViewModel = null; // List QueryResponse queryResponse = null; List <Quest.Functional.Logging.BulkUpdateLog> bulkUpdateLogList = null; BulkUpdateLogsMgr bulkUpdateLogsMgr = new BulkUpdateLogsMgr(this.UserSession); status = bulkUpdateLogsMgr.List(queryOptions, out bulkUpdateLogList, out queryResponse); if (!questStatusDef.IsSuccess(status)) { return(status); } // Sort bulkUpdateLogList.Sort(delegate(Quest.Functional.Logging.BulkUpdateLog i1, Quest.Functional.Logging.BulkUpdateLog i2) { return(i2.Created.CompareTo(i1.Created)); }); // Transfer model. // TODO: USE BaseListModeler to xfer queryOptions to QueryOptionsViewModel. bulkUpdatesListViewModel = new BulkUpdatesListViewModel(this.UserSession); QueryResponseViewModel queryResponseViewModel = null; status = TransferQueryResponse(queryResponse, out queryResponseViewModel); if (!questStatusDef.IsSuccess(status)) { return(status); } bulkUpdatesListViewModel.QueryResponse = queryResponseViewModel; foreach (Quest.Functional.Logging.BulkUpdateLog bulkUpdateLog in bulkUpdateLogList) { BulkUpdateLineItemViewModel bulkUpdateLineItemViewModel = new BulkUpdateLineItemViewModel(); BufferMgr.TransferBuffer(bulkUpdateLog, bulkUpdateLineItemViewModel); bulkUpdatesListViewModel.Items.Add(bulkUpdateLineItemViewModel); } return(new questStatus(Severity.Success)); }