/// <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); }
/// <summary> /// 1日ごとの項目作成 /// </summary> private List <ListViewItem> OneDayCreateItems() { List <ListViewItem> viewItems = new List <ListViewItem>(); List <HouseholdABookBase.HouseholdABook> householdsList = new List <HouseholdABookBase.HouseholdABook>(); //データ取得 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); int userId = int.Parse(config.AppSettings.Settings["UserId"].Value); householdsList = HouseholdABookBase.SelectHouseholdABookBase(userId); for (int i = 0; i < householdsList.Count; i++) { string[] items = householdsList[i].GetHouseholdABookList(); ListViewItem listView = new ListViewItem(items); //フォント設定使用出来るようにする listView.UseItemStyleForSubItems = false; //金額をタイプごとに色変更 const int MONEY_NUM = 3; if (householdsList[i].idStr == AppConst.INCOME) { listView.SubItems[MONEY_NUM].ForeColor = System.Drawing.Color.Blue; } else { listView.SubItems[MONEY_NUM].ForeColor = System.Drawing.Color.Red; } viewItems.Add(listView); } return(viewItems); }