Ejemplo n.º 1
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.BulkInsertLogId bulkInsertLogId)
        {
            // Initialize
            questStatus status = null;


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

                // Delete the record.
                dbContext.BulkInsertLogs.Remove(_bulkInsertLog);
                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));
        }
Ejemplo n.º 2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * BulkInsertLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.BulkInsertLog bulkInsertLog, out BulkInsertLogId bulkInsertLogId)
        {
            // Initialize
            bulkInsertLogId = null;


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


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.BulkInsertLogs _bulkInsertLog = new Quest.Services.Dbio.MasterPricing.BulkInsertLogs();
                BufferMgr.TransferBuffer(bulkInsertLog, _bulkInsertLog);
                dbContext.BulkInsertLogs.Add(_bulkInsertLog);
                dbContext.SaveChanges();
                if (_bulkInsertLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.BulkInsertLog not created"));
                }
                bulkInsertLogId = new BulkInsertLogId(_bulkInsertLog.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));
        }
Ejemplo n.º 3
0
        public questStatus Read(DbMgrTransaction trans, Quest.Functional.Logging.BulkInsertLogId bulkInsertLogId, out Quest.Functional.Logging.BulkInsertLog bulkInsertLog)
        {
            // Initialize
            questStatus status = null;

            bulkInsertLog = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.BulkInsertLogs _bulkInsertLog = null;
                status = read((MasterPricingEntities)trans.DbContext, bulkInsertLogId, out _bulkInsertLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                bulkInsertLog = new Quest.Functional.Logging.BulkInsertLog();
                BufferMgr.TransferBuffer(_bulkInsertLog, bulkInsertLog);
            }
            return(new questStatus(Severity.Success));
        }
Ejemplo n.º 4
0
        private questStatus read(MasterPricingEntities dbContext, string username, out Quest.Services.Dbio.MasterPricing.BulkInsertLogs bulkInsertLog)
        {
            // Initialize
            bulkInsertLog = null;


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