Exemple #1
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.TablesetLogId tablesetLogId)
        {
            // Initialize
            questStatus status = null;


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

                // Delete the record.
                dbContext.TablesetLogs.Remove(_tablesetLog);
                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));
        }
Exemple #2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * TablesetLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.TablesetLog tablesetLog, out TablesetLogId tablesetLogId)
        {
            // Initialize
            tablesetLogId = null;


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


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.TablesetLogs _tablesetLog = new Quest.Services.Dbio.MasterPricing.TablesetLogs();
                BufferMgr.TransferBuffer(tablesetLog, _tablesetLog);
                dbContext.TablesetLogs.Add(_tablesetLog);
                dbContext.SaveChanges();
                if (_tablesetLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.TablesetLog not created"));
                }
                tablesetLogId = new TablesetLogId(_tablesetLog.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));
        }
Exemple #3
0
        public questStatus Read(DbMgrTransaction trans, Quest.Functional.Logging.TablesetLogId tablesetLogId, out Quest.Functional.Logging.TablesetLog tablesetLog)
        {
            // Initialize
            questStatus status = null;

            tablesetLog = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.TablesetLogs _tablesetLog = null;
                status = read((MasterPricingEntities)trans.DbContext, tablesetLogId, out _tablesetLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                tablesetLog = new Quest.Functional.Logging.TablesetLog();
                BufferMgr.TransferBuffer(_tablesetLog, tablesetLog);
            }
            return(new questStatus(Severity.Success));
        }
Exemple #4
0
        private questStatus read(MasterPricingEntities dbContext, string username, out Quest.Services.Dbio.MasterPricing.TablesetLogs tablesetLog)
        {
            // Initialize
            tablesetLog = null;


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