예제 #1
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterFolders
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterFolder filterFolder, out FilterFolderId filterFolderId)
        {
            // Initialize
            filterFolderId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterFolders _filterFolders = new Quest.Services.Dbio.MasterPricing.FilterFolders();
                BufferMgr.TransferBuffer(filterFolder, _filterFolders);
                dbContext.FilterFolders.Add(_filterFolders);
                dbContext.SaveChanges();
                if (_filterFolders.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.FilterFolder not created"));
                }
                filterFolderId = new FilterFolderId(_filterFolders.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));
        }
예제 #2
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.FilterFolder filterFolder)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                FilterFolderId filterFolderId = new FilterFolderId(filterFolder.Id);
                Quest.Services.Dbio.MasterPricing.FilterFolders _filterFolders = null;
                status = read(dbContext, filterFolderId, out _filterFolders);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(filterFolder, _filterFolders);
                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));
        }
예제 #3
0
        public questStatus Read(DbMgrTransaction trans, FolderId folderId, out List <Quest.Functional.MasterPricing.FilterFolder> filterFolderList)
        {
            // Initialize
            questStatus status = null;

            filterFolderList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.FilterFolders> _filterFoldersList = null;

            status = read((MasterPricingEntities)trans.DbContext, folderId, out _filterFoldersList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterFolderList = new List <FilterFolder>();
            foreach (Quest.Services.Dbio.MasterPricing.FilterFolders _filterFolder in _filterFoldersList)
            {
                Quest.Functional.MasterPricing.FilterFolder filterFolder = new Quest.Functional.MasterPricing.FilterFolder();
                BufferMgr.TransferBuffer(_filterFolder, filterFolder);
                filterFolderList.Add(filterFolder);
            }
            return(new questStatus(Severity.Success));
        }
예제 #4
0
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.FilterFolder> filterFolderList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            filterFolderList = null;
            queryResponse    = null;


            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
                {
                    try
                    {
                        PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.FilterFolders).GetProperties().ToArray();
                        int            totalRecords = dbContext.FilterFolders.Where(BuildWhereClause(queryOptions, dbProperties)).Count();
                        List <Quest.Services.Dbio.MasterPricing.FilterFolders> _filterFoldersList = dbContext.FilterFolders.Where(BuildWhereClause(queryOptions, dbProperties))
                                                                                                    .OrderBy(BuildSortString(queryOptions.SortColumns))
                                                                                                    .Skip(queryOptions.Paging.PageSize * (queryOptions.Paging.PageNumber - 1))
                                                                                                    .Take(queryOptions.Paging.PageSize).ToList();
                        if (_filterFoldersList == null)
                        {
                            return(new questStatus(Severity.Warning));
                        }
                        filterFolderList = new List <Quest.Functional.MasterPricing.FilterFolder>();
                        foreach (Quest.Services.Dbio.MasterPricing.FilterFolders _filterFolders in _filterFoldersList)
                        {
                            Quest.Functional.MasterPricing.FilterFolder filterFolder = new Quest.Functional.MasterPricing.FilterFolder();
                            BufferMgr.TransferBuffer(_filterFolders, filterFolder);
                            filterFolderList.Add(filterFolder);
                        }
                        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.FilterFolder filterFolder)
        {
            // Initialize
            questStatus status             = null;
            bool        bCreateTransaction = trans == null;


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


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

            filterFolderId = null;


            // Data rules.


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

            filterFolder = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.FilterFolders _filterFolders = null;
            status = read((MasterPricingEntities)trans.DbContext, filterFolderId, out _filterFolders);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            filterFolder = new Quest.Functional.MasterPricing.FilterFolder();
            BufferMgr.TransferBuffer(_filterFolders, filterFolder);

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


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.FilterFolder filterFolder, out FilterFolderId filterFolderId)
        {
            // Initialize
            questStatus status = null;

            filterFolderId = null;


            // Data rules.


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