Esempio n. 1
0
        private questStatus read(MasterPricingEntities dbContext, FilterTableTablesetTableId filterTableTablesetTableId, out Quest.Services.Dbio.MasterPricing.TablesetTables tablesetTable)
        {
            // Initialize
            questStatus status = null;

            tablesetTable = null;


            try
            {
                tablesetTable = dbContext.TablesetTables.Where(r => r.TablesetId == filterTableTablesetTableId.TablesetId.Id && r.Schema == filterTableTablesetTableId.Schema && r.Name == filterTableTablesetTableId.Name).SingleOrDefault();
                if (tablesetTable == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("FilterTableTablesetTableId.Id {0} Schema {1} Name {2} not found", filterTableTablesetTableId.TablesetId.Id, filterTableTablesetTableId.Schema, filterTableTablesetTableId.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));
        }
Esempio n. 2
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));
        }
Esempio n. 3
0
        public questStatus GetTablesetTable(DatabaseId databaseId, FilterTableTablesetTableId filterTableTablesetTableId, out TablesetTable tablesetTable)
        {
            // Initialize
            questStatus status = null;

            tablesetTable = null;


            // Get tableset table
            DbTablesetTablesMgr dbTablesetTablesMgr = new DbTablesetTablesMgr(this._userSession);

            status = dbTablesetTablesMgr.Read(filterTableTablesetTableId, out tablesetTable);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Get tableset columns
            EntityType entityType = new EntityType();

            entityType.Id = EntityType.Table;
            TableSetEntityId      tableSetEntityId     = new TableSetEntityId(tablesetTable.Id);
            DbTablesetColumnsMgr  dbTablesetColumnsMgr = new DbTablesetColumnsMgr(this._userSession);
            List <TablesetColumn> tablesetColumnList   = null;

            TablesetColumnId tablesetColumnId = new TablesetColumnId();

            status = dbTablesetColumnsMgr.Read(entityType, tableSetEntityId, out tablesetColumnList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            tablesetTable.TablesetColumnList = tablesetColumnList;


            // Get table
            Table table = null;

            status = GetTableInfo(databaseId, tablesetTable, out table);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            tablesetTable.Table = table;


            // Get column info
            DbColumnsMgr dbColumnsMgr = new DbColumnsMgr(this._userSession);
            EntityTypeId entityTypeId = new EntityTypeId(EntityType.Table);
            EntityId     entityId     = new EntityId(table.Id);

            foreach (TablesetColumn tablesetColumn in tablesetColumnList)
            {
                Column column = null;
                status = dbColumnsMgr.Read(entityTypeId, entityId, tablesetColumn.Name, out column);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetColumn.Column = column;
            }
            return(new questStatus(Severity.Success));
        }