Ejemplo n.º 1
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.FilterLogId filterLogId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                Quest.Services.Dbio.MasterPricing.FilterLogs _filterLog = null;
                status = read(dbContext, filterLogId, out _filterLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the record.
                dbContext.FilterLogs.Remove(_filterLog);
                dbContext.SaveChanges();
            }
            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));
        }
Ejemplo n.º 2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * HTTPRequestLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.HTTPRequestLog httpRequestLog, out HTTPRequestLogId httpRequestLogId)
        {
            // Initialize
            httpRequestLogId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.HTTPRequestLogs _httpRequestLog = new Quest.Services.Dbio.MasterPricing.HTTPRequestLogs();
                BufferMgr.TransferBuffer(httpRequestLog, _httpRequestLog);
                dbContext.HTTPRequestLogs.Add(_httpRequestLog);
                dbContext.SaveChanges();
                if (_httpRequestLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.HTTPRequestLog not created"));
                }
                httpRequestLogId = new HTTPRequestLogId(_httpRequestLog.Id);
            }
            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));
        }
Ejemplo n.º 3
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.FilterLog filterLog, out FilterLogId filterLogId)
        {
            // Initialize
            filterLogId = null;


            // Initialize
            filterLog.UserSessionId = this.UserSession.Id;
            filterLog.Username      = this.UserSession.User.Username;
            filterLog.Created       = DateTime.Now;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterLogs _filterLog = new Quest.Services.Dbio.MasterPricing.FilterLogs();
                BufferMgr.TransferBuffer(filterLog, _filterLog);
                dbContext.FilterLogs.Add(_filterLog);
                dbContext.SaveChanges();
                if (_filterLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.FilterLog not created"));
                }
                filterLogId = new FilterLogId(_filterLog.Id);
            }
            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));
        }
Ejemplo n.º 4
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.Logging.LogSetting logSetting)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                LogSettingId logSettingId = new LogSettingId(logSetting.Id);
                Quest.Services.Dbio.MasterPricing.LogSettings _logSetting = null;
                status = read(dbContext, out _logSetting);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(logSetting, _logSetting);
                dbContext.SaveChanges();
            }
            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));
        }
Ejemplo n.º 5
0
        private questStatus create(MasterPricingEntities dbContext, List <Quest.Functional.MasterPricing.Filter> filterList, out List <Quest.Functional.MasterPricing.Filter> filterIdList)
        {
            // Initialize
            filterIdList = null;


            // Perform create
            try
            {
                List <Quest.Services.Dbio.MasterPricing.Filters> _filterList = new List <Quest.Services.Dbio.MasterPricing.Filters>();
                foreach (Quest.Functional.MasterPricing.Filter filter in filterList)
                {
                    Quest.Services.Dbio.MasterPricing.Filters _filter = new Quest.Services.Dbio.MasterPricing.Filters();
                    BufferMgr.TransferBuffer(filter, _filter);
                    _filterList.Add(_filter);
                }
                dbContext.Filters.AddRange(_filterList);
                dbContext.SaveChanges();

                filterIdList = new List <Filter>();
                foreach (Quest.Services.Dbio.MasterPricing.Filters _filter in _filterList)
                {
                    Quest.Functional.MasterPricing.Filter filter = new Filter();
                    filter.Id = _filter.Id;
                    filterIdList.Add(filter);
                }
            }
            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));
        }
Ejemplo n.º 6
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterColumns
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterOperator filterOperator, out FilterOperatorId filterOperatorId)
        {
            // Initialize
            filterOperatorId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterOperators _filterOperators = new Quest.Services.Dbio.MasterPricing.FilterOperators();
                BufferMgr.TransferBuffer(filterOperator, _filterOperators);
                dbContext.FilterOperators.Add(_filterOperators);
                dbContext.SaveChanges();
                if (_filterOperators.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterOperator not created"));
                }
                filterOperatorId = new FilterOperatorId(_filterOperators.Id);
            }
            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));
        }
Ejemplo n.º 7
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.DatabaseId databaseId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                Quest.Services.Dbio.MasterPricing.Databases _database = null;
                status = read(dbContext, databaseId, out _database);
                if (!questStatusDef.IsSuccess(status))
                {
                    if (bLogging)
                    {
                        DatabaseLog databaseLog = new DatabaseLog();
                        databaseLog.Name  = "Database.Id=" + databaseId.Id;
                        databaseLog.Event = "DELETE";
                        databaseLog.Data  = status.ToString();
                        DatabaseLogId databaseLogId = null;
                        _dbDatabaseLogsMgr.Create(databaseLog, out databaseLogId);
                    }
                    return(status);
                }

                // Delete the record.
                dbContext.Databases.Remove(_database);
                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);
            }
            status = new questStatus(Severity.Success, "Database successfully deleted.  Database.Id=" + databaseId.Id);
            if (bLogging)
            {
                DatabaseLog databaseLog = new DatabaseLog();
                databaseLog.Name  = "Database.Id=" + databaseId.Id;
                databaseLog.Event = "DELETE";
                databaseLog.Data  = status.ToString();
                DatabaseLogId databaseLogId = null;
                _dbDatabaseLogsMgr.Create(databaseLog, out databaseLogId);
            }
            return(status);
        }
Ejemplo n.º 8
0
        private questStatus delete(MasterPricingEntities dbContext, ViewId viewId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read all columns for this view.
                List <Quest.Services.Dbio.MasterPricing.Columns> _columnsList = null;
                status = read(dbContext, viewId, out _columnsList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the records.
                dbContext.Columns.RemoveRange(_columnsList);
                dbContext.SaveChanges();
            }
            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));
        }
        private questStatus delete(MasterPricingEntities dbContext, DatabaseId databaseId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read all storedProcedures for this stored.
                List <Quest.Services.Dbio.MasterPricing.StoredProcedures> _storedProceduresList = null;
                status = read(dbContext, databaseId, out _storedProceduresList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete their parameters.
                DbStoredProcedureParametersMgr dbStoredProcedureParametersMgr = new DbStoredProcedureParametersMgr(this.UserSession);
                foreach (Quest.Services.Dbio.MasterPricing.StoredProcedures _storedProcedure in _storedProceduresList)
                {
                    StoredProcedureId storedProcedureId = new StoredProcedureId(_storedProcedure.Id);
                    status = dbStoredProcedureParametersMgr.Delete(storedProcedureId);
                    if (!questStatusDef.IsSuccess(status))
                    {
                        return(status);
                    }
                }

                // Delete the records.
                dbContext.StoredProcedures.RemoveRange(_storedProceduresList);
                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));
        }
Ejemplo n.º 10
0
        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));
        }
Ejemplo n.º 11
0
 private questStatus delete(MasterPricingEntities dbContext, TablesetId tablesetId)
 {
     try
     {
         dbContext.Filters.RemoveRange(dbContext.Filters.Where(r => r.TablesetId == tablesetId.Id));
         dbContext.SaveChanges();
     }
     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));
 }
Ejemplo n.º 12
0
 public questStatus Clear()
 {
     try
     {
         using (MasterPricingEntities dbContext = new MasterPricingEntities())
         {
             dbContext.FilterLogs.RemoveRange(dbContext.FilterLogs.Where(r => r.Id > 0));
             dbContext.SaveChanges();
         }
     }
     catch (System.Exception ex)
     {
         return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: clearing Filters Log {0}", ex.Message)));
     }
     return(new questStatus(Severity.Success));
 }
Ejemplo n.º 13
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * 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));
        }
Ejemplo n.º 14
0
        private questStatus delete(MasterPricingEntities dbContext, LookupId lookupId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                Quest.Services.Dbio.MasterPricing.Lookups _lookup = null;
                status = read(dbContext, lookupId, out _lookup);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the record.
                dbContext.Lookups.Remove(_lookup);
                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);
            }
            status = new questStatus(Severity.Success, "Lookup successfully deleted.  LookupId.Id=" + lookupId.Id);
            return(status);
        }
Ejemplo n.º 15
0
        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));
        }
Ejemplo n.º 16
0
        private questStatus delete(MasterPricingEntities dbContext, EntityType entityType, TableSetEntityId tableSetEntityId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the records.
                List <Quest.Services.Dbio.MasterPricing.TablesetColumns> tablesetColumnList = null;
                status = read(dbContext, entityType, tableSetEntityId, out tablesetColumnList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the records.
                dbContext.TablesetColumns.RemoveRange(tablesetColumnList);
                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));
        }