public questStatus Read(DbMgrTransaction trans, FilterId filterId, out List <Quest.Functional.MasterPricing.FilterColumn> filterColumnList)
        {
            // Initialize
            questStatus status = null;

            filterColumnList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.FilterColumns> _filterColumnsList = null;

            status = read((MasterPricingEntities)trans.DbContext, filterId, out _filterColumnsList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterColumnList = new List <FilterColumn>();
            foreach (Quest.Services.Dbio.MasterPricing.FilterColumns _filterColumn in _filterColumnsList)
            {
                Quest.Functional.MasterPricing.FilterColumn filterColumn = new Quest.Functional.MasterPricing.FilterColumn();
                BufferMgr.TransferBuffer(_filterColumn, filterColumn);
                filterColumnList.Add(filterColumn);
            }
            return(new questStatus(Severity.Success));
        }
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterColumn filterColumn)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterColumnId filterColumnId = new FilterColumnId(filterColumn.Id);
                Quest.Services.Dbio.MasterPricing.FilterColumns _filterColumns = null;
                status = read(dbContext, filterColumnId, out _filterColumns);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterColumn, _filterColumns);
                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));
        }
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterColumns
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterColumn filterColumn, out FilterColumnId filterColumnId)
        {
            // Initialize
            filterColumnId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterColumns _filterColumns = new Quest.Services.Dbio.MasterPricing.FilterColumns();
                BufferMgr.TransferBuffer(filterColumn, _filterColumns);
                dbContext.FilterColumns.Add(_filterColumns);
                dbContext.SaveChanges();
                if (_filterColumns.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterColumn not created"));
                }
                filterColumnId = new FilterColumnId(_filterColumns.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 FilterItem()
 {
     JoinList       = new List <FilterItemJoin>();
     OperationList  = new List <FilterOperation>();
     Lookup         = new Lookup();
     TypeList       = new TypeList();
     TablesetColumn = new TablesetColumn();
     FilterColumn   = new FilterColumn();
 }
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.FilterColumn> filterColumnList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            filterColumnList = null;
            queryResponse    = null;


            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
                {
                    try
                    {
                        PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.FilterColumns).GetProperties().ToArray();
                        int            totalRecords = dbContext.FilterColumns.Where(BuildWhereClause(queryOptions, dbProperties)).Count();
                        List <Quest.Services.Dbio.MasterPricing.FilterColumns> _countriesList = dbContext.FilterColumns.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));
                        }
                        filterColumnList = new List <Quest.Functional.MasterPricing.FilterColumn>();
                        foreach (Quest.Services.Dbio.MasterPricing.FilterColumns _filterColumns in _countriesList)
                        {
                            Quest.Functional.MasterPricing.FilterColumn filterColumn = new Quest.Functional.MasterPricing.FilterColumn();
                            BufferMgr.TransferBuffer(_filterColumns, filterColumn);
                            filterColumnList.Add(filterColumn);
                        }
                        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));
        }
        public questStatus Update(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterColumn filterColumn)
        {
            // Initialize
            questStatus status             = null;
            bool        bCreateTransaction = trans == null;


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


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, filterColumn);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterColumn filterColumn, out FilterColumnId filterColumnId)
        {
            // Initialize
            questStatus status = null;

            filterColumnId = null;


            // Data rules.


            // Create the filterColumn in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, filterColumn, out filterColumnId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
        public questStatus Read(DbMgrTransaction trans, FilterColumnId filterColumnId, out Quest.Functional.MasterPricing.FilterColumn filterColumn)
        {
            // Initialize
            questStatus status = null;

            filterColumn = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterColumns _filterColumns = null;
            status = read((MasterPricingEntities)trans.DbContext, filterColumnId, out _filterColumns);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterColumn = new Quest.Functional.MasterPricing.FilterColumn();
            BufferMgr.TransferBuffer(_filterColumns, filterColumn);

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


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.FilterColumn filterColumn, out FilterColumnId filterColumnId)
        {
            // Initialize
            questStatus status = null;

            filterColumnId = null;


            // Data rules.


            // Create the filterColumn
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, filterColumn, out filterColumnId);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }