Example #1
0
        private questStatus update(MasterPricingEntities dbContext, Quest.Functional.Logging.PortalRequestLog portalRequestLog)
        {
            // Initialize
            questStatus status = null;


            try
            {
                // Read the record.
                PortalRequestLogId portalRequestLogId = new PortalRequestLogId(portalRequestLog.Id);
                Quest.Services.Dbio.MasterPricing.PortalRequestLogs _portalRequestLog = null;
                status = read(dbContext, portalRequestLogId, out _portalRequestLog);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }

                // Update the record.
                BufferMgr.TransferBuffer(portalRequestLog, _portalRequestLog);
                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));
        }
        public questStatus Delete(DeleteLogItemsViewModel deleteLogItemsViewModel)
        {
            // Initialize
            questStatus status = null;


            // Build id list
            List <PortalRequestLogId> portalRequestLogIdList = new List <PortalRequestLogId>();

            foreach (BaseId baseId in deleteLogItemsViewModel.Items)
            {
                PortalRequestLogId portalRequestLogId = new PortalRequestLogId(baseId.Id);
                portalRequestLogIdList.Add(portalRequestLogId);
            }

            // Delete items
            PortalRequestLogsMgr portalRequestLogsMgr = new PortalRequestLogsMgr(this.UserSession);

            status = portalRequestLogsMgr.Delete(portalRequestLogIdList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }
Example #3
0
        /*----------------------------------------------------------------------------------------------------------------------------------
        * PortalRequestLogs
        *---------------------------------------------------------------------------------------------------------------------------------*/
        private questStatus create(MasterPricingEntities dbContext, Quest.Functional.Logging.PortalRequestLog portalRequestLog, out PortalRequestLogId portalRequestLogId)
        {
            // Initialize
            portalRequestLogId = null;


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


            // Perform create
            try
            {
                Quest.Services.Dbio.MasterPricing.PortalRequestLogs _portalRequestLog = new Quest.Services.Dbio.MasterPricing.PortalRequestLogs();
                BufferMgr.TransferBuffer(portalRequestLog, _portalRequestLog);
                dbContext.PortalRequestLogs.Add(_portalRequestLog);
                dbContext.SaveChanges();
                if (_portalRequestLog.Id == 0)
                {
                    return(new questStatus(Severity.Error, "Quest.Functional.Logging.PortalLog not created"));
                }
                portalRequestLogId = new PortalRequestLogId(_portalRequestLog.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));
        }
Example #4
0
        private questStatus logPortalRequest()
        {
            // Initialize
            questStatus status = null;


            // If the custom controller factory invoked us w/o a Request context,
            // we need to load log settings.
            if (this._logSetting == null)
            {
                loadLogSettings();
            }
            if (!this._logSetting.bLogPortal)
            {
                // Portal logging not turned on, thus return WARNING so HTTP request can be logged.
                return(new questStatus(Severity.Warning));
            }

            // If there is no agent, nothing to log.
            if (Request.QueryString["_Agent"] == null)
            {
                return(new questStatus(Severity.Warning));
            }

            // Log portal request.
            PortalRequestLog portalRequestLog = new PortalRequestLog();

            if (this.UserSession != null)
            {
                portalRequestLog.UserSessionId = this.UserSession == null ? -1 : this.UserSession.Id;
                portalRequestLog.Username      = this.UserSession.User.Username;
            }
            portalRequestLog.Name      = Request.QueryString["_Agent"].ToString().Replace("\"", "");
            portalRequestLog.Method    = Request.HttpMethod;
            portalRequestLog.IPAddress = Request.UserHostAddress;
            portalRequestLog.UserAgent = Request.UserAgent;
            portalRequestLog.URL       = Request.Url.ToString();
            PortalRequestLogId portalRequestLogId = null;

            status = _portalRequestLogsMgr.Create(portalRequestLog, out portalRequestLogId);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            return(new questStatus(Severity.Success));
        }