Beispiel #1
0
        /// <summary>
        /// アクション メソッドによって返されたアクション結果が実行された後に呼び出されます。
        /// Controller.OnResultExecuted メソッド (System.Web.Mvc)
        /// http://msdn.microsoft.com/ja-jp/library/system.web.mvc.controller.onresultexecuted.aspx
        /// </summary>
        /// <param name="filterContext">
        /// 型: System.Web.Mvc.ResultExecutingContext
        /// 現在の要求およびアクション結果に関する情報。
        /// </param>
        protected override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            // Calling base class method.
            base.OnResultExecuted(filterContext);

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // ------------
            // メッセージ部
            // ------------
            // ユーザ名, IPアドレス,
            // レイヤ, 画面名, コントロール名, 処理名
            // 処理時間(実行時間), 処理時間(CPU時間)
            // エラーメッセージID, エラーメッセージ等
            // ------------
            string strLogMessage =
                "," + this.UserInfo.UserName +
                "," + this.UserInfo.IPAddress +
                "," + "<-----" +
                "," + this.ControllerName +
                "," + this.ActionName + "(OnResultExecuted)" +
                "," + perfRec.ExecTime +
                "," + perfRec.CpuTime;

            LogIF.DebugLog("ACCESS", strLogMessage);
        }
Beispiel #2
0
        /// <summary>業務例外発生時の処理を実装</summary>
        /// <param name="baEx">BusinessApplicationException</param>
        /// <param name="rcFxEventArgs">イベントハンドラの共通引数</param>
        /// <remarks>画面コード親クラス1から利用される派生の末端</remarks>
        protected override void UOC_ABEND(BusinessApplicationException baEx, RcFxEventArgs rcFxEventArgs)
        {
            // 業務例外発生時の処理を実装
            // TODO:

            // ここに、メッセージの組み立てロジックを実装する。

            // メッセージ編集処理 ------------------------------------------

            // -------------------------------------------------------------

            // メッセージ表示処理 ------------------------------------------

            // -------------------------------------------------------------

            // 性能測定終了

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // ACCESSログ出力-----------------------------------------------

            if (MyBaseControllerWin.CanOutPutLog)
            {
                // ------------
                // メッセージ部
                // ------------
                // ユーザ名, レイヤ, 画面名, コントロール名,
                // 処理時間(実行時間), 処理時間(CPU時間)
                // エラーメッセージID, エラーメッセージ等
                // ------------
                string strLogMessage =
                    "," + UserInfo.UserName +
                    "," + "<-----" +
                    "," + this.Name +
                    "," + rcFxEventArgs.ControlName +
                    "," + this.perfRec.ExecTime +
                    "," + this.perfRec.CpuTime +
                    "," + baEx.messageID +
                    "," + baEx.Message;

                // Log4Netへログ出力
                LogIF.WarnLog("ACCESS", strLogMessage);
            }

            // -------------------------------------------------------------
        }
Beispiel #3
0
        /// <summary>システム例外発生時の処理を実装</summary>
        /// <param name="bsEx">BusinessSystemException</param>
        /// <param name="rcFxEventArgs">イベントハンドラの共通引数</param>
        /// <remarks>画面コード親クラス1から利用される派生の末端</remarks>
        protected override void UOC_ABEND(BusinessSystemException bsEx, RcFxEventArgs rcFxEventArgs)
        {
            // システム例外発生時の処理を実装
            // TODO:

            // 性能測定終了

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // ACCESSログ出力-----------------------------------------------

            if (MyBaseControllerWin.CanOutPutLog)
            {
                // ------------
                // メッセージ部
                // ------------
                // ユーザ名, レイヤ, 画面名, コントロール名,
                // 処理時間(実行時間), 処理時間(CPU時間)
                // エラーメッセージID, エラーメッセージ等
                // ------------
                string strLogMessage =
                    "," + UserInfo.UserName +
                    "," + "<-----" +
                    "," + this.Name +
                    "," + rcFxEventArgs.ControlName +
                    "," + this.perfRec.ExecTime +
                    "," + this.perfRec.CpuTime +
                    "," + bsEx.messageID +
                    "," + bsEx.Message + "\r\n" + this.OriginalStackTrace;
                // OriginalStackTrace(ログ出力)の品質向上
                if (this.OriginalStackTrace == "")
                {
                    strLogMessage += bsEx.StackTrace;
                }
                else
                {
                    strLogMessage += this.OriginalStackTrace;
                }

                // Log4Netへログ出力
                LogIF.ErrorLog("ACCESS", strLogMessage);
            }

            // -------------------------------------------------------------
        }
        /// <summary>一般的な例外発生時の処理を実装</summary>
        /// <param name="ex">例外オブジェクト</param>
        /// <param name="fxEventArgs">イベントハンドラの共通引数</param>
        /// <remarks>画面コード親クラス1から利用される派生の末端</remarks>
        protected override void UOC_ABEND(Exception ex, FxEventArgs fxEventArgs)
        {
            // 一般的な例外発生時の処理を実装
            // TODO:

            // 性能測定終了

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // 認証ユーザ情報を取得する ------------------------------------
            this.GetUserInfo();

            // ACCESSログ出力-----------------------------------------------

            // ------------
            // メッセージ部
            // ------------
            // ユーザ名, IPアドレス,
            // レイヤ, 画面名, コントロール名, 処理名
            // 処理時間(実行時間), 処理時間(CPU時間)
            // エラーメッセージID, エラーメッセージ等
            // ------------
            string strLogMessage =
                "," + UserInfo.UserName +
                "," + Request.UserHostAddress +
                "," + "<-----" +
                "," + this.ContentPageFileNoEx +
                "," + fxEventArgs.ButtonID +
                "," + "" +
                "," + this.perfRec.ExecTime +
                "," + this.perfRec.CpuTime +
                "," + "other Exception" +
                "," + ex.Message + "\r\n" +
                ex.ToString(); // ex

            // Log4Netへログ出力
            LogIF.ErrorLog("ACCESS", strLogMessage);

            // -------------------------------------------------------------

            // エラー画面に画面遷移する ------------------------------------
            this.TransferErrorScreen(ex);
            // -------------------------------------------------------------
        }
Beispiel #5
0
 public void StartsPerformanceRecordTest()
 {
     try
     {
         bool expected = true;
         bool results  = _performanceRecorder.StartsPerformanceRecord();
         Assert.AreEqual(expected, results);
         Assert.AreNotEqual(false, results);
     }
     catch (Exception ex)
     {
         // Print a stack trace when an exception occurs.
         Console.WriteLine(ex.StackTrace);
         throw;
     }
 }
Beispiel #6
0
        /// <summary>一般的な例外発生時の処理を実装</summary>
        /// <param name="ex">例外オブジェクト</param>
        /// <param name="rcFxEventArgs">イベントハンドラの共通引数</param>
        /// <remarks>画面コード親クラス1から利用される派生の末端</remarks>
        protected override void UOC_ABEND(Exception ex, RcFxEventArgs rcFxEventArgs)
        {
            // 一般的な例外発生時の処理を実装
            // TODO:

            // 性能測定終了

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // ACCESSログ出力-----------------------------------------------

            if (MyBaseControllerWin.CanOutPutLog)
            {
                // ------------
                // メッセージ部
                // ------------
                // ユーザ名, レイヤ, 画面名, コントロール名,
                // 処理時間(実行時間), 処理時間(CPU時間)
                // エラーメッセージID, エラーメッセージ等
                // ------------
                string strLogMessage =
                    "," + UserInfo.UserName +
                    "," + "<-----" +
                    "," + this.Name +
                    "," + rcFxEventArgs.ControlName +
                    "," + this.perfRec.ExecTime +
                    "," + this.perfRec.CpuTime +
                    "," + "other Exception" +
                    "," + ex.Message +
                    "\r\n" + ex.ToString(); // ex

                // Log4Netへログ出力
                LogIF.ErrorLog("ACCESS", strLogMessage);
            }
            // -------------------------------------------------------------
        }
Beispiel #7
0
        /// <summary>例外処理</summary>
        protected override void UOC_ABEND(Exception ex)
        {
            // 性能測定終了

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // ACCESSログ出力-----------------------------------------------

            if (MyBaseAsyncFunc.CanOutPutLog)
            {
                // ------------
                // メッセージ部
                // ------------
                // ユーザ名, レイヤ, 画面名, コントロール名,
                // 処理時間(実行時間), 処理時間(CPU時間)
                // エラーメッセージ等
                // ------------
                string strLogMessage =
                    "," + "-" +
                    "," + "*-----" +
                    "," + this.UIElementName +
                    "," + this.AsyncFunc.Method.Name +
                    "," + this.perfRec.ExecTime +
                    "," + this.perfRec.CpuTime +
                    "," + ex.Message;

                // Log4Netへログ出力
                LogIF.WarnLog("ACCESS", strLogMessage);
            }

            // -------------------------------------------------------------
        }
Beispiel #8
0
        /// <summary>業務例外発生時の処理を実装</summary>
        /// <param name="baEx">BusinessApplicationException</param>
        /// <param name="fxEventArgs">イベントハンドラの共通引数</param>
        /// <remarks>画面コード親クラス1から利用される派生の末端</remarks>
        protected override void UOC_ABEND(BusinessApplicationException baEx, FxEventArgs fxEventArgs)
        {
            // 業務例外発生時の処理を実装
            // TODO:

            // ここに、メッセージの組み立てロジックを実装する。

            // メッセージ編集処理 ------------------------------------------

            string messageID          = baEx.messageID;
            string messageDescription = "";

            // メッセージIDから、対応するメッセージを取得する。
            messageDescription = GetMessage.GetMessageDescription(messageID);
            if (messageDescription == "")
            {
                // メッセージが取得できなかった場合
                messageDescription = baEx.Message;
            }
            else
            {
                // メッセージが取得できた場合、
                // 必要なら、メッセージに、可変文字列を組み込む。

                // 方式は、プロジェクト毎に検討のこと。
                messageDescription = messageDescription.Replace("%1", baEx.Message);
                messageDescription = messageDescription.Replace("%2", baEx.Information);
            }

            // -------------------------------------------------------------

            // メッセージ表示処理 ------------------------------------------

            #region メッセージボックスを使用して表示する場合。

            // 「OK」メッセージダイアログの表示処理
            this.ShowOKMessageDialog(
                messageID, messageDescription,
                FxEnum.IconType.Exclamation,
                "BusinessApplicationExceptionを使用したダイアログ表示");

            #endregion

            #region マスタ ページ上のラベルに表示する場合。

            //// 結果表示するメッセージ エリア
            //Label label = (Label)this.GetMasterWebControl("Label1");
            //label.Text = "";

            //// 結果(業務続行可能なエラー)
            //label.Text = "ErrorMessageID:" + baEx.messageID + "\r\n";
            //label.Text += "ErrorMessage:" + baEx.Message + "\r\n";
            //label.Text += "ErrorInfo:" + baEx.Information + "\r\n";

            #endregion

            // -------------------------------------------------------------

            // 性能測定終了

            // イベント処理開始前にエラーが発生した場合は、
            // this.perfRecがnullの場合があるので、null対策コードを挿入する。
            if (this.perfRec == null)
            {
                // nullの場合、新しいインスタンスを生成し、性能測定開始。
                this.perfRec = new PerformanceRecorder();
                perfRec.StartsPerformanceRecord();
            }

            this.perfRec.EndsPerformanceRecord();

            // 認証ユーザ情報を取得する ------------------------------------
            this.GetUserInfo();

            // ACCESSログ出力-----------------------------------------------

            // ------------
            // メッセージ部
            // ------------
            // ユーザ名, IPアドレス,
            // レイヤ, 画面名, コントロール名, 処理名
            // 処理時間(実行時間), 処理時間(CPU時間)
            // エラーメッセージID, エラーメッセージ等
            // ------------
            string strLogMessage =
                "," + UserInfo.UserName +
                "," + Request.UserHostAddress +
                "," + "<-----" +
                "," + this.ContentPageFileNoEx +
                "," + fxEventArgs.ButtonID +
                "," + "" +
                "," + this.perfRec.ExecTime +
                "," + this.perfRec.CpuTime +
                "," + baEx.messageID +
                "," + baEx.Message;

            // Log4Netへログ出力
            LogIF.WarnLog("ACCESS", strLogMessage);

            // -------------------------------------------------------------
        }
Beispiel #9
0
        /// <summary>Main</summary>
        static void Main(string[] args)
        {
            // コマンドラインをバラす関数がある。
            List <string> valsLst = null;
            Dictionary <string, string> argsDic = null;

            PubCmnFunction.GetCommandArgs('/', out argsDic, out valsLst);

            // 引数クラス値(B層実行用)
            string     screenId   = System.Reflection.Assembly.GetExecutingAssembly().Location;
            string     controlId  = "-";
            string     actionType = "SQL"; // argsDic["/DAP"] + "%" + argsDic["/MODE1"] + "%" + argsDic["/MODE2"] + "%" + argsDic["/EXROLLBACK"];
            MyUserInfo myUserInfo = new MyUserInfo("userName", "ipAddress");

            // B層クラス
            LayerB layerB = new LayerB();

            // ↓B層実行:主キー値を全て検索(ORDER BY 主キー)-----------------------------------------------------

            // 引数クラスを生成
            VoidParameterValue selectPkListParameterValue = new VoidParameterValue(screenId, controlId, "SelectPkList", actionType, myUserInfo);

            // B層呼出し
            SelectPkListReturnValue selectPkReturnValue = (SelectPkListReturnValue)layerB.DoBusinessLogic(selectPkListParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted);

            // 実行結果確認
            if (selectPkReturnValue.ErrorFlag == true)
            {
                // 結果(業務続行可能なエラー)
                string error = "ErrorMessageID:" + selectPkReturnValue.ErrorMessageID + "\r\n";
                error += "ErrorMessage:" + selectPkReturnValue.ErrorMessage + "\r\n";
                error += "ErrorInfo:" + selectPkReturnValue.ErrorInfo + "\r\n";

                Console.WriteLine(error);
                Console.ReadKey();
                return; //バッチ処理終了
            }

            // 戻り値取得
            ArrayList pkList = selectPkReturnValue.PkList;

            // ↑B層実行:主キー値を全て検索(ORDER BY 主キー)-----------------------------------------------------

            int recordCount      = pkList.Count;                                                                                      // 全レコード数
            int initialIndex     = 0;                                                                                                 // 処理開始インデックス ※ todo:リラン時に途中から再開する場合は初期値を変更する
            int transactionCount = Convert.ToInt32(Math.Ceiling(((double)(recordCount - initialIndex)) / INTERMEDIATE_COMMIT_COUNT)); // 更新B層実行回数

            // 性能測定
            // 性能測定 - 開始
            PerformanceRecorder pr = new PerformanceRecorder();

            pr.StartsPerformanceRecord();

            for (int transactionIndex = 0; transactionIndex < transactionCount; transactionIndex++)
            {
                ArrayList subPkList;       // 主キー一覧(1トランザクション分)
                int       subPkStartIndex; // 主キー(1トランザクション分)の開始位置
                int       subPkCount;      // 主キー数(1トランザクション分)

                // 取り出す主キーの開始、数を取得
                subPkStartIndex = initialIndex + (transactionIndex * INTERMEDIATE_COMMIT_COUNT);
                if (subPkStartIndex + INTERMEDIATE_COMMIT_COUNT - 1 > recordCount - 1)
                {
                    subPkCount = (recordCount - initialIndex) % INTERMEDIATE_COMMIT_COUNT;
                }
                else
                {
                    subPkCount = INTERMEDIATE_COMMIT_COUNT;
                }

                // 主キー一覧(1トランザクション分)を取り出す
                subPkList = new ArrayList();
                subPkList.AddRange(pkList.GetRange(subPkStartIndex, subPkCount));

                // ↓B層実行:バッチ処理を実行(1トランザクション分)----------------------------------------------------

                // 引数クラスを生成
                ExecuteBatchProcessParameterValue executeBatchProcessParameterValue = new ExecuteBatchProcessParameterValue(screenId, controlId, "ExecuteBatchProcess", actionType, myUserInfo);
                executeBatchProcessParameterValue.SubPkList = subPkList;

                // B層呼出し
                VoidReturnValue executeBatchProcessReturnValue = (VoidReturnValue)layerB.DoBusinessLogic(executeBatchProcessParameterValue, DbEnum.IsolationLevelEnum.ReadCommitted);

                // 実行結果確認
                if (selectPkReturnValue.ErrorFlag == true)
                {
                    // 結果(業務続行可能なエラー)
                    string error = "ErrorMessageID:" + selectPkReturnValue.ErrorMessageID + "\r\n";
                    error += "ErrorMessage:" + selectPkReturnValue.ErrorMessage + "\r\n";
                    error += "ErrorInfo:" + selectPkReturnValue.ErrorInfo + "\r\n";

                    Console.WriteLine(error);
                    Console.ReadKey();
                    return; // バッチ処理終了
                }

                // ↑B層実行:バッチ処理を実行(1トランザクション分)----------------------------------------------------
            }

            // 性能測定 - 終了
            Console.WriteLine(pr.EndsPerformanceRecord());
            Console.ReadKey();
        }