Esempio n. 1
0
 public TeamDayHandler(int year, Data data)
 {
     Year     = year;
     Data     = data;
     Holidays = DateSystem.GetPublicHoliday(Year, CountryCode.SE);
     SetupTeamDays();
 }
Esempio n. 2
0
        public ActionResult Country(string countrycode, int year = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }

            CountryCode countryCode;

            if (!Enum.TryParse(countrycode, true, out countryCode))
            {
                return(View("NotFound"));
            }

            ViewBag.Country     = EnumExtension.GetEnumDescription(countryCode).ToString();
            ViewBag.CountryCode = countrycode;
            ViewBag.Year        = year;
            ViewBag.NextYear    = year + 1;

            var publicHolidays = DateSystem.GetPublicHoliday(countryCode, year);

            if (publicHolidays?.Count() > 0)
            {
                return(View(publicHolidays));
            }

            return(View("NotFound"));
        }
Esempio n. 3
0
        public void TestRomania2019()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(2019, CountryCode.RO).ToArray();

            //New Year's Day
            Assert.AreEqual(new DateTime(2019, 1, 1), publicHolidays[0].Date);
            //Day after New Year's Day
            Assert.AreEqual(new DateTime(2019, 1, 2), publicHolidays[1].Date);
            //Union Day/Small Union
            Assert.AreEqual(new DateTime(2019, 1, 24), publicHolidays[2].Date);
            //Good Friday
            Assert.AreEqual(new DateTime(2019, 4, 26), publicHolidays[3].Date);
            //Easter Sunday
            Assert.AreEqual(new DateTime(2019, 4, 28), publicHolidays[4].Date);
            //Easter Monday
            Assert.AreEqual(new DateTime(2019, 4, 29), publicHolidays[5].Date);
            //Labour Day
            Assert.AreEqual(new DateTime(2019, 5, 1), publicHolidays[6].Date);
            //Children's Day
            Assert.AreEqual(new DateTime(2019, 6, 1), publicHolidays[7].Date);
            //Pentecost
            Assert.AreEqual(new DateTime(2019, 6, 16), publicHolidays[8].Date);
            //Whit Monday
            Assert.AreEqual(new DateTime(2019, 6, 17), publicHolidays[9].Date);
            //Dormition of the Theotokos
            Assert.AreEqual(new DateTime(2019, 8, 15), publicHolidays[10].Date);
            //St. Andrew's Day
            Assert.AreEqual(new DateTime(2019, 11, 30), publicHolidays[11].Date);
            //National Day/Great Union
            Assert.AreEqual(new DateTime(2019, 12, 1), publicHolidays[12].Date);
            //Christmas Day
            Assert.AreEqual(new DateTime(2019, 12, 25), publicHolidays[13].Date);
            //St. Stephen's Day
            Assert.AreEqual(new DateTime(2019, 12, 26), publicHolidays[14].Date);
        }
        public ActionResult DownloadCsv(string countrycode, int year = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }

            if (!Enum.TryParse(countrycode, true, out CountryCode countryCode))
            {
                return(NotFound());
            }

            var items = DateSystem.GetPublicHoliday(year, countryCode).ToList();

            if (items.Count > 0)
            {
                using (var memoryStream = new MemoryStream())
                    using (var streamWriter = new StreamWriter(memoryStream))
                        using (var csv = new CsvWriter(streamWriter))
                        {
                            csv.WriteRecords(items.Select(o => new PublicHolidayCsv(o)));
                            streamWriter.Flush();

                            var csvData = memoryStream.ToArray();

                            var result = new FileContentResult(csvData, "application/octet-stream");
                            result.FileDownloadName = $"publicholiday.{countrycode}.{year}.csv";
                            return(result);
                        }
            }

            return(NotFound());
        }
Esempio n. 5
0
        public ActionResult Country(string countrycode, int year = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }

            CountryCode countryCode;

            if (!Enum.TryParse(countrycode, true, out countryCode))
            {
                return(View("NotFound"));
            }

            var country = Iso3166Countries.GetCountryByAlpha2(countryCode.ToString());

            ViewBag.Country     = country.ActiveDirectoryName;
            ViewBag.CountryCode = countrycode;
            ViewBag.Year        = year;
            ViewBag.NextYear    = year + 1;

            var publicHolidays = DateSystem.GetPublicHoliday(countryCode, year);

            if (publicHolidays?.Count() > 0)
            {
                return(View(publicHolidays));
            }

            return(View("NotFound"));
        }
Esempio n. 6
0
        public void TestCanada()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(2017, CountryCode.CA).ToArray();

            //New Year's Day
            Assert.AreEqual(new DateTime(2017, 1, 1), publicHolidays[0].Date);
        }
        /// <summary>
        /// Adds all holidays to the "holdays" dictionary
        /// </summary>
        private static void AddHolidays(int year)
        {
            holidays.Clear();

            IEnumerable <PublicHoliday> publicHolidays = DateSystem.GetPublicHoliday(year, CountryCode.SE);

            string[] ignoredHolidays = new string[] { "Pingstdagen", "Midsommarafton" };
            foreach (var h in publicHolidays)
            {
                if (ignoredHolidays.Contains(h.LocalName))
                {
                    continue;
                }

                holidays.Add(h.LocalName, new HolidayData(h.Date, "Helgdag"));
            }

            holidays.Add("Trettondagsafton", new HolidayData(holidays["Trettondedag jul"].Date.AddDays(-1), "Halvdag"));
            holidays.Add("Skärtorsdagen", new HolidayData(holidays["Långfredagen"].Date.AddDays(-1), "Halvdag"));
            holidays.Add("Valborgmässoafton", new HolidayData(holidays["Första maj"].Date.AddDays(-1), "Halvdag"));
            holidays.Add("Allhelgonaafton", new HolidayData(holidays["Alla helgons dag"].Date.AddDays(-1), "Halvdag"));
            holidays.Add("Mårtensafton", new HolidayData(new DateTime(year, 11, 10), "Halvdag"));
            holidays.Add("Lille julafton", new HolidayData(holidays["Julafton"].Date.AddDays(-1), "Halvdag"));

            holidays.Add("Mellandag_1", new HolidayData(holidays["Annandag jul"].Date.AddDays(1), "Halvdag"));
            holidays.Add("Mellandag_2", new HolidayData(holidays["Annandag jul"].Date.AddDays(2), "Halvdag"));
            holidays.Add("Mellandag_3", new HolidayData(holidays["Annandag jul"].Date.AddDays(3), "Halvdag"));
            holidays.Add("Mellandag_4", new HolidayData(holidays["Annandag jul"].Date.AddDays(4), "Halvdag"));
        }
Esempio n. 8
0
        public List <Tuple <DateTime, string> > TegritHolidaysList()
        {
            List <Tuple <DateTime, string> > tegritHolidayList = new List <Tuple <DateTime, string> >();

            try
            {
                var current     = DateTime.Now;
                var startDate   = new DateTime(current.Year, 1, 1);
                var endDate     = new DateTime(current.Year, 12, 31);
                var allholidays = DateSystem.GetPublicHoliday(startDate, endDate, "US");

                List <Tuple <string, DateTime> > datbaseList = new List <Tuple <string, DateTime> >();


                foreach (var holiday in allholidays)
                {
                    if (holiday.Name.Equals("New Year's Day") || holiday.Name.Equals("Presidents' Day") ||
                        holiday.Name.Equals("Memorial Day") ||
                        holiday.Name.Equals("Independence Day") || holiday.Name.Equals("Labour Day") ||
                        holiday.Name.Equals("Thanksgiving Day") || holiday.Name.Equals("Christmas Day"))

                    {
                        tegritHolidayList.Add(new Tuple <DateTime, string>(holiday.Date, holiday.Name));
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogServiceMessage(LoggingHelper.MessageType.Error, string.Empty, ex);
                throw;
            }

            return(tegritHolidayList);
        }
Esempio n. 9
0
        private void CountStawki()
        {
            var startDate    = CalendarStawki.DisplayDate.AddDays(-CalendarStawki.DisplayDate.Day + 1);
            var endTime      = startDate.AddMonths(1).AddDays(-1);
            var currentMonth = DateSystem.GetPublicHoliday(CountryCode.PL, startDate,
                                                           endTime);

            Stawki.Text = "Urlopy: " + string.Join(", ", CalendarStawki.SelectedDates.Select(x => x.ToString("M")));
            Swieta.Text = "Swieta: " + string.Join(", ", currentMonth.Select(x => x.Date.ToString("M")));

            double payment;
            var    workingDays = 0;

            if (double.TryParse(Payment.Text, out payment))
            {
                foreach (var day in EachDay(startDate, endTime))
                {
                    if (day.DayOfWeek != DayOfWeek.Saturday && day.DayOfWeek != DayOfWeek.Sunday)
                    {
                        if (!DateSystem.IsPublicHoliday(day, CountryCode.PL))
                        {
                            if (!CalendarStawki.SelectedDates.Any(x => x.Date == day.Date))
                            {
                                workingDays++;
                            }
                        }
                    }
                }

                var perHour = payment / (workingDays * (7 + ((double)35 / (double)60)));
                ResultStawki.Text = $"Dni pracujące w miesiącu {startDate:MMMM}: {workingDays}\r\nStawka godzinowa: {perHour:0.##}";
            }
        }
Esempio n. 10
0
        public ActionResult <IEnumerable <RegionStatisticDto> > RegionStatistic()
        {
            var countryCodes = (CountryCode[])Enum.GetValues(typeof(CountryCode));

            var availableCountryCodes = from CountryCode countryCode in countryCodes
                                        where DateSystem.GetPublicHoliday(DateTime.Today.Year, countryCode).Any()
                                        select countryCode;

            var missingCountryCodes = countryCodes.Except(availableCountryCodes);

            var availableCountries = availableCountryCodes.Select(o => this._countryProvider.GetCountry(o.ToString()));
            var missingCountries   = missingCountryCodes.Select(o => this._countryProvider.GetCountry(o.ToString()));

            var regions = (Region[])Enum.GetValues(typeof(Region));

            var regionStatistic = from Region region in regions
                                  where region != Region.None
                                  select new RegionStatisticDto
            {
                RegionName         = region.ToString(),
                AvailableCountries = availableCountries.Where(o => o.Region == region)
                                     .Select(o => CountryHelper.Convert(o))
                                     .OrderBy(o => o.CommonName)
                                     .ToArray(),
                MissingCountries = missingCountries.Where(o => o.Region == region)
                                   .Select(o => CountryHelper.Convert(o))
                                   .OrderBy(o => o.CommonName)
                                   .ToArray(),
            };

            return(View(regionStatistic));
        }
        public IActionResult Index(InputData _data)
        {
            int result_day  = 0;
            var CheckedDate = _data.CheckedDate;

            foreach (var item in calculate())
            {
                if (item.Value == _data.Name)
                {
                    foreach (var publicHoliday in DateSystem.GetPublicHoliday(CheckedDate, _data.ReturnedDate, item.Key))
                    {
                        result_day = result_day - 1;
                    }

                    RegionInfo regionInfo = new RegionInfo(item.Key);
                    ViewBag.currencySymbol = regionInfo.CurrencySymbol;
                    while (DateTime.Compare(_data.ReturnedDate, CheckedDate) > 0)
                    {
                        if ((int)CheckedDate.DayOfWeek != 0 && (int)CheckedDate.DayOfWeek != 6)//Saturday and Sunday
                        {
                            result_day = result_day + 1;
                        }

                        CheckedDate = CheckedDate.AddDays(1);
                    }
                }
            }
            _data.ResultDay = result_day;

            return(View("Detail", _data));
        }
Esempio n. 12
0
        public async Task <ImmutableList <Guid> > Handle(UpdateTimeHolidayEntriesByCountry request,
                                                         CancellationToken cancellationToken)
        {
            var user = _authProvider.GetUser();

//            var toDeleteEntries = await _writeRepository.GetOrDefault<Domain.TimeHolidayEntry>(request.Id.ToString());
//
//            toDeleteEntries.Delete();

            var holidays = DateSystem.GetPublicHoliday(request.Year, request.CountryCode);

            var timeHolidayEntries = holidays.Select(holiday =>
                                                     Domain.TimeHolidayEntry.Create(new TimeHolidayEntryEventDto(
                                                                                        Guid.NewGuid(),
                                                                                        user,
                                                                                        $"{holiday.LocalName} ({holiday.Name})",
                                                                                        holiday.Date)
                                                                                    )).ToArray();

            var events = await _writeRepository.Save(WriteRepository.DefaultKeyTaker, timeHolidayEntries);

            foreach (var evt in events)
            {
                await _mediator.Publish(evt, cancellationToken);
            }

            return(timeHolidayEntries.Select(te => te.Id).ToImmutableList());
        }
Esempio n. 13
0
        private IEnumerable <DateTime> GetAllHolidays()
        {
            var result = DateSystem.GetPublicHoliday(CountryCode.ES, DateTime.Now.Year).Select(d => d.Date).ToList();

            result.AddRange(DateSystem.GetPublicHoliday(CountryCode.ES, DateTime.Now.AddYears(1).Year).Select(d => d.Date).ToList());
            return(result);
        }
Esempio n. 14
0
        private void buttonGet_Click(object sender, EventArgs e)
        {
            var countryCode    = this.comboBoxCountry.Text;
            var publicHolidays = DateSystem.GetPublicHoliday(countryCode, DateTime.Now.Year);

            this.dataGridViewPublicHoliday.DataSource = publicHolidays;
        }
Esempio n. 15
0
        public void TestTurkey()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(2017, CountryCode.TR).ToArray();

            //New Year's Day
            Assert.AreEqual(new DateTime(2017, 1, 1), publicHolidays[0].Date);

            //National Independence & Children's Day
            Assert.AreEqual(new DateTime(2017, 4, 23), publicHolidays[1].Date);

            //Labour Day
            Assert.AreEqual(new DateTime(2017, 5, 1), publicHolidays[2].Date);

            //Atatürk Commemoration & Youth Day
            Assert.AreEqual(new DateTime(2017, 5, 19), publicHolidays[3].Date);

            //Democracy Day
            Assert.AreEqual(new DateTime(2017, 7, 15), publicHolidays[4].Date);

            //Victory Day
            Assert.AreEqual(new DateTime(2017, 8, 30), publicHolidays[5].Date);

            //Republic Day
            Assert.AreEqual(new DateTime(2017, 10, 29), publicHolidays[6].Date);
        }
Esempio n. 16
0
        public void TestHungary()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(CountryCode.HU, 2018).ToArray();

            //New Year's Day
            Assert.AreEqual(new DateTime(2018, 1, 1), publicHolidays[0].Date);
            //1848 Revolution Memorial Day
            Assert.AreEqual(new DateTime(2018, 3, 15), publicHolidays[1].Date);
            //Good Friday
            Assert.AreEqual(new DateTime(2018, 3, 30), publicHolidays[2].Date);
            //Easter Sunday
            Assert.AreEqual(new DateTime(2018, 4, 1), publicHolidays[3].Date);
            //Easter Monday
            Assert.AreEqual(new DateTime(2018, 4, 2), publicHolidays[4].Date);
            //Labour day
            Assert.AreEqual(new DateTime(2018, 5, 1), publicHolidays[5].Date);
            //Pentecost
            Assert.AreEqual(new DateTime(2018, 5, 20), publicHolidays[6].Date);
            //Whit Monday
            Assert.AreEqual(new DateTime(2018, 5, 21), publicHolidays[7].Date);
            //State Foundation Day
            Assert.AreEqual(new DateTime(2018, 8, 20), publicHolidays[8].Date);
            //1956 Revolution Memorial Day
            Assert.AreEqual(new DateTime(2018, 10, 23), publicHolidays[9].Date);
            //All Saints Day
            Assert.AreEqual(new DateTime(2018, 11, 1), publicHolidays[10].Date);
            //Christmas Day
            Assert.AreEqual(new DateTime(2018, 12, 25), publicHolidays[11].Date);
            //St. Stephen's Day
            Assert.AreEqual(new DateTime(2018, 12, 26), publicHolidays[12].Date);
        }
Esempio n. 17
0
        private void fillNonVactionDaysFromApiJustIfNotExistAndForNextYears()
        {
            this.contexts = new ScheduleDB();
            this.dbSets   = this.contexts.Set <NonActiveDays>();
            List <NonActiveDays> getNoActiveDays = new List <NonActiveDays>();

            getNoActiveDays = dbSets.AsEnumerable <NonActiveDays>().ToList();
            if (getNoActiveDays.Max(m => m.Date) < new DateTime(2018, 05, 10))
            {
                var publicHolidays = DateSystem.GetPublicHoliday(CountryCode.IS, new DateTime(2018, 05, 11, 0, 0, 0), new DateTime(2018, 05, 20, 0, 0, 0));
                for (int i = 0, orderNumber = 1; i < publicHolidays.Count() && orderNumber <= 17; orderNumber++)
                {
                    if (getNoActiveDays.FindIndex(day => day.Date < publicHolidays.ElementAt(i).Date) >= 0)
                    {
                        NonActiveDays day = new NonActiveDays();
                        day.Date        = publicHolidays.ElementAt(i).Date;
                        day.OrderNumber = orderNumber;
                        day.Reason      = "���� ������ ������";
                        dbSets.Add(day);
                        contexts.SaveChanges();
                    }
                    if (orderNumber == 17)
                    {
                        orderNumber = 0;
                        i++;
                    }
                }
            }
        }
Esempio n. 18
0
        public void CheckCounties()
        {
            foreach (CountryCode countryCode in Enum.GetValues(typeof(CountryCode)))
            {
                var provider = DateSystem.GetPublicHolidayProvider(countryCode);
                if (provider is ICountyProvider countyProvider)
                {
                    var counties = countyProvider.GetCounties();

                    var publicHolidays = DateSystem.GetPublicHoliday(DateTime.Now.Year, countryCode);
                    foreach (var publicHoliday in publicHolidays)
                    {
                        if (publicHoliday.Counties == null)
                        {
                            continue;
                        }

                        if (publicHoliday.Counties.Count(o => counties.Keys.Contains(o)) != publicHoliday.Counties.Length)
                        {
                            var diff = publicHoliday.Counties.Except(counties.Keys);
                            Assert.Fail($"Unknown countie in {provider} {string.Join(",", diff)}");
                        }
                    }
                }
            }
        }
Esempio n. 19
0
        public void CheckCounties()
        {
            foreach (CountryCode countryCode in Enum.GetValues(typeof(CountryCode)))
            {
                var provider = DateSystem.GetPublicHolidayProvider(countryCode);
                if (provider is ICountyProvider)
                {
                    var counties = ((ICountyProvider)provider).GetCounties();

                    var publicHolidays = DateSystem.GetPublicHoliday(DateTime.Now.Year, countryCode);
                    foreach (var publicHoliday in publicHolidays)
                    {
                        if (publicHoliday.Counties == null)
                        {
                            continue;
                        }

                        if (publicHoliday.Counties.Where(o => counties.Keys.Contains(o)).Count() != publicHoliday.Counties.Count())
                        {
                            Assert.Fail($"Unknown countie in {provider}");
                        }
                    }
                }
            }
        }
Esempio n. 20
0
 void refreshHolidays()
 {
     try
     {
         var           year        = Int32.Parse(textBox_Year.Text);
         var           month       = Int32.Parse(textBox_Month.Text);
         var           startDate   = new DateTime(year, month, 1);
         var           endDate     = new DateTime(year, month, DateTime.DaysInMonth(year, month));
         var           pubHolidays = DateSystem.GetPublicHoliday(startDate, endDate, CountryCode.KR);
         List <string> holidays    = new List <string>();
         foreach (var holiday in pubHolidays)
         {
             holidays.Add(holiday.LocalName);
         }
         var str     = "";
         var enabled = true;
         if (holidays.Count > 0)
         {
             str += "(";
             str += string.Join(", ", holidays);
             str += ") 제외";
         }
         else
         {
             str     = "공휴일 없음";
             enabled = false;
         }
         checkBox_publicHoliday.Text    = str;
         checkBox_publicHoliday.Enabled = enabled;
     }
     catch
     {
     }
 }
Esempio n. 21
0
        public void TestChina2018()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(2018, CountryCode.CN).ToArray();

            Assert.IsTrue(publicHolidays.Any(o => o.Date == new DateTime(2018, 9, 24) && o.Name == "Mid-Autumn Festival"));
            Assert.IsTrue(publicHolidays.Any(o => o.Date == new DateTime(2018, 4, 5) && o.Name == "Qingming Festival (Tomb-Sweeping Day)"));
        }
Esempio n. 22
0
        public void TestChina2019()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(CountryCode.CN, 2019).ToArray();

            Assert.IsTrue(publicHolidays.Where(o => o.Date == new DateTime(2019, 9, 13) && o.Name == "Mid-Autumn Festival").Any());
            Assert.IsTrue(publicHolidays.Where(o => o.Date == new DateTime(2019, 4, 5) && o.Name == "Qingming Festival (Tomb-Sweeping Day)").Any());
        }
        public ActionResult Country(string countrycode, int year = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }

            CountryCode countryCode;

            if (!Enum.TryParse(countrycode, true, out countryCode))
            {
                return(View("NotFound"));
            }

            var isoCountry = Iso3166Countries.GetCountryByAlpha2(countryCode.ToString());

            var item = new PublicHolidayInfo();

            item.Country        = isoCountry.ActiveDirectoryName;
            item.CountryCode    = countrycode;
            item.Year           = year;
            item.PublicHolidays = DateSystem.GetPublicHoliday(countryCode, year).ToList();
            item.LongWeekends   = DateSystem.GetLongWeekend(countryCode, year).ToList();

            if (item.PublicHolidays.Count > 0)
            {
                return(View(item));
            }

            return(View("NotFound"));
        }
Esempio n. 24
0
        public void TestAustria()
        {
            var publicHolidays = DateSystem.GetPublicHoliday(2017, CountryCode.AT).ToArray();

            //New Year's Day
            Assert.AreEqual(new DateTime(2017, 1, 1), publicHolidays[0].Date);
            //Epiphany
            Assert.AreEqual(new DateTime(2017, 1, 6), publicHolidays[1].Date);
            //Easter Monday
            Assert.AreEqual(new DateTime(2017, 4, 17), publicHolidays[2].Date);
            //National Holiday
            Assert.AreEqual(new DateTime(2017, 5, 1), publicHolidays[3].Date);
            //Ascension Day
            Assert.AreEqual(new DateTime(2017, 5, 25), publicHolidays[4].Date);
            //Whit Monday
            Assert.AreEqual(new DateTime(2017, 6, 5), publicHolidays[5].Date);
            //Corpus Christi
            Assert.AreEqual(new DateTime(2017, 6, 15), publicHolidays[6].Date);
            //Assumption Day
            Assert.AreEqual(new DateTime(2017, 8, 15), publicHolidays[7].Date);
            //National Holiday
            Assert.AreEqual(new DateTime(2017, 10, 26), publicHolidays[8].Date);
            //All Saints' Day
            Assert.AreEqual(new DateTime(2017, 11, 1), publicHolidays[9].Date);
            //Immaculate Conception
            Assert.AreEqual(new DateTime(2017, 12, 8), publicHolidays[10].Date);
            //Christmas Day
            Assert.AreEqual(new DateTime(2017, 12, 25), publicHolidays[11].Date);
            //St. Stephen's Day
            Assert.AreEqual(new DateTime(2017, 12, 26), publicHolidays[12].Date);
        }
Esempio n. 25
0
        public void TestKosova()

        {
            var publicHolidays = DateSystem.GetPublicHoliday(2019, CountryCode.XK).ToArray();

            //New Year's Day
            Assert.AreEqual(new DateTime(2019, 1, 1), publicHolidays[0].Date);
            //Orthodox Christmas
            Assert.AreEqual(new DateTime(2019, 1, 7), publicHolidays[1].Date);
            //Independence Day
            Assert.AreEqual(new DateTime(2019, 2, 17), publicHolidays[2].Date);
            //Constitution Day
            Assert.AreEqual(new DateTime(2019, 4, 9), publicHolidays[3].Date);
            //Catholic Easter
            Assert.AreEqual(new DateTime(2019, 4, 21), publicHolidays[4].Date);
            //Orthodox Easter
            Assert.AreEqual(new DateTime(2019, 4, 28), publicHolidays[5].Date);
            //International Workers' Day
            Assert.AreEqual(new DateTime(2019, 5, 1), publicHolidays[6].Date);
            //Europe Day
            Assert.AreEqual(new DateTime(2019, 5, 9), publicHolidays[7].Date);

            //Eid ul-Fitr is not implemented
            //Eid ul-Adha is not implemented

            //Catholic Christmas
            Assert.AreEqual(new DateTime(2019, 12, 25), publicHolidays[8].Date);
        }
Esempio n. 26
0
        public void CheckPublicHolidayWithDateFilter1()
        {
            var items = DateSystem.GetPublicHoliday(new DateTime(2016, 5, 1), new DateTime(2018, 5, 31), CountryCode.DE);

            Assert.IsTrue(items.First().Date > new DateTime(2016, 4, 28));
            Assert.IsTrue(items.Last().Date < new DateTime(2018, 6, 1));
        }
Esempio n. 27
0
        private void CheckPublicHolidayWithDateFilter1(DateTime startDate, DateTime endDate)
        {
            var items = DateSystem.GetPublicHoliday(startDate, endDate, CountryCode.DE);

            Assert.AreEqual(38, items.Count());
            Assert.IsTrue(items.First().Date > new DateTime(2016, 4, 28));
            Assert.IsTrue(items.Last().Date < new DateTime(2018, 6, 1));
        }
Esempio n. 28
0
 public void TestAllRelationsExist()
 {
     foreach (CountryCode countryCode in Enum.GetValues(typeof(CountryCode)))
     {
         var items = DateSystem.GetPublicHoliday(countryCode, DateTime.UtcNow.Year).ToList();
         Assert.AreNotEqual(0, items.Count);
     }
 }
Esempio n. 29
0
        public ActionResult <IEnumerable <PublicHolidayDto> > AvailableCountries()
        {
            var countries = from CountryCode o in Enum.GetValues(typeof(CountryCode))
                            where DateSystem.GetPublicHoliday(DateTime.Today.Year, o).Any()
                            select new KeyValuePair <string, string>(o.ToString(), this.GetName(o));

            return(StatusCode(StatusCodes.Status200OK, countries));
        }
Esempio n. 30
0
 public void TestSpain()
 {
     for (var year = DateTime.Now.Year; year < 3000; year++)
     {
         var publicHolidays = DateSystem.GetPublicHoliday(CountryCode.ES, year);
         Assert.AreEqual(35, publicHolidays.Count());
     }
 }