Example #1
0
        public questStatus Read(DbMgrTransaction trans, StoredProcedureId storedProcedureId, out List <Quest.Functional.MasterPricing.StoredProcedureParameter> storedProcedureParameterList)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterList = null;


            // Perform read
            List <Quest.Services.Dbio.MasterPricing.StoredProcedureParameters> _storedProcedureParametersList = null;

            status = read((MasterPricingEntities)trans.DbContext, storedProcedureId, out _storedProcedureParametersList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            storedProcedureParameterList = new List <StoredProcedureParameter>();
            foreach (Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameter in _storedProcedureParametersList)
            {
                Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter = new Quest.Functional.MasterPricing.StoredProcedureParameter();
                BufferMgr.TransferBuffer(_storedProcedureParameter, storedProcedureParameter);
                storedProcedureParameterList.Add(storedProcedureParameter);
            }
            return(new questStatus(Severity.Success));
        }
Example #2
0
        public questStatus List(QueryOptions queryOptions, out List <Quest.Functional.MasterPricing.StoredProcedureParameter> storedProcedureParameterList, out QueryResponse queryResponse)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterList = null;
            queryResponse = null;


            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                using (DbContextTransaction tx = dbContext.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
                {
                    try
                    {
                        PropertyInfo[] dbProperties = typeof(Quest.Services.Dbio.MasterPricing.StoredProcedureParameters).GetProperties().ToArray();
                        int            totalRecords = dbContext.StoredProcedureParameters.Where(BuildWhereClause(queryOptions, dbProperties)).Count();
                        List <Quest.Services.Dbio.MasterPricing.StoredProcedureParameters> _countriesList = dbContext.StoredProcedureParameters.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));
                        }
                        storedProcedureParameterList = new List <Quest.Functional.MasterPricing.StoredProcedureParameter>();
                        foreach (Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameters in _countriesList)
                        {
                            Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter = new Quest.Functional.MasterPricing.StoredProcedureParameter();
                            BufferMgr.TransferBuffer(_storedProcedureParameters, storedProcedureParameter);
                            storedProcedureParameterList.Add(storedProcedureParameter);
                        }
                        status = BuildQueryResponse(totalRecords, queryOptions, out queryResponse);
                        if (!questStatusDef.IsSuccess(status))
                        {
                            return(status);
                        }
                    }
                    catch (System.Exception ex)
                    {
                        status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                               this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                               ex.InnerException != null ? ex.InnerException.Message : ex.Message));
                        LogException(ex, status);
                        return(status);
                    }
                }
            }
            return(new questStatus(Severity.Success));
        }
Example #3
0
        public questStatus Update(DbMgrTransaction trans, Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter)
        {
            // Initialize
            questStatus status             = null;
            bool        bCreateTransaction = trans == null;


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


            // Perform update.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = update(dbContext, storedProcedureParameter);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
Example #5
0
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter, out StoredProcedureParameterId storedProcedureParameterId)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterId = null;


            // Data rules.


            // Create the storedProcedureParameter in this transaction.
            status = create((MasterPricingEntities)trans.DbContext, storedProcedureParameter, out storedProcedureParameterId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Example #6
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * StoredProcedureParameters
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter, out StoredProcedureParameterId storedProcedureParameterId)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameters = new Quest.Services.Dbio.MasterPricing.StoredProcedureParameters();
                BufferMgr.TransferBuffer(storedProcedureParameter, _storedProcedureParameters);
                dbContext.StoredProcedureParameters.Add(_storedProcedureParameters);
                dbContext.SaveChanges();
                if (_storedProcedureParameters.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.StoredProcedureParameter not created"));
                }
                storedProcedureParameterId = new StoredProcedureParameterId(_storedProcedureParameters.Id);
            }
            catch (DbEntityValidationException ex)
            {
                var    errorMessages    = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
                String fullErrorMessage = string.Join("; ", errorMessages);
                String exceptionMessage = string.Concat(ex.Message, fullErrorMessage);

                status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                       this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                       exceptionMessage));
                LogException(ex, status);
                return(status);
            }
            catch (System.Exception ex)
            {
                status = new questStatus(Severity.Fatal, String.Format("EXCEPTION: {0}.{1}: {2}",
                                                                       this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                       ex.InnerException != null ? ex.InnerException.Message : ex.Message));
                LogException(ex, status);
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Example #7
0
        public questStatus Read(DbMgrTransaction trans, StoredProcedureParameterId storedProcedureParameterId, out Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameter = null;


            // Perform read
            Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameters = null;
            status = read((MasterPricingEntities)trans.DbContext, storedProcedureParameterId, out _storedProcedureParameters);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            storedProcedureParameter = new Quest.Functional.MasterPricing.StoredProcedureParameter();
            BufferMgr.TransferBuffer(_storedProcedureParameters, storedProcedureParameter);

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


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter, out StoredProcedureParameterId storedProcedureParameterId)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterId = null;


            // Data rules.


            // Create the storedProcedureParameter
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                status = create(dbContext, storedProcedureParameter, out storedProcedureParameterId);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
            }
            return(new questStatus(Severity.Success));
        }
        /*==================================================================================================================================
        * Properties
        *=================================================================================================================================*/
        #endregion


        #region Public Methods

        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Create(DbMgrTransaction trans, Quest.Functional.MasterPricing.Database database, Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter, out Quest.Functional.MasterPricing.StoredProcedureParameterId storedProcedureParameterId)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterId = null;


            // Create storedProcedureParameter
            status = _dbStoredProcedureParametersMgr.Create(trans, storedProcedureParameter, out storedProcedureParameterId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }