public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.Table> tableList, out QueryResponse queryResponse) { // Initialize questStatus status = null; tableList = null; queryResponse = null; using (MasterPricingEntities dbContext = new MasterPricingEntities()) { using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted)) { try { PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.Tables).GetProperties().ToArray(); int totalRecords = dbContext.Tables.Where(BuildWhereClause(queryOptions, dbProperties)).Count(); List <Quest.Services.Dbio.MasterPricing.Tables> _countriesList = dbContext.Tables.Where(BuildWhereClause(queryOptions, dbProperties)) .OrderBy(BuildSortString(queryOptions.SortColumns)) .Skip(queryOptions.Paging.PageSize * (queryOptions.Paging.PageNumber - 1)) .Take(queryOptions.Paging.PageSize).ToList(); if (_countriesList == null) { return(new questStatus(Severity.Warning)); } tableList = new List <Quest.Functional.MasterPricing.Table>(); foreach (Quest.Services.Dbio.MasterPricing.Tables _table in _countriesList) { Quest.Functional.MasterPricing.Table table = new Quest.Functional.MasterPricing.Table(); BufferMgr.TransferBuffer(_table, table); tableList.Add(table); } 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)); }
public questStatus Update(DbMgrTransaction trans, Quest.Functional.MasterPricing.Table table) { // Initialize questStatus status = null; bool bCreateTransaction = trans == null; // Perform update in this transaction. status = update((MasterPricingEntities)trans.DbContext, table); if (!questStatusDef.IsSuccess(status)) { RollbackTransaction(trans); return(status); } return(new questStatus(Severity.Success)); }
public questStatus Update(Quest.Functional.MasterPricing.Table table) { // Initialize questStatus status = null; // Perform update. using (MasterPricingEntities dbContext = new MasterPricingEntities()) { status = update(dbContext, table); if (!questStatusDef.IsSuccess(status)) { return(status); } } return(new questStatus(Severity.Success)); }
private questStatus readTable(TableId tableId, out Quest.Functional.MasterPricing.Table table) { // Initialize questStatus status = null; table = null; // Read the table. DbTablesMgr dbTablesMgr = new DbTablesMgr(this._userSession); status = dbTablesMgr.Read(tableId, out table); if (!questStatusDef.IsSuccess(status)) { return(status); } return(new questStatus(Severity.Success)); }
public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.Table table, out TableId tableId) { // Initialize questStatus status = null; tableId = null; // Data rules. // Create the table in this transaction. status = create((MasterPricingEntities)trans.DbContext, table, out tableId); if (!questStatusDef.IsSuccess(status)) { return(status); } return(new questStatus(Severity.Success)); }
/*---------------------------------------------------------------------------------------------------------------------------------- * Tables *---------------------------------------------------------------------------------------------------------------------------------*/ private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.Table table, out TableId tableId) { // Initialize questStatus status = null; tableId = null; // Perform create try { Quest.Services.Dbio.MasterPricing.Tables _table = new Quest.Services.Dbio.MasterPricing.Tables(); BufferMgr.TransferBuffer(table, _table); dbContext.Tables.Add(_table); dbContext.SaveChanges(); if (_table.Id == 0) { return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.Table not created")); } tableId = new TableId(_table.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)); }
public questStatus Read(DbMgrTransaction trans, TableId tableId, out Quest.Functional.MasterPricing.Table table) { // Initialize questStatus status = null; table = null; // Perform read. Quest.Services.Dbio.MasterPricing.Tables _table = null; status = read((MasterPricingEntities)trans.DbContext, tableId, out _table); if (!questStatusDef.IsSuccess(status)) { return(status); } table = new Quest.Functional.MasterPricing.Table(); BufferMgr.TransferBuffer(_table, table); return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Properties *=================================================================================================================================*/ #endregion #region Public Methods /*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus Create(Quest.Functional.MasterPricing.Table table, out TableId tableId) { // Initialize questStatus status = null; tableId = null; // Data rules. // Create the table using (MasterPricingEntities dbContext = new MasterPricingEntities()) { status = create(dbContext, table, out tableId); if (!questStatusDef.IsSuccess(status)) { return(status); } } return(new questStatus(Severity.Success)); }
public questStatus Read(DatabaseId databaseId, string schema, string name, out Quest.Functional.MasterPricing.Table table) { // Initialize questStatus status = null; table = null; // Perform read using (MasterPricingEntities dbContext = new MasterPricingEntities()) { Quest.Services.Dbio.MasterPricing.Tables _table = null; status = read(dbContext, databaseId, schema, name, out _table); if (!questStatusDef.IsSuccess(status)) { return(status); } table = new Quest.Functional.MasterPricing.Table(); BufferMgr.TransferBuffer(_table, table); } return(new questStatus(Severity.Success)); }