public IActionResult Country(string countrycode, int year = 0)
        {
            if (year == 0)
            {
                year = DateTime.Now.Year;
            }

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

            var country = new Country.CountryProvider().GetCountry(countryCode.ToString());

            var item = new PublicHolidayInfo
            {
                Country     = country.CommonName,
                CountryCode = countrycode,
                Year        = year
            };

            return(View(item));

            //if (item.PublicHolidays.Count > 0)
            //{
            //
            //}

            //return LocalRedirect("/");
        }
        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"));
        }
示例#3
0
 private void ConfirmDate(DateTimePicker dtp)
 {
     ReserveDay                  = new ReserveInfo();
     WorkingDay                  = new SettingsInfo();
     PublicHolidayDay            = new PublicHolidayInfo();
     AppointmentInfo.Appointment = dtp.Value.Date;
     Proceed = false;
     n       = 0;
     while (!Proceed)
     {
         AppointmentOK(false);
         Proceed = true;
         AppointmentInfo.Appointment = AppointmentInfo.Appointment.AddDays(n);
         if (ReserveDay.DateIsReserved())
         {
             if (ProceedR = ReserveDay.DateIsReserve())
             {
                 Proceed = false;
                 n       = 1;
             }
             else
             {
                 return;
             }
         }
         if ((AppointmentInfo.Appointment.DayOfWeek == DayOfWeek.Thursday) && (lblAgeunit.Text == "Y") && (Convert.ToInt32(lblAge.Text) > 20))
         {
             Proceed = false;
             n       = 1;
         }
         if (ProceedW = !WorkingDay.DateIsOK())
         {
             Proceed = false;
             n       = 1;
         }
         if (ProceedP = PublicHolidayDay.DateIsHoliday())
         {
             Proceed = false;
             n       = 1;
         }
     }
     AppointmentOK(true);
 }