/*----------------------------------------------------------------------------------------------------------------------------------
        * TablesetViews
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.MasterPricing.TablesetView tablesetView, out TablesetViewId tablesetViewId)
        {
            // Initialize
            questStatus status = null;

            tablesetViewId = null;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.TablesetViews _tablesetView = new Quest.Services.Dbio.MasterPricing.TablesetViews();
                BufferMgr.TransferBuffer(tablesetView, _tablesetView);
                dbContext.TablesetViews.Add(_tablesetView);
                dbContext.SaveChanges();
                if (_tablesetView.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.MasterPricing.TablesetView not created"));
                }
                tablesetViewId = new TablesetViewId(_tablesetView.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));
        }
        public questStatus Read(DbMgrTransaction trans, FilterViewTablesetViewId filterViewTablesetViewId, out Quest.Functional.MasterPricing.TablesetView tablesetView)
        {
            // Initialize
            questStatus status = null;

            tablesetView = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.TablesetViews _tablesetView = null;
                status = read((MasterPricingEntities)trans.DbContext, filterViewTablesetViewId, out _tablesetView);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetView = new Quest.Functional.MasterPricing.TablesetView();
                BufferMgr.TransferBuffer(_tablesetView, tablesetView);
            }
            return(new questStatus(Severity.Success));
        }
        private questStatus read(MasterPricingEntities dbContext, FilterViewTablesetViewId filterViewTablesetViewId, out Quest.Services.Dbio.MasterPricing.TablesetViews tablesetView)
        {
            // Initialize
            questStatus status = null;

            tablesetView = null;


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