Exemple #1
0
        public questStatus Read(TablesetId tablesetId, out List <Quest.Functional.MasterPricing.TablesetTable> tablesetTableList)
        {
            // Initialize
            questStatus status = null;

            tablesetTableList = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                List <Quest.Services.Dbio.MasterPricing.TablesetTables> _tablesetTableList = null;
                status = read(dbContext, tablesetId, out _tablesetTableList);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetTableList = new List <TablesetTable>();
                foreach (Quest.Services.Dbio.MasterPricing.TablesetTables _tablesetTable in _tablesetTableList)
                {
                    Quest.Functional.MasterPricing.TablesetTable tablesetTable = new Quest.Functional.MasterPricing.TablesetTable();
                    BufferMgr.TransferBuffer(_tablesetTable, tablesetTable);
                    tablesetTableList.Add(tablesetTable);
                }
            }
            return(new questStatus(Severity.Success));
        }
Exemple #2
0
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.TablesetTable> tablesetTableList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            tablesetTableList = null;
            queryResponse     = null;


            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
                {
                    try
                    {
                        PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.TablesetTables).GetProperties().ToArray();
                        int            totalRecords = dbContext.vwTablesetTablesList2.Where(BuildWhereClause(queryOptions, dbProperties)).Count();
                        List <Quest.Services.Dbio.MasterPricing.vwTablesetTablesList2> _tablesetTablesList = dbContext.vwTablesetTablesList2.Where(BuildWhereClause(queryOptions, dbProperties))
                                                                                                             .OrderBy(BuildSortString(queryOptions.SortColumns))
                                                                                                             .Skip(queryOptions.Paging.PageSize * (queryOptions.Paging.PageNumber - 1))
                                                                                                             .Take(queryOptions.Paging.PageSize).ToList();
                        if (_tablesetTablesList == null)
                        {
                            return(new questStatus(Severity.Warning));
                        }
                        tablesetTableList = new List <Quest.Functional.MasterPricing.TablesetTable>();
                        foreach (Quest.Services.Dbio.MasterPricing.vwTablesetTablesList2 _tablesetTable in _tablesetTablesList)
                        {
                            Quest.Functional.MasterPricing.TablesetTable tablesetTable = new Quest.Functional.MasterPricing.TablesetTable();
                            BufferMgr.TransferBuffer(_tablesetTable, tablesetTable);
                            tablesetTableList.Add(tablesetTable);
                        }
                        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));
        }
Exemple #3
0
        public questStatus Update(DbMgrTransaction trans, Quest.Functional.MasterPricing.TablesetTable tablesetTable)
        {
            // Initialize
            questStatus status             = null;
            bool        bCreateTransaction = trans == null;


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


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, tablesetTable);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Exemple #5
0
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.TablesetTable tablesetTable, out TablesetTableId tablesetTableId)
        {
            // Initialize
            questStatus status = null;

            tablesetTableId = null;


            // Data rules.


            // Create the tablesetTable in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, tablesetTable, out tablesetTableId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Exemple #6
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * TablesetTables
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.TablesetTable tablesetTable, out TablesetTableId tablesetTableId)
        {
            // Initialize
            questStatus status = null;

            tablesetTableId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.TablesetTables _tablesetTable = new Quest.Services.Dbio.MasterPricing.TablesetTables();
                BufferMgr.TransferBuffer(tablesetTable, _tablesetTable);
                dbContext.TablesetTables.Add(_tablesetTable);
                dbContext.SaveChanges();
                if (_tablesetTable.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.TablesetTable not created"));
                }
                tablesetTableId = new TablesetTableId(_tablesetTable.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));
        }
Exemple #7
0
        /*==================================================================================================================================
        * Properties
        *=================================================================================================================================*/
        #endregion


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.TablesetTable tablesetTable, out TablesetTableId tablesetTableId)
        {
            // Initialize
            questStatus status = null;

            tablesetTableId = null;


            // Data rules.


            // Create the tablesetTable
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, tablesetTable, out tablesetTableId);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Exemple #8
0
        public questStatus Read(DbMgrTransaction trans, FilterTableTablesetTableId filterTableTablesetTableId, out Quest.Functional.MasterPricing.TablesetTable tablesetTable)
        {
            // Initialize
            questStatus status = null;

            tablesetTable = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.TablesetTables _tablesetTable = null;
                status = read((MasterPricingEntities)trans.DbContext, filterTableTablesetTableId, out _tablesetTable);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetTable = new Quest.Functional.MasterPricing.TablesetTable();
                BufferMgr.TransferBuffer(_tablesetTable, tablesetTable);
            }
            return(new questStatus(Severity.Success));
        }
Exemple #9
0
 public FilterTable()
 {
     TablesetTable    = new TablesetTable();
     FilterColumnList = new List <FilterColumn>();
 }