private void TbPassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                int           userId = int.Parse(config.AppSettings.Settings["UserId"].Value);

                // ログイン認証チェック
                User user      = User.SelectUserFromId(userId);
                bool isSuccess = PasswordManager.VerifyPassword(user.Password, TbPassword.Text, user.Salt);

                // ログイン合否によって処理分岐
                if (isSuccess)
                {
                    OriginMBox.MBoxInfoOK(AppConst.LOGIN_SUCCESS);
                    controller.User = user;
                    Hide();
                    MainHouseholdABookForm bookForm = new MainHouseholdABookForm(controller);
                    if (bookForm.ShowDialog() != DialogResult.OK)
                    {
                        Close();
                    }
                }
                else
                {
                    OriginMBox.MBoxErrorOK(AppConst.LOGIN_ERROR);
                }
            }
        }
Beispiel #2
0
        private void BtnContinue_Click(object sender, EventArgs e)
        {
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int           userId = int.Parse(config.AppSettings.Settings["UserId"].Value);

            if (!string.IsNullOrEmpty(TbAssets.Text) && !string.IsNullOrEmpty(TbClassification.Text) &&
                !string.IsNullOrEmpty(TbDate.Text) && !string.IsNullOrEmpty(TbMoney.Text) && !string.IsNullOrEmpty(TbContent.Text))
            {
                TbMoney.Text = TbMoney.Text.Replace(",", "").Remove(0, 1);
                if (int.Parse(TbMoney.Text) > 0 && !string.IsNullOrWhiteSpace(TbContent.Text))
                {
                    //家計簿ベースデータ新規登録
                    if (HouseholdABookBase.InsertHouseholdABookBase(isIncomeOrSpending ? 1 : 0,
                                                                    DateTime.Parse(TbDate.Text), TbAssets.Text, TbClassification.Text,
                                                                    int.Parse(TbMoney.Text), TbContent.Text, userId))
                    {
                        OriginMBox.MBoxInfoOK("新規データ登録完了");
                    }

                    //非表示してから再表示
                    Hide();
                    TbAssets.Text         = "";
                    TbClassification.Text = "";
                    TbMoney.Text          = "";
                    string[] timeList = { DateTime.Now.Year.ToString("0000"), DateTime.Now.Month.ToString("00"),
                                          DateTime.Now.Day.ToString("00"),    DateTime.Now.Hour.ToString("00"), DateTime.Now.Minute.ToString("00") };
                    TbDate.Text    = string.Format(AppConst.TIME_STR, timeList);
                    TbContent.Text = "";
                    Show();
                }
            }
        }
        private void BtnToastSend_Click(object sender, EventArgs e)
        {
            if (CbToastUseFlg.Checked)
            {
                if (int.Parse(TbAddHour.Text) == 0)
                {
                    var result = OriginMBox.MBoxInfoOKCancel(AppConst.TOAST_HOUR_ERR);
                    if (result != DialogResult.OK)
                    {
                        return;
                    }
                }
                else if (int.Parse(TbAddMinute.Text) == 0)
                {
                    var result = OriginMBox.MBoxInfoOKCancel(AppConst.TOAST_MINUTE_ERR);
                    if (result != DialogResult.OK)
                    {
                        return;
                    }
                }

                CreateScheduleToast();

                OriginMBox.MBoxInfoOK(AppConst.TOAST_SUCCESS);
                Close();
            }
            else
            {
                OriginMBox.MBoxErrorOK(AppConst.TOAST_USEFLG_OFF);
            }
        }
Beispiel #4
0
        /// <summary>
        /// PDF作成時
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnPDFCreateor_Click(object sender, EventArgs e)
        {
            //pdf作成処理
            PDFCreator.GetInstance().Init("result.pdf");

            string dayStr     = "";
            int    periodType = CbPeriod.SelectedIndex;

            switch (periodType)
            {
            case (int)PeriodType.Monthly:
                dayStr = DTPickerBreakdown.Value.ToString(AppConst.DTP_MONTH_TIMESTR);
                break;

            case (int)PeriodType.Year:
                dayStr = DTPickerBreakdown.Value.ToString(AppConst.DTP_YEAR_TIMESTR);
                break;

            case (int)PeriodType.Period:
                dayStr = DTPickerBreakdown.Value.ToString(AppConst.DTP_DAY_TIMESTR)
                         + "~" + DTPickerBreakdown02.Value.ToString(AppConst.DTP_DAY_TIMESTR);
                break;
            }

            string    classifStr = CbClassification.Text;
            string    periodStr  = CbPeriod.Text;
            DataTable dataTable  = MakeDataTable(statisticsLists);

            PDFCreator.GetInstance().Create(dayStr, classifStr, periodStr, dataTable, DateTime.Now.ToString("yyyyMMdd"));

            OriginMBox.MBoxInfoOK(AppConst.PDF_SUCCESS_MESSAGE);
        }
        static void Main()
        {
            //二重起動防止処理
            //Mutex名を決める(必ずアプリケーション固有の文字列に変更すること!)
            string mutexStr = Application.ProductName;
            //Mutexオブジェクトを作成する
            Mutex mutex = new Mutex(false, mutexStr);

            bool hasHandle = false;

            try
            {
                //ミューテックスの所有権を要求する
                hasHandle = mutex.WaitOne(0, false);

                if (hasHandle == false)
                {
                    OriginMBox.MBoxWarningOK(AppConst.MUTEX_MESSAGE);
                    return;
                }

                AppController appController = new AppController();
                appController.Init();

                if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["UserId"].ToString()) &&
                    string.IsNullOrEmpty(ConfigurationManager.AppSettings["HashPassword"].ToString()))
                {
                    LoginCreate loginCreate = new LoginCreate(appController);
                    if (loginCreate.ShowDialog() == DialogResult.OK)
                    {
                        OriginMBox.MBoxInfoOK(AppConst.USER_MESSAGE);
                    }
                    else
                    {
                        return;
                    }
                }

                Application.EnableVisualStyles();
                Application.Run(GetMainForm(appController));
            }
            catch (AbandonedMutexException e)
            {
                string s = e.Message;
                OriginMBox.MBoxErrorOK(s);
                //別のアプリケーションがミューテックスを解放しないで終了した時
                hasHandle = true;
            }
            finally
            {
                if (hasHandle)
                {
                    //ミューテックスを解放する
                    mutex.ReleaseMutex();
                }
                mutex.Close();
            }
        }
Beispiel #6
0
        /// <summary>
        /// 日付の指定によってベースDBからデータ取得
        /// </summary>
        /// <returns>家計簿ベースデータ</returns>
        private List <HouseholdABookBase.HouseholdABook> FindHouseholdABookList()
        {
            List <HouseholdABookBase.HouseholdABook> dataList = new List <HouseholdABookBase.HouseholdABook>();
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int           userId = int.Parse(config.AppSettings.Settings["UserId"].Value);

            if (!DTPickerBreakdown.Visible && !DTPickerBreakdown02.Visible)
            {
                return(null);
            }
            else if (DTPickerBreakdown.Visible && !DTPickerBreakdown02.Visible)
            {
                DateTime start = new DateTime();
                DateTime end   = new DateTime();
                //月間
                if (CbPeriod.SelectedIndex == (int)PeriodType.Monthly)
                {
                    start = new DateTime(DTPickerBreakdown.Value.Year, DTPickerBreakdown.Value.Month, 1);
                    if (start.Month >= 12)
                    {
                        end = new DateTime(DTPickerBreakdown.Value.AddYears(1).Year, DTPickerBreakdown.Value.AddMonths(1).Month, 1);
                    }
                    else
                    {
                        end = new DateTime(DTPickerBreakdown.Value.Year, DTPickerBreakdown.Value.AddMonths(1).Month, 1);
                    }
                }
                //年間
                else if (CbPeriod.SelectedIndex == (int)PeriodType.Year)
                {
                    start = new DateTime(DTPickerBreakdown.Value.Year, 1, 1);
                    end   = new DateTime(DTPickerBreakdown.Value.AddYears(1).Year, 1, 1);
                }

                dataList = HouseholdABookBase.SelectHouseholdABookBase(CbClassification.SelectedIndex, start, end, userId);
            }
            //期間指定
            else if (DTPickerBreakdown.Visible && DTPickerBreakdown02.Visible)
            {
                if (DTPickerBreakdown.Value > DTPickerBreakdown02.Value)
                {
                    OriginMBox.MBoxInfoOK(AppConst.STATISTICSDATE_MESSAGE);
                    DTPickerBreakdown.Value = DTPickerBreakdown02.Value;
                    return(null);
                }

                dataList = HouseholdABookBase.SelectHouseholdABookBase(CbClassification.SelectedIndex,
                                                                       DTPickerBreakdown.Value, DTPickerBreakdown02.Value, userId);
            }
            return(dataList);
        }
Beispiel #7
0
        /// <summary>
        /// 期間ごとの収入と支出と合計の設定
        /// </summary>
        /// <param name="start">スタート期間</param>
        /// <param name="end">エンド期間</param>
        /// <returns></returns>
        private void SetPropertyManagementList(DateTime start, DateTime end)
        {
            List <int>    list   = new List <int>();
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int           userId = int.Parse(config.AppSettings.Settings["UserId"].Value);

            //最小値の時は全データを取得する
            if (start == DateTime.MinValue && end == DateTime.MinValue)
            {
                list = HouseholdABookBase.SelectPropManageList(userId);
            }
            //そのほかは期間ごとに取得
            else
            {
                list = HouseholdABookBase.SelectPropManageList(start, end, userId);
            }

            if (list.Count <= 0)
            {
                OriginMBox.MBoxInfoOK("データが存在しません。"); return;
            }

            //リストクリア
            LbIncome.Items.Clear();
            LbSpending.Items.Clear();
            LbSettlement.Items.Clear();

            //TODO 金額の桁数によって位置を調整する
            //収入と支出と合計
            LbIncome.Items.Add("    " + AppConst.INCOME);
            LbIncome.Items.Add("      " + list[AppConst.INCOME_VALUE]);

            LbSpending.Items.Add("    " + AppConst.SPENDING);
            LbSpending.Items.Add("      " + list[AppConst.SPENDING_VALUE]);

            LbSettlement.Items.Add("    " + "合計");
            //合計がマイナスの値のとき
            if (list[AppConst.SUM_VALUE] < 0)
            {
                LbSettlement.ForeColor = System.Drawing.Color.Red;
                LbSettlement.Items.Add("      " + list[AppConst.SUM_VALUE]);
            }
            else
            {
                LbSettlement.Items.Add("      " + list[AppConst.SUM_VALUE]);
            }
        }
Beispiel #8
0
        private void LoginYesOrNo()
        {
            //入力チェック
            if (string.IsNullOrEmpty(TbUserName.Text))
            {
                OriginMBox.MBoxErrorOK(AppConst.USER_INPUT_ERROR);
                return;
            }
            if (string.IsNullOrEmpty(TbPassword.Text))
            {
                OriginMBox.MBoxErrorOK(AppConst.PASSWORD_INPUT_ERROR);
                return;
            }

            // ログイン認証チェック
            Configuration config    = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int           userId    = int.Parse(config.AppSettings.Settings["UserId"].Value);
            User          user      = User.SelectUserFromId(userId);
            bool          isSuccess = PasswordManager.VerifyPassword(user.Password, TbPassword.Text, user.Salt);

            // ログイン合否によって処理分岐
            if (isSuccess)
            {
                OriginMBox.MBoxInfoOK(AppConst.LOGIN_SUCCESS);
                controller.User = user;
                Hide();
                MainHouseholdABookForm bookForm = new MainHouseholdABookForm(controller);
                if (bookForm.ShowDialog() != DialogResult.OK)
                {
                    Close();
                }
            }
            else
            {
                OriginMBox.MBoxErrorOK(AppConst.LOGIN_ERROR);
            }
        }
Beispiel #9
0
        /// <summary>
        /// AcrobatReader起動(ブラウザ起動)
        /// </summary>
        /// <param name="isAcrobatReader">AcrobatReaderがインストールされているかどうか</param>
        /// <param name="pdfName">PDFファイル名</param>
        public void Preview(bool isAcrobatReader, string pdfName)
        {
            try
            {
                string           exeFile = "";
                ProcessStartInfo psi     = new ProcessStartInfo();

                //AcrobatReaderがあるかどうか
                if (isAcrobatReader && File.Exists(PDF_ACROBAT_READER))
                {
                    OriginMBox.MBoxInfoOK(AppConst.PDF_DC_MESSAGE);
                    exeFile = PDF_ACROBAT_READER;
                    //コマンドライン引数を指定する
                    psi.Arguments = pdfName;
                }
                //ブラウザで開く
                else
                {
                    OriginMBox.MBoxInfoOK(AppConst.PDF_BROWSER_MESSAGE);
                    exeFile       = pdfName;
                    psi.Arguments = "";
                }

                //起動するファイルのパスを指定する
                psi.FileName = exeFile;

                Process p = Process.Start(psi);
                p.WaitForExit();              // プロセスの終了を待つ
                int iExitCode = p.ExitCode;   // 終了コード
            }
            catch (Exception e)
            {
                string s = e.Message;
                OriginMBox.MBoxErrorOK(AppConst.PDF_ERROR_MESSAGE);
            }
        }
        private void BtnOk_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TbPassword.Text))
            {
                OriginMBox.MBoxErrorOK(AppConst.PASSWORD_INPUT_ERROR);
                return;
            }

            // コントロール有り無しで動作を変更
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int           userId = int.Parse(config.AppSettings.Settings["UserId"].Value);

            if (controller == null)
            {
                // パスワード変更前に以前のユーザー情報取得
                User beforeUserInfo = User.SelectUserFromId(userId);
                // パスワード変更処理のため、パスワード再作成
                (string hashed, string salt) = PasswordManager.HashPassword(TbPassword.Text);

                // 以前のパスワードと更新パスワードが同一かどうか確認
                bool isSame = hashed != beforeUserInfo.Password;
                if (!isSame)
                {
                    OriginMBox.MBoxErrorOK(AppConst.PASSWORD_BEFORE_ERROR);
                }

                User updateUser = User.UpdatePasswordAndSalt(userId, hashed, salt);
                if (updateUser == null)
                {
                    return;
                }

                // 更新パスワードがあっているかどうか
                bool isSuccess = PasswordManager.VerifyPassword(updateUser.Password, TbPassword.Text, updateUser.Salt);
                if (isSuccess && !string.IsNullOrEmpty(config.AppSettings.Settings["HashPassword"].Value))
                {
                    config.AppSettings.Settings["HashPassword"].Value = updateUser.Password;
                    config.Save();
                    OriginMBox.MBoxInfoOK(AppConst.PASSWORD_UPDATE_SUCCESS);
                    this.DialogResult = DialogResult.OK;
                }
                else if (isSuccess)
                {
                    OriginMBox.MBoxInfoOK(AppConst.PASSWORD_UPDATE_SUCCESS);
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.DialogResult = DialogResult.Cancel;
                }

                Close();
            }
            else
            {
                // ログイン認証チェック
                User user      = User.SelectUserFromId(userId);
                bool isSuccess = PasswordManager.VerifyPassword(user.Password, TbPassword.Text, user.Salt);

                // ログイン合否によって処理分岐
                if (isSuccess)
                {
                    OriginMBox.MBoxInfoOK(AppConst.LOGIN_SUCCESS);
                    controller.User = user;
                    Hide();
                    MainHouseholdABookForm bookForm = new MainHouseholdABookForm(controller);
                    if (bookForm.ShowDialog() != DialogResult.OK)
                    {
                        Close();
                    }
                }
                else
                {
                    OriginMBox.MBoxErrorOK(AppConst.LOGIN_ERROR);
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 画像作成時
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnImageCreateor_Click(object sender, EventArgs e)
        {
            //画像作成処理

            //①画面のスクリーンショットを作成
            //②保存ダイアログで保存する場所を指定
            //③画面のスクリーンショットを保存
            //④円グラフ画像作成(後ほど使う)

            //画面全体のイメージをクリップボードにコピー
            SendKeys.SendWait("%{PRTSC}");
            //クリップボードにあるデータの取得
            IDataObject d = Clipboard.GetDataObject();

            //クリップボードにデータがあったか確認
            if (d != null)
            {
                //ビットマップデータ形式に関連付けられているデータを取得
                Image img = (Image)d.GetData(DataFormats.Bitmap);
                if (img != null)
                {
                    //データが取得できたときは保存ダイアログ表示
                    SaveFileDialog sfd      = new SaveFileDialog();
                    string         fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "_Data.png";
                    sfd.FileName         = fileName;
                    sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                    sfd.Filter           = "PNGファイル(*.png)|*.png";
                    sfd.FilterIndex      = 1;
                    sfd.Title            = "保存先を選択してください";
                    sfd.RestoreDirectory = true;
                    //ダイアログを表示する
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        //OKボタンがクリックされたとき、選択されたファイル名を表示する
                        Console.WriteLine(sfd.FileName);
                        img.Save(sfd.FileName);
                    }
                    else
                    {
                        OriginMBox.MBoxInfoOK(AppConst.IMAGE_CANCEL_MESSAGE);
                        return;
                    }

                    //画面のイメージデータは大きいため、
                    //用がなくなればクリップボードから削除した方がいいかもしれない
                    Clipboard.SetDataObject(new DataObject());
                }
            }

            //円グラフのデータは作成しておく
            Bitmap    bmp       = new Bitmap(pChartStatistics2.Width, pChartStatistics2.Height);
            Rectangle rectangle =
                new Rectangle(new System.Drawing.Point(0, 0),
                              new System.Drawing.Size(pChartStatistics2.Width, pChartStatistics2.Height));

            pChartStatistics2.DrawToBitmap(bmp, rectangle);
            string pieFileName = System.IO.Path.Combine(AppConst.GRAPH_IMAGE_FILE_DIR,
                                                        DateTime.Now.ToString("yyyyMMddHHmmss") + "_Pie.png");

            bmp.Save(pieFileName);

            OriginMBox.MBoxInfoOK(AppConst.IMAGE_SUCCESS_MESSAGE);
        }
Beispiel #12
0
        /// <summary>
        /// 月の項目作成
        /// </summary>
        /// <returns></returns>
        private List <ListViewItem> MonthCreateItems()
        {
            List <ListViewItem> viewItems = new List <ListViewItem>();

            // データ取得
            Configuration        config         = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int                  userId         = int.Parse(config.AppSettings.Settings["UserId"].Value);
            List <MonthDataList> monthDataLists = MonthDataList.SelectDisplayList(DTPickerBreakdown.Value.Year, userId);

            // 最初に見たとき
            if (monthDataLists == null)
            {
                DateTime start = new DateTime(DTPickerBreakdown.Value.Year, 1, 1);
                DateTime end   = new DateTime(DTPickerBreakdown.Value.Year, 12, DateTime.DaysInMonth(DTPickerBreakdown.Value.Year, 12));

                //月ごとのベースデータ取得
                List <int[]> dataLists = HouseholdABookBase.SelectMonthDatasCreate(start, end, userId);
                if (!(dataLists[0].Any(x => x > 0) || dataLists[1].Any(x => x > 0)))
                {
                    OriginMBox.MBoxInfoOK("当年のデータが作成されていません。データ作成画面でデータ作成してください。");
                    return(new List <ListViewItem>());
                }

                monthDataLists = MonthDataList.CreateMonthDataList(dataLists, DateTime.Now, userId);
                if (!MonthDataList.InsertMonthDataList(monthDataLists))
                {
                    OriginMBox.MBoxErrorOK("月ごとの収入と支出データ作成に失敗しました。");
                    return(new List <ListViewItem>());
                }
            }
            else
            {
                DateTime start = new DateTime(DTPickerBreakdown.Value.Year, 1, 1);
                DateTime end   = new DateTime(DTPickerBreakdown.Value.Year, 12, DateTime.DaysInMonth(DTPickerBreakdown.Value.Year, 12));

                //月ごとのベースデータ取得
                List <int[]> dataLists = HouseholdABookBase.SelectMonthDatasCreate(start, end, userId);
                if (!(dataLists[0].Any(x => x > 0) || dataLists[1].Any(x => x > 0)))
                {
                    OriginMBox.MBoxInfoOK("当年のデータが作成されていません。データ作成画面でデータ作成してください。");
                    return(new List <ListViewItem>());
                }

                // 二度目以降は最新データかによって処理分け
                if (!MonthDataList.IsNewMonthDataList(monthDataLists, dataLists))
                {
                    monthDataLists = MonthDataList.CreateMonthDataList(dataLists, monthDataLists.Select(x => x.CreateDate).FirstOrDefault(), userId);
                    if (!MonthDataList.UpdateMonthDataList(monthDataLists))
                    {
                        OriginMBox.MBoxErrorOK("月ごとの収入と支出データ更新に失敗しました。");
                        return(new List <ListViewItem>());
                    }
                }
            }

            List <string[]> dataStrList = MonthDataList.GetDisplayDataList(monthDataLists);

            for (int i = 0; i < dataStrList.Count; i++)
            {
                ListViewItem listView = new ListViewItem(dataStrList[i])
                {
                    //フォント設定使用出来るようにする
                    UseItemStyleForSubItems = false
                };

                //収入と支出データで色分け
                listView.SubItems[1].ForeColor = System.Drawing.Color.Blue;
                listView.SubItems[2].ForeColor = System.Drawing.Color.Red;

                viewItems.Add(listView);
            }

            return(viewItems);
        }
Beispiel #13
0
        /// <summary>
        /// 週の項目作成
        /// </summary>
        /// <returns></returns>
        private List <ListViewItem> WeekCreateItems()
        {
            List <ListViewItem> viewItems = new List <ListViewItem>();

            DateTime startDate = new DateTime(DTPickerBreakdown.Value.Year
                                              , DTPickerBreakdown.Value.Month, 1);
            DateTime endDate = new DateTime(DTPickerBreakdown.Value.Year
                                            , DTPickerBreakdown.Value.Month, DateTime.DaysInMonth(startDate.Year, startDate.Month));

            //データ取得
            Configuration       config        = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            int                 userId        = int.Parse(config.AppSettings.Settings["UserId"].Value);
            List <WeekDataList> weekDataLists = WeekDataList.SelectDisplayList(startDate, endDate.AddDays(1), userId);

            //データが存在しない場合、データ集計して週ごとの収入と支出データ作成
            if (weekDataLists == null)
            {
                //月始めから月終わりまでのベースデータ取得
                List <int[]> dataLists = HouseholdABookBase.SelectHouseholdABooks(startDate, endDate.AddDays(1), userId);
                if (dataLists == null)
                {
                    OriginMBox.MBoxInfoOK("当月のデータが作成されていません。データ作成画面でデータ作成してください。");
                    return(new List <ListViewItem>());
                }

                weekDataLists = WeekDataList.CreateWeekDataList(dataLists, WeekDataList.GetDateTimes(startDate, endDate), userId);
                if (!WeekDataList.InsertWeekDataList(weekDataLists))
                {
                    OriginMBox.MBoxErrorOK("週ごとの収入と支出データ作成に失敗しました。");
                    return(null);
                }
            }
            else
            {
                //月ごとのベースデータ取得
                List <int[]> dataLists = HouseholdABookBase.SelectHouseholdABooks(startDate, endDate.AddDays(1), userId);
                if (dataLists == null)
                {
                    OriginMBox.MBoxInfoOK("当月のデータが作成されていません。データ作成画面でデータ作成してください。");
                    return(new List <ListViewItem>());
                }

                // 二度目以降は最新データかによって処理分け
                weekDataLists = WeekDataList.CreateWeekDataList(dataLists, WeekDataList.GetDateTimes(startDate, endDate), userId);
                if (!WeekDataList.UpdateWeekDataList(weekDataLists))
                {
                    OriginMBox.MBoxErrorOK("週ごとの収入と支出データ更新に失敗しました。");
                    return(new List <ListViewItem>());
                }
            }

            List <string[]> dataStrList = WeekDataList.GetDisplayDataList(weekDataLists);

            for (int i = 0; i < dataStrList.Count; i++)
            {
                ListViewItem listView = new ListViewItem(dataStrList[i])
                {
                    //フォント設定使用出来るようにする
                    UseItemStyleForSubItems = false
                };

                //収入と支出データで色分け
                listView.SubItems[1].ForeColor = System.Drawing.Color.Blue;
                listView.SubItems[2].ForeColor = System.Drawing.Color.Red;

                viewItems.Add(listView);
            }

            return(viewItems);
        }