예제 #1
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterView filterView)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterViewId filterViewId = new FilterViewId(filterView.Id);
                Quest.Services.Dbio.MasterPricing.FilterViews _filterViews = null;
                status = read(dbContext, filterViewId, out _filterViews);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterView, _filterViews);
                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));
        }
예제 #2
0
        public questStatus Read(DbMgrTransaction trans, FilterId filterId, out List <Quest.Functional.MasterPricing.FilterView> filterViewList)
        {
            // Initialize
            questStatus status = null;

            filterViewList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.FilterViews> _filterViewsList = null;

            status = read((MasterPricingEntities)trans.DbContext, filterId, out _filterViewsList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterViewList = new List <FilterView>();
            foreach (Quest.Services.Dbio.MasterPricing.FilterViews _filterView in _filterViewsList)
            {
                Quest.Functional.MasterPricing.FilterView filterView = new Quest.Functional.MasterPricing.FilterView();
                BufferMgr.TransferBuffer(_filterView, filterView);
                filterViewList.Add(filterView);
            }
            return(new questStatus(Severity.Success));
        }
예제 #3
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterViews
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterView filterView, out FilterViewId filterViewId)
        {
            // Initialize
            filterViewId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterViews _filterViews = new Quest.Services.Dbio.MasterPricing.FilterViews();
                BufferMgr.TransferBuffer(filterView, _filterViews);
                dbContext.FilterViews.Add(_filterViews);
                dbContext.SaveChanges();
                if (_filterViews.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterView not created"));
                }
                filterViewId = new FilterViewId(_filterViews.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 questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.FilterView> filterViewList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            filterViewList = null;
            queryResponse  = null;


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


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


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, filterView);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
예제 #7
0
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.FilterView filterView, out FilterViewId filterViewId)
        {
            // Initialize
            questStatus status = null;

            filterViewId = null;


            // Data rules.


            // Create the filterView in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, filterView, out filterViewId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
예제 #8
0
        public questStatus Read(DbMgrTransaction trans, FilterViewId filterViewId, out Quest.Functional.MasterPricing.FilterView filterView)
        {
            // Initialize
            questStatus status = null;

            filterView = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterViews _filterViews = null;
            status = read((MasterPricingEntities)trans.DbContext, filterViewId, out _filterViews);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterView = new Quest.Functional.MasterPricing.FilterView();
            BufferMgr.TransferBuffer(_filterViews, filterView);

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


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.FilterView filterView, out FilterViewId filterViewId)
        {
            // Initialize
            questStatus status = null;

            filterViewId = null;


            // Data rules.


            // Create the filterView
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, filterView, out filterViewId);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
예제 #10
0
        public questStatus Read(FilterViewNameIdentifier filterViewNameIdentifier, out Quest.Functional.MasterPricing.FilterView filterView)
        {
            // Initialize
            questStatus status = null;

            filterView = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.FilterViews _filterViews = null;
                status = read(dbContext, filterViewNameIdentifier, out _filterViews);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterView = new Quest.Functional.MasterPricing.FilterView();
                BufferMgr.TransferBuffer(_filterViews, filterView);
            }
            return(new questStatus(Severity.Success));
        }