Beispiel #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));
        }
Beispiel #2
0
        public questStatus Read(ViewId viewId, out List <Quest.Functional.MasterPricing.Column> columnList)
        {
            // Initialize
            questStatus status = null;

            columnList = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.Columns> _columnsList = null;
                status = read(dbContext, viewId, out _columnsList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                columnList = new List <Column>();
                foreach (Quest.Services.Dbio.MasterPricing.Columns _column in _columnsList)
                {
                    Quest.Functional.MasterPricing.Column column = new Quest.Functional.MasterPricing.Column();
                    BufferMgr.TransferBuffer(_column, column);
                    columnList.Add(column);
                }
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.Database database, out Quest.Functional.MasterPricing.DatabaseId databaseId)
        {
            // Initialize
            questStatus status = null;

            databaseId = null;


            // Data rules.


            // Create the database
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, database, out databaseId);
                if (bLogging)
                {
                    DatabaseLog databaseLog = new DatabaseLog();
                    databaseLog.Name  = database.Name == null ? "(null)" : database.Name;
                    databaseLog.Event = "CREATE";
                    databaseLog.Data  = status.ToString();
                    DatabaseLogId databaseLogId = null;
                    _dbDatabaseLogsMgr.Create(databaseLog, out databaseLogId);
                }
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
        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);
        }
Beispiel #5
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));
        }
Beispiel #6
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));
        }
Beispiel #7
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));
        }
Beispiel #8
0
        private questStatus read(MasterPricingEntities dbContext, FilterColumnTablesetColumnId filterColumnTablesetColumnId, out Quest.Services.Dbio.MasterPricing.TablesetColumns tablesetColumn)
        {
            // Initialize
            questStatus status = null;

            tablesetColumn = null;


            try
            {
                tablesetColumn = dbContext.TablesetColumns.Where(r => r.EntityTypeId == filterColumnTablesetColumnId.EntityTypeId.Id &&
                                                                 r.TableSetEntityId == filterColumnTablesetColumnId.EntityId.Id &&
                                                                 r.Name == filterColumnTablesetColumnId.Name).SingleOrDefault();
                if (tablesetColumn == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("FilterColumnTablesetColumnId EntityTypeId: {0}  EntityId: {1}  Name: {2} not found",
                                                                                       filterColumnTablesetColumnId.EntityTypeId.Id, filterColumnTablesetColumnId.EntityId.Id, filterColumnTablesetColumnId.Name))));
                }
            }
            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));
        }
Beispiel #9
0
        private questStatus read(MasterPricingEntities dbContext, EntityType entityType, TableSetEntityId tableSetEntityId, out List <Quest.Services.Dbio.MasterPricing.TablesetColumns> tablesetColumnList)
        {
            // Initialize
            questStatus status = null;

            tablesetColumnList = null;


            try
            {
                tablesetColumnList = dbContext.TablesetColumns.Where(r => r.EntityTypeId == entityType.Id && r.TableSetEntityId == tableSetEntityId.Id).ToList();
                if (tablesetColumnList == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("TablesetColumn for EntityType {0} TableSetEntityId {1} not found", entityType.Id, tableSetEntityId.Id))));
                }
            }
            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));
        }
Beispiel #10
0
        public questStatus Read(DatabaseId databaseId, out List <Quest.Functional.MasterPricing.View> viewList)
        {
            // Initialize
            questStatus status = null;

            viewList = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.Views> _viewList = null;
                status = read(dbContext, databaseId, out _viewList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                viewList = new List <View>();
                foreach (Quest.Services.Dbio.MasterPricing.Views _view in _viewList)
                {
                    Quest.Functional.MasterPricing.View view = new View();
                    BufferMgr.TransferBuffer(_view, view);
                    viewList.Add(view);
                }
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #11
0
        public questStatus Read(EntityType entityType, TableSetEntityId tableSetEntityId, out List <Quest.Functional.MasterPricing.TablesetColumn> tablesetColumnList)
        {
            // Initialize
            questStatus status = null;

            tablesetColumnList = null;


            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.TablesetColumns> _tablesetColumnList = null;
                status = read(dbContext, entityType, tableSetEntityId, out _tablesetColumnList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetColumnList = new List <TablesetColumn>();
                foreach (Quest.Services.Dbio.MasterPricing.TablesetColumns _tablesetColumn in _tablesetColumnList)
                {
                    Quest.Functional.MasterPricing.TablesetColumn tablesetColumn = new TablesetColumn();
                    BufferMgr.TransferBuffer(_tablesetColumn, tablesetColumn);
                    tablesetColumnList.Add(tablesetColumn);
                }
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Delete(TablesetId tablesetId)
        {
            // Initialize
            questStatus status = null;


            // Perform delete.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = delete(dbContext, tablesetId);
                if (bLogging)
                {
                    FilterLog filterLog = new FilterLog();
                    filterLog.Database = "";
                    filterLog.Tableset = "";
                    filterLog.Name     = "Tableset.Id=" + tablesetId.Id.ToString();
                    filterLog.Event    = "DELETE";
                    filterLog.Data     = status.ToString();
                    FilterLogId filterLogId = null;
                    _dbFilterLogsMgr.Create(filterLog, out filterLogId);
                }
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.Filter filter, out FilterId filterId)
        {
            // Initialize
            questStatus status = null;

            filterId = null;


            // Data rules.


            // Create the filter
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, filter, out filterId);
                if (bLogging)
                {
                    FilterLog filterLog = new FilterLog();
                    filterLog.Database = "";
                    filterLog.Tableset = "Tableset.Id=" + filter.TablesetId.ToString();
                    filterLog.Name     = filter.Name == null ? "(null)" : filter.Name;
                    filterLog.Event    = "CREATE";
                    filterLog.Data     = status.ToString();
                    FilterLogId filterLogId = null;
                    _dbFilterLogsMgr.Create(filterLog, out filterLogId);
                }
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #14
0
        private questStatus read(MasterPricingEntities dbContext, FilterTableNameIdentifier filterTableNameIdentifier, out Quest.Services.Dbio.MasterPricing.FilterTables filterTable)
        {
            // Initialize
            filterTable = null;


            try
            {
                filterTable = dbContext.FilterTables.Where(r => r.FilterId == filterTableNameIdentifier.FilterId.Id && r.Schema == filterTableNameIdentifier.Schema && r.Name == filterTableNameIdentifier.Name).SingleOrDefault();
                if (filterTable == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("FilterTableNameIdentifier FilterId:{0}  Schema:{1}  Name:{2}  not found",
                                                                                       filterTableNameIdentifier.FilterId.Id, filterTableNameIdentifier.Schema, filterTableNameIdentifier.Name))));
                }
            }
            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));
        }
Beispiel #15
0
        public questStatus Read(DatabaseId databaseId, out List <Quest.Functional.MasterPricing.Table> tableList)
        {
            // Initialize
            questStatus status = null;

            tableList = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.Tables> _tableList = null;
                status = read(dbContext, databaseId, out _tableList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tableList = new List <Table>();
                foreach (Quest.Services.Dbio.MasterPricing.Tables _table in _tableList)
                {
                    Quest.Functional.MasterPricing.Table table = new Table();
                    BufferMgr.TransferBuffer(_table, table);
                    tableList.Add(table);
                }
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #16
0
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.Tableset tableset, out TablesetId tablesetId)
        {
            // Initialize
            questStatus status = null;

            tablesetId = null;


            // Data rules.


            // Create the tableset
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, tableset, out tablesetId);
                if (bLogging)
                {
                    TablesetLog tablesetLog = new TablesetLog();
                    tablesetLog.Database = "Database.Id=" + tableset.DatabaseId.ToString();
                    tablesetLog.Name     = tableset.Name == null ? "(null)" : tableset.Name;
                    tablesetLog.Event    = "CREATE";
                    tablesetLog.Data     = status.ToString();
                    TablesetLogId tablesetLogId = null;
                    _dbTablesetLogsMgr.Create(tablesetLog, out tablesetLogId);
                }
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #17
0
        private questStatus read(MasterPricingEntities dbContext, FolderId folderId, out List <Quest.Services.Dbio.MasterPricing.FilterFolders> filterFolderList)
        {
            // Initialize
            filterFolderList = null;


            try
            {
                if (folderId == null || folderId.Id < BaseId.VALID_ID)
                {
                    filterFolderList = dbContext.FilterFolders.Where(r => r.FolderId == null).ToList();
                }
                else
                {
                    filterFolderList = dbContext.FilterFolders.Where(r => r.FolderId == folderId.Id).ToList();
                }

                if (filterFolderList == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("FolderId {0} not found", folderId.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));
        }
Beispiel #18
0
        private questStatus read(MasterPricingEntities dbContext, TablesetId tablesetId, out Quest.Services.Dbio.MasterPricing.Tablesets tableset)
        {
            // Initialize
            questStatus status = null;

            tableset = null;


            try
            {
                tableset = dbContext.Tablesets.Where(r => r.Id == tablesetId.Id).SingleOrDefault();
                if (tableset == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("Id {0} not found", tablesetId.Id))));
                }
            }
            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));
        }
Beispiel #19
0
        public questStatus Update(Quest.Functional.MasterPricing.Tableset tableset)
        {
            // Initialize
            questStatus status = null;


            // If the database was changed, delete the tablset configuration and any filters based on the tableset
            questStatus status2 = RemoveTablesetInfoIFDbChanged(tableset);

            if (!questStatusDef.IsSuccess(status2))
            {
                return(status2);
            }

            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, tableset);
                if (bLogging)
                {
                    TablesetLog tablesetLog = new TablesetLog();
                    tablesetLog.Database = "Database.Id=" + tableset.DatabaseId.ToString();
                    tablesetLog.Name     = tableset.Name == null ? "(null)" : tableset.Name;
                    tablesetLog.Event    = "UPDATE";
                    tablesetLog.Data     = status.ToString();
                    TablesetLogId tablesetLogId = null;
                    _dbTablesetLogsMgr.Create(tablesetLog, out tablesetLogId);
                }
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(status2);
        }
Beispiel #20
0
        private questStatus read(MasterPricingEntities dbContext, DatabaseId databaseId, out List <Quest.Services.Dbio.MasterPricing.Views> viewsList)
        {
            // Initialize
            questStatus status = null;

            viewsList = null;


            try
            {
                viewsList = dbContext.Views.Where(r => r.DatabaseId == databaseId.Id).ToList();
                if (viewsList == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("DatabaseId {0} not found", databaseId.Id))));
                }
            }
            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 read(MasterPricingEntities dbContext, string name, out Quest.Services.Dbio.MasterPricing.Lookups lookup)
        {
            // Initialize
            questStatus status = null;

            lookup = null;


            try
            {
                lookup = dbContext.Lookups.Where(r => r.Name == name).SingleOrDefault();
                if (lookup == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("Name {0} not found", name))));
                }
            }
            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));
        }
Beispiel #22
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));
        }
        public questStatus Read(FolderId folderId, out List <Quest.Functional.MasterPricing.Filter> filterList)
        {
            // Initialize
            questStatus status = null;

            filterList = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.Filters> _filtersList = null;
                status = read(dbContext, folderId, out _filtersList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterList = new List <Filter>();
                foreach (Quest.Services.Dbio.MasterPricing.Filters _filter in _filtersList)
                {
                    Quest.Functional.MasterPricing.Filter filter = new Quest.Functional.MasterPricing.Filter();
                    BufferMgr.TransferBuffer(_filter, filter);
                    filterList.Add(filter);
                }
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #24
0
        public questStatus Read(StoredProcedureId storedProcedureId, out List <Quest.Functional.MasterPricing.StoredProcedureParameter> storedProcedureParameterList)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterList = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.StoredProcedureParameters> _storedProcedureParametersList = null;
                status = read(dbContext, storedProcedureId, out _storedProcedureParametersList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                storedProcedureParameterList = new List <StoredProcedureParameter>();
                foreach (Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameter in _storedProcedureParametersList)
                {
                    Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter = new Quest.Functional.MasterPricing.StoredProcedureParameter();
                    BufferMgr.TransferBuffer(_storedProcedureParameter, storedProcedureParameter);
                    storedProcedureParameterList.Add(storedProcedureParameter);
                }
            }
            return(new questStatus(Severity.Success));
        }
        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));
        }
Beispiel #26
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));
        }
Beispiel #27
0
        private questStatus read(MasterPricingEntities dbContext, DatabaseId databaseId, string schema, string name, out Quest.Services.Dbio.MasterPricing.Tables table)
        {
            // Initialize
            questStatus status = null;

            table = null;


            try
            {
                table = dbContext.Tables.Where(r => r.DatabaseId == databaseId.Id && r.Schema == schema && r.Name == name).SingleOrDefault();
                if (table == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("Schema {0} Name {1} not found", schema, name))));
                }
            }
            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 Methods
        *=================================================================================================================================*/


        #region Filters
        //
        // Filters
        //
        public questStatus DeleteFilter(FilterId filterId)
        {
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                int numRows = dbContext.DeleteFilterById(filterId.Id);
                if (numRows < 1)
                {
                    return(new questStatus(Severity.Error, String.Format("Filter {0} was not deleted", filterId.Id)));
                }
            }
            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));
        }
Beispiel #30
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));
        }