Esempio n. 1
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterOperator filterOperator)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterOperatorId filterOperatorId = new FilterOperatorId(filterOperator.Id);
                Quest.Services.Dbio.MasterPricing.FilterOperators _filterOperators = null;
                status = read(dbContext, filterOperatorId, out _filterOperators);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterOperator, _filterOperators);
                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));
        }
Esempio n. 2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterColumns
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterOperator filterOperator, out FilterOperatorId filterOperatorId)
        {
            // Initialize
            filterOperatorId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterOperators _filterOperators = new Quest.Services.Dbio.MasterPricing.FilterOperators();
                BufferMgr.TransferBuffer(filterOperator, _filterOperators);
                dbContext.FilterOperators.Add(_filterOperators);
                dbContext.SaveChanges();
                if (_filterOperators.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterOperator not created"));
                }
                filterOperatorId = new FilterOperatorId(_filterOperators.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));
        }
Esempio n. 3
0
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.FilterOperator> filterOperatorList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            filterOperatorList = null;
            queryResponse      = null;


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


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


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, filterOperator);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Esempio n. 6
0
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterOperator filterOperator, out FilterOperatorId filterOperatorId)
        {
            // Initialize
            questStatus status = null;

            filterOperatorId = null;


            // Data rules.


            // Create the filterOperator in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, filterOperator, out filterOperatorId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Esempio n. 7
0
        public questStatus Read(DbMgrTransaction trans, FilterOperatorId filterOperatorId, out Quest.Functional.MasterPricing.FilterOperator filterOperator)
        {
            // Initialize
            questStatus status = null;

            filterOperator = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterOperators _filterOperators = null;
            status = read((MasterPricingEntities)trans.DbContext, filterOperatorId, out _filterOperators);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterOperator = new Quest.Functional.MasterPricing.FilterOperator();
            BufferMgr.TransferBuffer(_filterOperators, filterOperator);

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


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.FilterOperator filterOperator, out FilterOperatorId filterOperatorId)
        {
            // Initialize
            questStatus status = null;

            filterOperatorId = null;


            // Data rules.


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