Esempio n. 1
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.FilterLogId filterLogId)
        {
            // Initialize
            questStatus status = null;


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

                // Delete the record.
                dbContext.FilterLogs.Remove(_filterLog);
                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));
        }
Esempio n. 2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * FilterLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.FilterLog filterLog, out FilterLogId filterLogId)
        {
            // Initialize
            filterLogId = null;


            // Initialize
            filterLog.UserSessionId = this.UserSession.Id;
            filterLog.Username      = this.UserSession.User.Username;
            filterLog.Created       = DateTime.Now;


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.FilterLogs _filterLog = new Quest.Services.Dbio.MasterPricing.FilterLogs();
                BufferMgr.TransferBuffer(filterLog, _filterLog);
                dbContext.FilterLogs.Add(_filterLog);
                dbContext.SaveChanges();
                if (_filterLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.FilterLog not created"));
                }
                filterLogId = new FilterLogId(_filterLog.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));
        }
Esempio n. 3
0
        public questStatus Read(DbMgrTransaction trans, Quest.Functional.Logging.FilterLogId filterLogId, out Quest.Functional.Logging.FilterLog filterLog)
        {
            // Initialize
            questStatus status = null;

            filterLog = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.FilterLogs _filterLog = null;
                status = read((MasterPricingEntities)trans.DbContext, filterLogId, out _filterLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                filterLog = new Quest.Functional.Logging.FilterLog();
                BufferMgr.TransferBuffer(_filterLog, filterLog);
            }
            return(new questStatus(Severity.Success));
        }
Esempio n. 4
0
        private questStatus read(MasterPricingEntities dbContext, string username, out Quest.Services.Dbio.MasterPricing.FilterLogs filterLog)
        {
            // Initialize
            filterLog = null;


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