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


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

                // Delete the record.
                dbContext.StoredProcedureLogs.Remove(_storedProcedureLog);
                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
        /*----------------------------------------------------------------------------------------------------------------------------------
        * StoredProcedureLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.StoredProcedureLog storedProcedureLog, out StoredProcedureLogId storedProcedureLogId)
        {
            // Initialize
            storedProcedureLogId = null;


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


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.StoredProcedureLogs _storedProcedureLog = new Quest.Services.Dbio.MasterPricing.StoredProcedureLogs();
                BufferMgr.TransferBuffer(storedProcedureLog, _storedProcedureLog);
                dbContext.StoredProcedureLogs.Add(_storedProcedureLog);
                dbContext.SaveChanges();
                if (_storedProcedureLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.StoredProcedureLog not created"));
                }
                storedProcedureLogId = new StoredProcedureLogId(_storedProcedureLog.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.StoredProcedureLogId storedProcedureLogId, out Quest.Functional.Logging.StoredProcedureLog storedProcedureLog)
        {
            // Initialize
            questStatus status = null;

            storedProcedureLog = null;


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


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