Exemplo n.º 1
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.DatabaseLogId databaseLogId)
        {
            // Initialize
            questStatus status = null;


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

                // Delete the record.
                dbContext.DatabaseLogs.Remove(_databaseLog);
                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));
        }
Exemplo n.º 2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * DatabaseLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.DatabaseLog databaseLog, out DatabaseLogId databaseLogId)
        {
            // Initialize
            databaseLogId = null;


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


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.DatabaseLogs _databaseLog = new Quest.Services.Dbio.MasterPricing.DatabaseLogs();
                BufferMgr.TransferBuffer(databaseLog, _databaseLog);
                dbContext.DatabaseLogs.Add(_databaseLog);
                dbContext.SaveChanges();
                if (_databaseLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.DatabaseLog not created"));
                }
                databaseLogId = new DatabaseLogId(_databaseLog.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));
        }
Exemplo n.º 3
0
        public questStatus Read(DbMgrTransaction trans, Quest.Functional.Logging.DatabaseLogId databaseLogId, out Quest.Functional.Logging.DatabaseLog databaseLog)
        {
            // Initialize
            questStatus status = null;

            databaseLog = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.DatabaseLogs _databaseLog = null;
                status = read((MasterPricingEntities)trans.DbContext, databaseLogId, out _databaseLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                databaseLog = new Quest.Functional.Logging.DatabaseLog();
                BufferMgr.TransferBuffer(_databaseLog, databaseLog);
            }
            return(new questStatus(Severity.Success));
        }
Exemplo n.º 4
0
        private questStatus read(MasterPricingEntities dbContext, string username, out Quest.Services.Dbio.MasterPricing.DatabaseLogs databaseLog)
        {
            // Initialize
            databaseLog = null;


            try
            {
                databaseLog = dbContext.DatabaseLogs.Where(r => r.Username == username).SingleOrDefault();
                if (databaseLog == 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));
        }