Пример #1
0
        private questStatus create(MasterPricingEntities dbContext, List <Quest.Functional.MasterPricing.StoredProcedureParameter> storedProcedureParameterList, out List <Quest.Functional.MasterPricing.StoredProcedureParameter> storedProcedureParameterIdList)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameterIdList = null;


            // Perform create
            try
            {
                List <Quest.Services.Dbio.MasterPricing.StoredProcedureParameters> _storedProcedureParameterList = new List <Quest.Services.Dbio.MasterPricing.StoredProcedureParameters>();
                foreach (Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter in storedProcedureParameterList)
                {
                    Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameter = new Quest.Services.Dbio.MasterPricing.StoredProcedureParameters();
                    BufferMgr.TransferBuffer(storedProcedureParameter, _storedProcedureParameter);
                    _storedProcedureParameterList.Add(_storedProcedureParameter);
                }
                dbContext.StoredProcedureParameters.AddRange(_storedProcedureParameterList);
                dbContext.SaveChanges();

                storedProcedureParameterIdList = new List <StoredProcedureParameter>();
                foreach (Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameter in _storedProcedureParameterList)
                {
                    Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter = new StoredProcedureParameter();
                    storedProcedureParameter.Id = _storedProcedureParameter.Id;
                    storedProcedureParameterIdList.Add(storedProcedureParameter);
                }
            }
            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));
        }
Пример #2
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.StoredProcedureParameter storedProcedureParameter)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                StoredProcedureParameterId storedProcedureParameterId = new StoredProcedureParameterId(storedProcedureParameter.Id);
                Quest.Services.Dbio.MasterPricing.StoredProcedureParameters _storedProcedureParameters = null;
                status = read(dbContext, storedProcedureParameterId, out _storedProcedureParameters);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(storedProcedureParameter, _storedProcedureParameters);
                dbContext.SaveChanges();
            }
            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));
        }
Пример #3
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));
        }
Пример #4
0
        private questStatus read(MasterPricingEntities dbContext, StoredProcedureParameterId storedProcedureParameterId, out Quest.Services.Dbio.MasterPricing.StoredProcedureParameters storedProcedureParameter)
        {
            // Initialize
            questStatus status = null;

            storedProcedureParameter = null;


            try
            {
                storedProcedureParameter = dbContext.StoredProcedureParameters.Where(r => r.Id == storedProcedureParameterId.Id).SingleOrDefault();
                if (storedProcedureParameter == null)
                {
                    return(new questStatus(Severity.Error, String.Format("ERROR: {0}.{1}: {2}",
                                                                         this.GetType().Name, MethodBase.GetCurrentMethod().Name,
                                                                         String.Format("Id {0} not found", storedProcedureParameterId.Id))));
                }
            }
            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));
        }