Beispiel #1
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterColumns
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterValue filterValue, out FilterValueId filterValueId)
        {
            // Initialize
            filterValueId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterValues _filterValues = new Quest.Services.Dbio.MasterPricing.FilterValues();
                BufferMgr.TransferBuffer(filterValue, _filterValues);
                dbContext.FilterValues.Add(_filterValues);
                dbContext.SaveChanges();
                if (_filterValues.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterValue not created"));
                }
                filterValueId = new FilterValueId(_filterValues.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 #2
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterValue filterValue)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterValueId filterValueId = new FilterValueId(filterValue.Id);
                Quest.Services.Dbio.MasterPricing.FilterValues _filterValues = null;
                status = read(dbContext, filterValueId, out _filterValues);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterValue, _filterValues);
                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 #3
0
        public questStatus Read(DbMgrTransaction trans, FilterOperationId filterOperationId, out List <Quest.Functional.MasterPricing.FilterValue> filterValueList)
        {
            // Initialize
            questStatus status = null;

            filterValueList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.FilterValues> _filterValuesList = null;

            status = read((MasterPricingEntities)trans.DbContext, filterOperationId, out _filterValuesList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterValueList = new List <FilterValue>();
            foreach (Quest.Services.Dbio.MasterPricing.FilterValues _filterValue in _filterValuesList)
            {
                Quest.Functional.MasterPricing.FilterValue filterValue = new Quest.Functional.MasterPricing.FilterValue();
                BufferMgr.TransferBuffer(_filterValue, filterValue);
                filterValueList.Add(filterValue);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #4
0
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.FilterValue> filterValueList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            filterValueList = null;
            queryResponse   = null;


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


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


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, filterValue);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #7
0
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterValue filterValue, out FilterValueId filterValueId)
        {
            // Initialize
            questStatus status = null;

            filterValueId = null;


            // Data rules.


            // Create the filterValue in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, filterValue, out filterValueId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Beispiel #8
0
        public questStatus Read(DbMgrTransaction trans, FilterValueId filterValueId, out Quest.Functional.MasterPricing.FilterValue filterValue)
        {
            // Initialize
            questStatus status = null;

            filterValue = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterValues _filterValues = null;
            status = read((MasterPricingEntities)trans.DbContext, filterValueId, out _filterValues);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterValue = new Quest.Functional.MasterPricing.FilterValue();
            BufferMgr.TransferBuffer(_filterValues, filterValue);

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


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.FilterValue filterValue, out FilterValueId filterValueId)
        {
            // Initialize
            questStatus status = null;

            filterValueId = null;


            // Data rules.


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