Exemple #1
0
        private List <SystemsCountModel> FillFiveYearsBeforeAndAfter(List <SystemsCountModel> eachSystemCount, int year)
        {
            var eachYearsCount = new List <SystemsCountModel>();
            int baseYear       = year - 5;
            int maxYear        = 11;

            foreach (var system in this._context.System)
            {
                for (int i = 0; i < maxYear; i++)
                {
                    var inquiry = eachSystemCount.Where(inquiry => inquiry.System.Id == system.Id).Where(inquiry => inquiry.YearOrMonth == baseYear + i);
                    if (inquiry.Any())
                    {
                        eachYearsCount.Add(inquiry.First());
                    }
                    else
                    {
                        var eachYears = new SystemsCountModel()
                        {
                            System       = system,
                            YearOrMonth  = baseYear + i,
                            InquiryCount = 0
                        };

                        eachYearsCount.Add(eachYears);
                    }
                }
            }

            return(eachYearsCount);
        }
Exemple #2
0
        private List <SystemsCountModel> FillMonth(List <SystemsCountModel> eachSystemCount)
        {
            var eachSystemMonthlyCount = new List <SystemsCountModel>();

            // 各システム毎に、1~12月まででデータがないものについて、仮データ(件数ゼロ)をセットする。
            foreach (var system in this._context.System)
            {
                for (var month = 1; month <= 12; month++)
                {
                    var inquiry = eachSystemCount.Where(inquiry => inquiry.System.Id == system.Id).Where(inquiry => inquiry.YearOrMonth == month);
                    if (inquiry.Any())
                    {
                        eachSystemMonthlyCount.Add(inquiry.First());
                    }
                    else
                    {
                        var eachMonth = new SystemsCountModel()
                        {
                            System       = system,
                            YearOrMonth  = month,
                            InquiryCount = 0
                        };

                        eachSystemMonthlyCount.Add(eachMonth);
                    }
                }
            }

            return(eachSystemMonthlyCount);
        }