コード例 #1
0
        private void AttachTotal(WeekReportModel report)
        {
            DailyReportModel day         = report.DailyReports.FirstOrDefault();
            DailyReportModel totalForDay = new DailyReportModel(report);

            foreach (var dept in day.SectionsPerDepartment)
            {
                var totalForDepartment = new DepartmentSection(totalForDay);
                totalForDepartment.Department = dept.Department;
                totalForDay.SectionsPerDepartment.Add(totalForDepartment);

                foreach (var bank in dept.BankSections)
                {
                    if (bank.IsTotalPerDay)
                    {
                        var totalForBank = new DayTotal(totalForDepartment);
                        totalForBank.Bank = new Bank()
                        {
                            Id = 0, BankName = "Sub Total"
                        };
                        totalForDepartment.BankSections.Add(totalForBank);
                    }
                    else
                    {
                        var totalForBank = new WeekTotalForBank(totalForDepartment);
                        totalForBank.Bank = bank.Bank;
                        totalForDepartment.BankSections.Add(totalForBank);
                    }
                }
            }

            report.DailyReports.Add(totalForDay);
        }
コード例 #2
0
        private List <BankSection> BanksInEntireWeek()
        {
            List <BankSection> banksInEntireWeek = new List <BankSection>();
            WeekReportModel    parent            = GetParentWeeklyReport();

            foreach (var day in parent.DailyReports.Where(d => !d.IsTotalForEntireWeek).ToList())
            {
                foreach (var dept in day.SectionsPerDepartment)
                {
                    List <BankSection> banksInDepartment = dept.BankSections.Where(b => b.Bank.Id == Bank.Id).ToList();
                    banksInEntireWeek.AddRange(banksInDepartment);
                }
            }

            return(banksInEntireWeek);
        }
コード例 #3
0
        public WeekReportModel GetWeekly(ReportParameter param)
        {
            List <DateTime>         daysInWeek = GenerateTheDaysWithinThisRange(param.From, param.To);
            List <DailyReportModel> reports    = new List <DailyReportModel>();

            foreach (var day in daysInWeek)
            {
                param.Day = day;
                reports.Add(GetDaily(param));
            }

            WeekReportModel weeklyReport = new WeekReportModel();

            weeklyReport.From         = param.From;
            weeklyReport.To           = param.To;
            weeklyReport.DailyReports = reports;

            AttachTotal(weeklyReport);

            return(weeklyReport);
        }
コード例 #4
0
 public DailyReportModel(WeekReportModel weeklyReport)
 {
     _weeklyReport         = weeklyReport;
     SectionsPerDepartment = new List <DepartmentSection>();
 }