Esempio n. 1
0
 public DeltaBooks()
 {
     Date           = DateTime.Now;
     StartDate      = DateTime.Now;
     DaysSinceStart = 0;
     OverallTally   = new TallyDelta();
     LastTenTally   = new TallyDelta();
     LanguageTotals = new CategoryTotal[] { };
     CountryTotals  = new CategoryTotal[] { };
 }
Esempio n. 2
0
        public DeltaBooks(BooksDelta booksDelta)
        {
            Date           = booksDelta.Date;
            StartDate      = booksDelta.StartDate;
            DaysSinceStart = booksDelta.DaysSinceStart;
            OverallTally   = new TallyDelta(booksDelta.OverallTally);
            LastTenTally   = new TallyDelta(booksDelta.LastTenTally);

            int languageTotalsCount = booksDelta.OverallTally.LanguageTotals.Count;

            LanguageTotals = new CategoryTotal[languageTotalsCount];
            for (int i = 0; i < languageTotalsCount; i++)
            {
                var languageTotal = booksDelta.OverallTally.LanguageTotals[i];
                LanguageTotals[i] =
                    new CategoryTotal
                {
                    Name            = languageTotal.Item1,
                    TotalBooks      = (int)languageTotal.Item2,
                    PercentageBooks = (float)languageTotal.Item3,
                    TotalPages      = (int)languageTotal.Item4,
                    PercentagePages = (float)languageTotal.Item5
                };
            }


            int countryTotalsCount = booksDelta.OverallTally.CountryTotals.Count;

            CountryTotals = new CategoryTotal[countryTotalsCount];
            for (int i = 0; i < countryTotalsCount; i++)
            {
                var countryTotal = booksDelta.OverallTally.CountryTotals[i];
                CountryTotals[i] =
                    new CategoryTotal
                {
                    Name            = countryTotal.Item1,
                    TotalBooks      = (int)countryTotal.Item2,
                    PercentageBooks = (float)countryTotal.Item3,
                    TotalPages      = (int)countryTotal.Item4,
                    PercentagePages = (float)countryTotal.Item5
                };
            }
        }