Beispiel #1
0
        public List <ReportByDate_Result> ReportByYear(int year)
        {
            var listMonth = new List <ReportByDate_Result>();
            var listYear  = new List <ReportByDate_Result>();

            for (int i = 1; i < 13; i++)
            {
                var rp = new ReportByDate_Result();
                listMonth = ReportByMonth(i, year);

                rp.TOTAL_TICKED = listMonth.Sum(t => t.TOTAL_TICKED);
                rp.TOTAL_PRICE  = listMonth.Sum(t => t.TOTAL_PRICE);

                listYear.Add(rp);
            }

            return(listYear);
        }
Beispiel #2
0
        public List <ReportByDate_Result> ReportByMonth(int month, int year)
        {
            ReportByDate_Result rp = new ReportByDate_Result();
            var    list            = new List <ReportByDate_Result>();
            int    count           = DateTime.DaysInMonth(year, month);
            string date            = "";

            for (int i = 1; i <= count; i++)
            {
                if (month < 10)
                {
                    if (i < 10)
                    {
                        date = "0" + i + "/0" + month + "/" + year;
                    }
                    else
                    {
                        date = i + "/0" + month + "/" + year;
                    }

                    rp = _database.ReportByDate(date).SingleOrDefault();
                    list.Add(rp);
                }
                else
                {
                    if (i < 10)
                    {
                        date = "0" + i + "/" + month + "/" + year;
                    }
                    else
                    {
                        date = i + "/" + month + "/" + year;
                    }

                    rp = _database.ReportByDate(date).SingleOrDefault();
                    list.Add(rp);
                }
            }

            return(list);
        }