public virtual void CheckReadPermit()
 {
     if (!DoesUserHaveViewRoles())
     {
         LogMonitor.Log(new LogMessageEntry(DeniedAccessReadLog, string.Format(Resources.EUserDoesNotHaveViewPermitions, HeaderRu)));
         UserRoles.UserDoesNotHavePermitions(string.Format(Resources.EUserDoesNotHaveViewPermitions, Header));
     }
 }
        protected override void OnPreRender(EventArgs e)
        {
            if (!IsPostBack)
            {
                EnsureChildControls();
                LogMonitor.Log(new LogMessageEntry(ViewLog, HeaderRu, RvsSavedProperties.GetFromJournal(this)));
            }

            base.OnPreRender(e);
            ScriptManager.RegisterScriptControl(this);
        }
示例#3
0
        private static void Log(LogMonitor logMonitor, string guid, WebReportManager reportManager)
        {
            LogMessageType logType;
            string         message;

            if (HttpContext.Current != null && HttpContext.Current.Session != null && HttpContext.Current.Session["logcode" + guid] != null)
            {
                logType = (LogMessageType)HttpContext.Current.Session["logcode" + guid];
                message = (string)HttpContext.Current.Session["logmsg" + guid];
            }
            else
            {
                logType = reportManager.GetLogCode(reportManager.Plugin);
                message = reportManager.GetLogInformation().Replace("\r\n", "<br/>");
            }
            if (logType != LogMessageType.None)
            {
                logMonitor.Log(new LogMessageEntry(logType, message));
            }
        }
示例#4
0
        public void ExecuteActions(params ProgressManagerAction[] actions)
        {
            lock (lockActions)
            {
                var processActions = actions.ToList();
                ClearState();
                StartTime = DateTime.Now;
                stepCount = actions.Sum(r => r.StepCount);
                var disposeList        = new List <IDisposable>();
                int startProgressIndex = 0;

                // ReSharper disable once AccessToModifiedClosure
                Action <int> stepProgress = delegate(int i) { progressIndex = startProgressIndex + i; };
                try
                {
                    foreach (var action in processActions)
                    {
                        var args = new ProgressManagerActionArgs();
                        if (action.StepCount > 1)
                        {
                            startProgressIndex  = progressIndex;
                            action.StepProgress = stepProgress;
                            action.Handler(args);
                            progressIndex = startProgressIndex + action.StepCount;
                        }
                        else
                        {
                            action.Handler(args);
                            progressIndex++;
                        }

                        if (args.DisposableObject != null)
                        {
                            disposeList.Add(args.DisposableObject);
                        }

                        if (args.Errors != null && args.Errors.Count > 0)
                        {
                            Errors.AddRange(args.Errors);
                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Errors.Add(DateTime.Now.ToString("HH:mm: ") + e);
                }
                finally
                {
                    foreach (var disposable in disposeList.AsEnumerable().Reverse())
                    {
                        disposable.Dispose();
                    }
                    progressIndex = -1;
                    FinishTime    = DateTime.Now;
                }
            }

            if (LogMonitor != null && Errors.Count > 0)
            {
                LogMonitor.Log(
                    new BaseLogMessageEntry
                {
                    DateTime          = DateTime.Now,
                    Message           = string.Join("; ", Errors.ToArray()),
                    MessageCodeAsLong = LogConstants.SystemErrorInApp,
                });
            }
        }