예제 #1
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterTable filterTable)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterTableId filterTableId = new FilterTableId(filterTable.Id);
                Quest.Services.Dbio.MasterPricing.FilterTables _filterTables = null;
                status = read(dbContext, filterTableId, out _filterTables);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterTable, _filterTables);
                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));
        }
예제 #2
0
        public questStatus Read(DbMgrTransaction trans, FilterId filterId, out List <Quest.Functional.MasterPricing.FilterTable> filterTableList)
        {
            // Initialize
            questStatus status = null;

            filterTableList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.FilterTables> _filterTablesList = null;

            status = read((MasterPricingEntities)trans.DbContext, filterId, out _filterTablesList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterTableList = new List <FilterTable>();
            foreach (Quest.Services.Dbio.MasterPricing.FilterTables _filterTable in _filterTablesList)
            {
                Quest.Functional.MasterPricing.FilterTable filterTable = new Quest.Functional.MasterPricing.FilterTable();
                BufferMgr.TransferBuffer(_filterTable, filterTable);
                filterTableList.Add(filterTable);
            }
            return(new questStatus(Severity.Success));
        }
예제 #3
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterTables
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterTable filterTable, out FilterTableId filterTableId)
        {
            // Initialize
            filterTableId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterTables _filterTables = new Quest.Services.Dbio.MasterPricing.FilterTables();
                BufferMgr.TransferBuffer(filterTable, _filterTables);
                dbContext.FilterTables.Add(_filterTables);
                dbContext.SaveChanges();
                if (_filterTables.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterTable not created"));
                }
                filterTableId = new FilterTableId(_filterTables.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));
        }
예제 #4
0
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.FilterTable> filterTableList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            filterTableList = null;
            queryResponse   = null;


            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
                {
                    try
                    {
                        PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.FilterTables).GetProperties().ToArray();
                        int            totalRecords = dbContext.FilterTables.Where(BuildWhereClause(queryOptions, dbProperties)).Count();
                        List <Quest.Services.Dbio.MasterPricing.FilterTables> _countriesList = dbContext.FilterTables.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));
                        }
                        filterTableList = new List <Quest.Functional.MasterPricing.FilterTable>();
                        foreach (Quest.Services.Dbio.MasterPricing.FilterTables _filterTables in _countriesList)
                        {
                            Quest.Functional.MasterPricing.FilterTable filterTable = new Quest.Functional.MasterPricing.FilterTable();
                            BufferMgr.TransferBuffer(_filterTables, filterTable);
                            filterTableList.Add(filterTable);
                        }
                        status = BuildQueryResponse(totalRecords, queryOptions, out queryResponse);
                        if (!questStatusDef.IsSuccess(status))
                        {
                            return(status);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        return(new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                             this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                             ex.InnerException != null ? ex.InnerException.Message : ex.Message)));
                    }
                }
            }
            return(new questStatus(Severity.Success));
        }
예제 #5
0
        public questStatus Update(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterTable filterTable)
        {
            // Initialize
            questStatus status             = null;
            bool        bCreateTransaction = trans == null;


            // Perform update in this transaction.
            status = update((MasterPricingEntities)trans.DbContext, filterTable);
            if (!questStatusDef.IsSuccess(status))
            {
                RollbackTransaction(trans);
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
예제 #6
0
        public questStatus Update(Quest.Functional.MasterPricing.FilterTable filterTable)
        {
            // Initialize
            questStatus status = null;


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, filterTable);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
예제 #7
0
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterTable filterTable, out FilterTableId filterTableId)
        {
            // Initialize
            questStatus status = null;

            filterTableId = null;


            // Data rules.


            // Create the filterTable in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, filterTable, out filterTableId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
예제 #8
0
        public questStatus Read(DbMgrTransaction trans, FilterTableId filterTableId, out Quest.Functional.MasterPricing.FilterTable filterTable)
        {
            // Initialize
            questStatus status = null;

            filterTable = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterTables _filterTables = null;
            status = read((MasterPricingEntities)trans.DbContext, filterTableId, out _filterTables);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterTable = new Quest.Functional.MasterPricing.FilterTable();
            BufferMgr.TransferBuffer(_filterTables, filterTable);

            return(new questStatus(Severity.Success));
        }
예제 #9
0
        /*==================================================================================================================================
        * Properties
        *=================================================================================================================================*/
        #endregion


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.FilterTable filterTable, out FilterTableId filterTableId)
        {
            // Initialize
            questStatus status = null;

            filterTableId = null;


            // Data rules.


            // Create the filterTable
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, filterTable, out filterTableId);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
예제 #10
0
        public questStatus Read(FilterTableNameIdentifier filterTableNameIdentifier, out Quest.Functional.MasterPricing.FilterTable filterTable)
        {
            // Initialize
            questStatus status = null;

            filterTable = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.FilterTables _filterTables = null;
                status = read(dbContext, filterTableNameIdentifier, out _filterTables);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterTable = new Quest.Functional.MasterPricing.FilterTable();
                BufferMgr.TransferBuffer(_filterTables, filterTable);
            }
            return(new questStatus(Severity.Success));
        }