예제 #1
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * TablesetColumns
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.TablesetColumn tablesetColumn, out TablesetColumnId tablesetColumnId)
        {
            // Initialize
            questStatus status = null;

            tablesetColumnId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.TablesetColumns _tablesetColumn = new Quest.Services.Dbio.MasterPricing.TablesetColumns();
                BufferMgr.TransferBuffer(tablesetColumn, _tablesetColumn);
                dbContext.TablesetColumns.Add(_tablesetColumn);
                dbContext.SaveChanges();
                if (_tablesetColumn.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.TablesetColumn not created"));
                }
                tablesetColumnId = new TablesetColumnId(_tablesetColumn.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));
        }
예제 #2
0
        public questStatus Read(DbMgrTransaction trans, TablesetColumnId tablesetColumnId, out Quest.Functional.MasterPricing.TablesetColumn tablesetColumn)
        {
            // Initialize
            questStatus status = null;

            tablesetColumn = null;


            // Perform read.
            Quest.Services.Dbio.MasterPricing.TablesetColumns _tablesetColumn = null;
            status = read((MasterPricingEntities)trans.DbContext, tablesetColumnId, out _tablesetColumn);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            tablesetColumn = new Quest.Functional.MasterPricing.TablesetColumn();
            BufferMgr.TransferBuffer(_tablesetColumn, tablesetColumn);

            return(new questStatus(Severity.Success));
        }
예제 #3
0
        private questStatus delete(MasterPricingEntities dbContext, TablesetColumnId tablesetColumnId)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                Quest.Services.Dbio.MasterPricing.TablesetColumns _tablesetColumn = null;
                status = read(dbContext, tablesetColumnId, out _tablesetColumn);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Delete the record.
                dbContext.TablesetColumns.Remove(_tablesetColumn);
                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));
        }
예제 #4
0
        public questStatus Read(FilterColumnTablesetColumnId filterColumnTablesetColumnId, out Quest.Functional.MasterPricing.TablesetColumn tablesetColumn)
        {
            // Initialize
            questStatus status = null;

            tablesetColumn = null;


            // Perform read
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.TablesetColumns _tablesetColumn = null;
                status = read(dbContext, filterColumnTablesetColumnId, out _tablesetColumn);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetColumn = new Quest.Functional.MasterPricing.TablesetColumn();
                BufferMgr.TransferBuffer(_tablesetColumn, tablesetColumn);
            }
            return(new questStatus(Severity.Success));
        }
예제 #5
0
        private questStatus read(MasterPricingEntities dbContext, FilterColumnTablesetColumnId filterColumnTablesetColumnId, out Quest.Services.Dbio.MasterPricing.TablesetColumns tablesetColumn)
        {
            // Initialize
            questStatus status = null;

            tablesetColumn = null;


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