public HojoMototyouFormController()
        {
            mototyou = null;

            form = new KaikeiSystemBody.views.KanjouMototyouForm();
            form.SelectViewMode(views.KanjouMototyouForm.ViewMode.ViewHojoKamoku);

            form.SearchButtonClicked += SearchButtonClicked;
            form.ReturnButtonClicked += () => form.Close();

            form.RowDetailButtonClicked += delegate(int rowIndex) {
                var popupController = new popup.DenpyouInfoPopupController();
                popup.DenpyouInfoPopupController.Result result;
                result = popupController.ShowPopupModal(form, mototyou.GetDenpyouMeisaiRow(rowIndex), Context);
                if (result != popup.DenpyouInfoPopupController.Result.None)
                {
                    form.SaveGridScrollAndSelection();
                    RefreshView();
                    form.LoadGridScrollAndSelection();
                }
            };

            form.SetStatusMessage += delegate(string msg) {
                form.SetStatusbarMessage(msg);
            };
        }
        public KanjouMototyouFormController()
        {
            mototyou = null;

            form = new KaikeiSystemBody.views.KanjouMototyouForm();
            form.SelectViewMode(views.KanjouMototyouForm.ViewMode.ViewKamoku);

            form.SearchButtonClicked          += SearchButtonClicked;
            form.ReturnButtonClicked          += () => MainController.PopActivity();
            form.ShowDenpyouViewButtonClicked += () => MainController.SwitchActivity(
                controllers.MainController.ActivityType.KaikeiDenpyou,
                controllers.MainController.ActivitySwitchMethod.Change,
                Context,
                controllers.KaikeiDenpyouFormController.QueryType.CurrentYear);

            form.AddDenpyouButtonClicked += delegate() {
                var popupController = new popup.DenpyouInfoPopupController();
                popup.DenpyouInfoPopupController.Result result;
                var row = mototyou.MeisaiTable.NewRow();

                string wareki = Context.Setting.GetStr("before_gengou", "") +
                                Context.Setting.GetStr("before_year", "") + "/" +
                                Context.Setting.GetStr("before_month", "") + "/" +
                                Context.Setting.GetStr("before_day", "");
                if (helper.Converter.IsWareki(wareki))
                {
                    DateTime date = helper.Converter.DateStrToDateTime(wareki);
                    mototyou.MeisaiTable.SetKihyoubiAndDenpyouBangouCache(row, date);
                }

                result = popupController.ShowPopupModal(form, row, Context);
                if (result != popup.DenpyouInfoPopupController.Result.None)
                {
                    form.SaveGridScrollAndSelection();
                    RefreshView();
                    form.LoadGridScrollAndSelection();
                }
            };
            form.RowDetailButtonClicked += delegate(int rowIndex) {
                var popupController = new popup.DenpyouInfoPopupController();
                popup.DenpyouInfoPopupController.Result result;
                result = popupController.ShowPopupModal(form, mototyou.GetDenpyouMeisaiRow(rowIndex), Context);
                if (result != popup.DenpyouInfoPopupController.Result.None)
                {
                    form.SaveGridScrollAndSelection();
                    RefreshView();
                    form.LoadGridScrollAndSelection();
                }
            };
            form.PrintButtonClicked += delegate() {
                var popupController = new popup.KanjouMototyouPrintPopupController();
                popupController.ShowPopupModal(form, Context);
            };


            form.ShowHojoMototyouButtonClicked += delegate() {
                HojoMototyouFormController hojoController = new HojoMototyouFormController();
                hojoController.ShowDialog(Context,
                                          form.StartDate, form.EndDate, form.TargetKamokuCode, form.TargetKaikeiKubun);
            };

            form.SetStatusMessage += delegate(string msg) {
                form.SetStatusbarMessage(msg);
            };
        }