Esempio n. 1
0
        /// <summary>機能の実行を記録する。</summary>
        /// <param name="target">対象の機能(Screen/Dialog)</param>
        /// <param name="funcKeyNo">Fキー番号</param>
        /// <param name="action">機能の本処理</param>
        internal static void FunctionCalled(this ILoggable target, int funcKeyNo, Action action)
        {
            if (action == null)
            {
                return;
            }

            bool   logging     = (target.ApplicationControl?.UseOperationLogging ?? 0) == 1;
            ILogin login       = target.Login;
            string viewCaption = target.Caption;

            MeasurementHelper.ProcessStart();

            if (logging)
            {
                var attribute = action.Method
                                .GetCustomAttributes(false)
                                .OfType <OperationLogAttribute>()
                                .FirstOrDefault();

                if (attribute != null)
                {
                    LogAsync(login, null, viewCaption, $"F{funcKeyNo}:{attribute.FunctionName}");
                }
            }
            action();

            if (!string.IsNullOrEmpty(viewCaption) && funcKeyNo != 10)
            {
                MeasurementHelper.ProcessEnd($"{viewCaption} F{funcKeyNo}");
            }
        }
Esempio n. 2
0
        /// <summary>機能の実行を記録する。</summary>
        /// <param name="target">対象の機能(Screen/Dialog)</param>
        /// <param name="funcKeyNo">Fキー番号</param>
        /// <param name="button">ボタン</param>
        internal static void FunctionCalled(this ILoggable target, int funcKeyNo, Button button)
        {
            bool   logging     = (target.ApplicationControl?.UseOperationLogging ?? 0) == 1;
            ILogin login       = target.Login;
            string viewCaption = target.Caption;

            MeasurementHelper.ProcessStart();

            if (logging && button != null)
            {
                LogAsync(login, null, viewCaption, button.Text);
            }

            if (!string.IsNullOrEmpty(viewCaption) && funcKeyNo != 10)
            {
                MeasurementHelper.ProcessEnd($"{viewCaption} F{funcKeyNo}");
            }
        }