public questStatus Read(DbMgrTransaction trans, DatabaseId databaseId, out List <Quest.Functional.MasterPricing.StoredProcedure> storedProcedureList) { // Initialize questStatus status = null; storedProcedureList = null; // Perform read List <Quest.Services.Dbio.MasterPricing.StoredProcedures> _storedProceduresList = null; status = read((MasterPricingEntities)trans.DbContext, databaseId, out _storedProceduresList); if (!questStatusDef.IsSuccess(status)) { return(status); } storedProcedureList = new List <StoredProcedure>(); foreach (Quest.Services.Dbio.MasterPricing.StoredProcedures _storedProcedure in _storedProceduresList) { Quest.Functional.MasterPricing.StoredProcedure storedProcedure = new Quest.Functional.MasterPricing.StoredProcedure(); BufferMgr.TransferBuffer(_storedProcedure, storedProcedure); storedProcedureList.Add(storedProcedure); } return(new questStatus(Severity.Success)); }
public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.StoredProcedure> storedProcedureList, out QueryResponse queryResponse) { // Initialize questStatus status = null; storedProcedureList = null; queryResponse = null; using (MasterPricingEntities dbContext = new MasterPricingEntities()) { using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted)) { try { PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.StoredProcedures).GetProperties().ToArray(); int totalRecords = dbContext.StoredProcedures.Where(BuildWhereClause(queryOptions, dbProperties)).Count(); List <Quest.Services.Dbio.MasterPricing.StoredProcedures> _countriesList = dbContext.StoredProcedures.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)); } storedProcedureList = new List <Quest.Functional.MasterPricing.StoredProcedure>(); foreach (Quest.Services.Dbio.MasterPricing.StoredProcedures _storedProcedures in _countriesList) { Quest.Functional.MasterPricing.StoredProcedure storedProcedure = new Quest.Functional.MasterPricing.StoredProcedure(); BufferMgr.TransferBuffer(_storedProcedures, storedProcedure); storedProcedureList.Add(storedProcedure); } 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.StoredProcedure storedProcedure) { // Initialize questStatus status = null; bool bCreateTransaction = trans == null; // Perform update in this transaction. status = update((MasterPricingEntities)trans.DbContext, storedProcedure); if (!questStatusDef.IsSuccess(status)) { RollbackTransaction(trans); return(status); } return(new questStatus(Severity.Success)); }
public questStatus Update(Quest.Functional.MasterPricing.StoredProcedure storedProcedure) { // Initialize questStatus status = null; // Perform update. using (MasterPricingEntities dbContext = new MasterPricingEntities()) { status = update(dbContext, storedProcedure); if (!questStatusDef.IsSuccess(status)) { return(status); } } return(new questStatus(Severity.Success)); }
public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.StoredProcedure storedProcedure, out StoredProcedureId storedProcedureId) { // Initialize questStatus status = null; storedProcedureId = null; // Data rules. // Create the storedProcedure in this transaction. status = create((MasterPricingEntities)trans.DbContext, storedProcedure, out storedProcedureId); if (!questStatusDef.IsSuccess(status)) { return(status); } return(new questStatus(Severity.Success)); }
/*---------------------------------------------------------------------------------------------------------------------------------- * StoredProcedures *---------------------------------------------------------------------------------------------------------------------------------*/ private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.StoredProcedure storedProcedure, out StoredProcedureId storedProcedureId) { // Initialize questStatus status = null; storedProcedureId = null; // Perform create try { Quest.Services.Dbio.MasterPricing.StoredProcedures _storedProcedures = new Quest.Services.Dbio.MasterPricing.StoredProcedures(); BufferMgr.TransferBuffer(storedProcedure, _storedProcedures); dbContext.StoredProcedures.Add(_storedProcedures); dbContext.SaveChanges(); if (_storedProcedures.Id == 0) { return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.StoredProcedure not created")); } storedProcedureId = new StoredProcedureId(_storedProcedures.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, StoredProcedureId storedProcedureId, out Quest.Functional.MasterPricing.StoredProcedure storedProcedure) { // Initialize questStatus status = null; storedProcedure = null; // Perform read Quest.Services.Dbio.MasterPricing.StoredProcedures _storedProcedures = null; status = read((MasterPricingEntities)trans.DbContext, storedProcedureId, out _storedProcedures); if (!questStatusDef.IsSuccess(status)) { return(status); } storedProcedure = new Quest.Functional.MasterPricing.StoredProcedure(); BufferMgr.TransferBuffer(_storedProcedures, storedProcedure); return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Properties *=================================================================================================================================*/ #endregion #region Public Methods /*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus Create(Quest.Functional.MasterPricing.StoredProcedure storedProcedure, out StoredProcedureId storedProcedureId) { // Initialize questStatus status = null; storedProcedureId = null; // Data rules. // Create the storedProcedure using (MasterPricingEntities dbContext = new MasterPricingEntities()) { status = create(dbContext, storedProcedure, out storedProcedureId); if (!questStatusDef.IsSuccess(status)) { return(status); } } return(new questStatus(Severity.Success)); }
public questStatus Read(DatabaseId databaseId, string storedProcedureName, out Quest.Functional.MasterPricing.StoredProcedure storedProcedure) { // Initialize questStatus status = null; storedProcedure = null; // Perform read using (MasterPricingEntities dbContext = new MasterPricingEntities()) { Quest.Services.Dbio.MasterPricing.StoredProcedures _storedProcedure = null; status = read(dbContext, databaseId, storedProcedureName, out _storedProcedure); if (!questStatusDef.IsSuccess(status)) { return(status); } storedProcedure = new StoredProcedure(); BufferMgr.TransferBuffer(_storedProcedure, storedProcedure); } return(new questStatus(Severity.Success)); }
/*================================================================================================================================== * Properties *=================================================================================================================================*/ #endregion #region Public Methods /*================================================================================================================================== * Public Methods *=================================================================================================================================*/ public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.Database database, Quest.Functional.MasterPricing.StoredProcedure storedProcedure, out Quest.Functional.MasterPricing.StoredProcedureId storedProcedureId) { // Initialize questStatus status = null; storedProcedureId = null; // Create storedProcedure status = _dbStoredProceduresMgr.Create(trans, storedProcedure, out storedProcedureId); if (!questStatusDef.IsSuccess(status)) { return(status); } // Store parameters for procedure List <StoredProcedureParameter> storedProcedureParameterList = null; status = GetStoredProdecureParameters(database, storedProcedure.Name, out storedProcedureParameterList); if (!questStatusDef.IsSuccess(status)) { return(status); } StoredProcedureParametersMgr storedProcedureParametersMgr = new StoredProcedureParametersMgr(this.UserSession); foreach (StoredProcedureParameter storedProcedureParameter in storedProcedureParameterList) { storedProcedureParameter.StoredProcedureId = storedProcedureId.Id; StoredProcedureParameterId storedProcedureParameterId = null; status = storedProcedureParametersMgr.Create(trans, database, storedProcedureParameter, out storedProcedureParameterId); if (!questStatusDef.IsSuccess(status)) { return(status); } } return(new questStatus(Severity.Success)); }
public questStatus Read(Quest.Functional.MasterPricing.StoredProcedureId storedProcedureId, out Quest.Functional.MasterPricing.StoredProcedure storedProcedure) { // Initialize questStatus status = null; storedProcedure = null; // Read storedProcedure status = _dbStoredProceduresMgr.Read(storedProcedureId, out storedProcedure); if (!questStatusDef.IsSuccess(status)) { return(status); } return(new questStatus(Severity.Success)); }