Exemple #1
0
        /// <summary>
        /// 節入り日基準データ取得
        /// </summary>
        /// <param name="baseYear"></param>
        /// <param name="baseMonth"></param>
        /// <param name="baseDay"></param>
        /// <param name="baseNenkansi"></param>
        /// <param name="baseGekkansi"></param>
        /// <param name="baseNikkansiSanshutuSu"></param>
        public void GetBaseSetuiribiData(ref int baseYear,
                                         ref int baseMonth,
                                         ref int baseDay,
                                         ref int baseNenkansi,
                                         ref int baseGekkansi,
                                         ref int baseNikkansiSanshutuSu
                                         )
        {
            var value = dicSetuiribiTbl.ToArray()[0];

            YearItem yearItem = value.Value;

            baseYear = yearItem.year;
            var item = yearItem.dicSetuiribi.ToArray()[0];

            baseMonth              = item.Key;
            baseDay                = item.Value;
            baseNenkansi           = CalcNenkansi(baseYear, baseMonth);
            baseGekkansi           = CalcGekkansi(baseYear, baseMonth);
            baseNikkansiSanshutuSu = CalcNikkansiSanshutuSu(baseYear, baseMonth, baseDay);

            /*
             *          using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"G:\Temp\test.csv",false) )
             *          {
             *              for (int y = 1937; y >= baseYear; y--)
             *              {
             *                  int year = y;
             *
             *                  int m = 2;
             *                  for (int i = 0; i < 12; i++)
             *                  {
             *                      if (m == 0)
             *                      {
             *                          m = 12;
             *                          year = y - 1;
             *                      }
             *
             *                      var baseNenkansiWk = CalcNenkansi(year, m);
             *                      var baseGekkansiWk = CalcGekkansi(year, m);
             *                      var baseNikkansiSanshutuSuWk = CalcNikkansiSanshutuSu(year, m);
             *
             *                      sw.WriteLine(string.Format("{0}/{1}, {2},{3},{4}", year, m, baseNenkansiWk, baseGekkansiWk, baseNikkansiSanshutuSuWk));
             *                      m--;
             *                  }
             *              }
             *          }
             */
        }
Exemple #2
0
        public static IList <YearItem> GetYearItems()
        {
            DateTime        dtSystem = SystemSetting.UPDATEDATE.Value;
            List <YearItem> listDict = new List <YearItem>();
            YearItem        item     = new YearItem();

            item.Text  = dtSystem.Year.ToString() + "年";
            item.Value = dtSystem.Year;

            YearItem item2 = new YearItem();

            item2.Text  = dtSystem.AddYears(1).Year.ToString() + "年";
            item2.Value = dtSystem.AddYears(1).Year;
            listDict.Add(item);
            listDict.Add(item2);
            return(listDict);
        }
Exemple #3
0
        /// <summary>
        /// 節入り日テーブル(Excel)読み込み
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public int ReadTable(string filePath)
        {
            var version  = "xls";
            var workbook = ExcelReader.GetWorkbook(filePath, version);

            if (workbook == null)
            {
                return(-1);
            }

            var sheet = workbook.GetSheetAt(0);

            //1行目(月)取得
            for (int idxCol = 0; idxCol < 12; idxCol++)
            {
                var value = ExcelReader.CellValue(sheet, 0, idxCol + 1);
                lstColMonth.Add(int.Parse(value));
            }
            //2行目以降、年毎の節入り日取得
            int iRow = 1;

            while (true)
            {
                YearItem item = new YearItem();
                //年
                var sYear = ExcelReader.CellValue(sheet, iRow, 0);
                if (sYear == "")
                {
                    break;
                }
                item.year = int.Parse(sYear);

                //節入り日
                for (int idxCol = 0; idxCol < 12; idxCol++)
                {
                    int day = int.Parse(ExcelReader.CellValue(sheet, iRow, idxCol + 1));

                    item.dicSetuiribi.Add(lstColMonth[idxCol], day);
                }

                dicSetuiribiTbl.Add(item.year, item);
                iRow++;
            }
            return(0);
        }