private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.ExceptionLogId exceptionLogId) { // Initialize questStatus status = null; try { // Read the record. Quest.Services.Dbio.MasterPricing.ExceptionLogs _exceptionLog = null; status = read(dbContext, exceptionLogId, out _exceptionLog); if (!questStatusDef.IsSuccess(status)) { return(status); } // Delete the record. dbContext.ExceptionLogs.Remove(_exceptionLog); 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)); }
/*---------------------------------------------------------------------------------------------------------------------------------- * ExceptionLogs *---------------------------------------------------------------------------------------------------------------------------------*/ private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.ExceptionLog exceptionLog, out ExceptionLogId exceptionLogId) { // Initialize exceptionLogId = null; // Initialize exceptionLog.UserSessionId = this.UserSession.Id; exceptionLog.Username = this.UserSession.User.Username; exceptionLog.Created = DateTime.Now; // Perform create try { Quest.Services.Dbio.MasterPricing.ExceptionLogs _exceptionLog = new Quest.Services.Dbio.MasterPricing.ExceptionLogs(); BufferMgr.TransferBuffer(exceptionLog, _exceptionLog); dbContext.ExceptionLogs.Add(_exceptionLog); dbContext.SaveChanges(); if (_exceptionLog.Id == 0) { return(new questStatus(Severity.Error, "Quest.Functional.Logging.ExceptionLog not created")); } exceptionLogId = new ExceptionLogId(_exceptionLog.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)); }
public questStatus Read(DbMgrTransaction trans, Quest.Functional.Logging.ExceptionLogId exceptionLogId, out Quest.Functional.Logging.ExceptionLog exceptionLog) { // Initialize questStatus status = null; exceptionLog = null; // Perform read. using (MasterPricingEntities dbContext = new MasterPricingEntities()) { Quest.Services.Dbio.MasterPricing.ExceptionLogs _exceptionLog = null; status = read((MasterPricingEntities)trans.DbContext, exceptionLogId, out _exceptionLog); if (!questStatusDef.IsSuccess(status)) { return(status); } exceptionLog = new Quest.Functional.Logging.ExceptionLog(); BufferMgr.TransferBuffer(_exceptionLog, exceptionLog); } return(new questStatus(Severity.Success)); }
private questStatus read(MasterPricingEntities dbContext, string username, out Quest.Services.Dbio.MasterPricing.ExceptionLogs exceptionLog) { // Initialize exceptionLog = null; try { exceptionLog = dbContext.ExceptionLogs.Where(r => r.Username == username).SingleOrDefault(); if (exceptionLog == 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)); }