Пример #1
0
        private questStatus delete(MasterPricingEntities dbContext, Quest.Functional.Logging.BulkUpdateLogId bulkUpdateLogId)
        {
            // Initialize
            questStatus status = null;


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

                // Delete the record.
                dbContext.BulkUpdateLogs.Remove(_bulkUpdateLog);
                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));
        }
Пример #2
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * BulkUpdateLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.BulkUpdateLog bulkUpdateLog, out BulkUpdateLogId bulkUpdateLogId)
        {
            // Initialize
            bulkUpdateLogId = null;


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


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.BulkUpdateLogs _bulkUpdateLog = new Quest.Services.Dbio.MasterPricing.BulkUpdateLogs();
                BufferMgr.TransferBuffer(bulkUpdateLog, _bulkUpdateLog);
                dbContext.BulkUpdateLogs.Add(_bulkUpdateLog);
                dbContext.SaveChanges();
                if (_bulkUpdateLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.BulkUpdateLog not created"));
                }
                bulkUpdateLogId = new BulkUpdateLogId(_bulkUpdateLog.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));
        }
Пример #3
0
        public questStatus Read(DbMgrTransaction trans, Quest.Functional.Logging.BulkUpdateLogId bulkUpdateLogId, out Quest.Functional.Logging.BulkUpdateLog bulkUpdateLog)
        {
            // Initialize
            questStatus status = null;

            bulkUpdateLog = null;


            // Perform read.
            using (MasterPricingEntities dbContext = new MasterPricingEntities())
            {
                Quest.Services.Dbio.MasterPricing.BulkUpdateLogs _bulkUpdateLog = null;
                status = read((MasterPricingEntities)trans.DbContext, bulkUpdateLogId, out _bulkUpdateLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                bulkUpdateLog = new Quest.Functional.Logging.BulkUpdateLog();
                BufferMgr.TransferBuffer(_bulkUpdateLog, bulkUpdateLog);
            }
            return(new questStatus(Severity.Success));
        }
Пример #4
0
        private questStatus read(MasterPricingEntities dbContext, string username, out Quest.Services.Dbio.MasterPricing.BulkUpdateLogs bulkUpdateLog)
        {
            // Initialize
            bulkUpdateLog = null;


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