コード例 #1
0
 public PublicHolidayCsv(PublicHoliday item)
 {
     this.Date        = item.Date.ToString("yyyy-MM-dd");
     this.LocalName   = item.LocalName;
     this.Name        = item.Name;
     this.CountryCode = item.CountryCode.ToString();
     this.Fixed       = item.Fixed;
     this.Global      = item.Global;
     this.Counties    = item.Counties;
     this.LaunchYear  = item.LaunchYear;
     this.Type        = item.Type;
 }
コード例 #2
0
        private PublicHolidayType[] EnumFlagToArray(PublicHolidayType publicHolidayTypes)
        {
            var items = new List <PublicHolidayType>();

            foreach (PublicHolidayType publicHolidayType in Enum.GetValues(typeof(PublicHolidayType)))
            {
                if (publicHolidayTypes.HasFlag(publicHolidayType))
                {
                    items.Add(publicHolidayType);
                }
            }

            return(items.ToArray());
        }
コード例 #3
0
 /// <summary>
 /// Add Public Holiday (fixed is true)
 /// </summary>
 /// <param name="year"></param>
 /// <param name="month"></param>
 /// <param name="day"></param>
 /// <param name="localName"></param>
 /// <param name="englishName"></param>
 /// <param name="countryCode">ISO 3166-1 ALPHA-2</param>
 /// <param name="launchYear"></param>
 /// <param name="counties">ISO-3166-2</param>
 /// <param name="type">The type of the public holiday</param>
 public PublicHoliday(int year, int month, int day, string localName, string englishName, CountryCode countryCode, int?launchYear = null, string[] counties = null, PublicHolidayType type = PublicHolidayType.Public)
 {
     this.Date        = new DateTime(year, month, day);
     this.LocalName   = localName;
     this.Name        = englishName;
     this.CountryCode = countryCode;
     this.Fixed       = true;
     this.Type        = type;
     this.LaunchYear  = launchYear;
     if (counties?.Length > 0)
     {
         this.Counties = counties;
     }
 }
コード例 #4
0
 /// <summary>
 /// Add Public Holiday (fixed is false)
 /// </summary>
 /// <param name="date"></param>
 /// <param name="localName"></param>
 /// <param name="englishName"></param>
 /// <param name="countryCode">ISO 3166-1 ALPHA-2</param>
 /// <param name="launchYear"></param>
 /// <param name="counties">ISO-3166-2</param>
 /// /// <param name="type">The type of the public holiday</param>
 public PublicHoliday(DateTime date, string localName, string englishName, CountryCode countryCode, int?launchYear = null, string[] counties = null, PublicHolidayType type = PublicHolidayType.Public)
 {
     this.Date        = date;
     this.LocalName   = localName;
     this.Name        = englishName;
     this.CountryCode = countryCode;
     this.Fixed       = false;
     this.Type        = type;
     this.LaunchYear  = launchYear;
     if (counties?.Length > 0)
     {
         this.Counties = counties;
     }
 }
コード例 #5
0
ファイル: PublicHoliday.cs プロジェクト: parayacr/Nager.Date
        internal PublicHoliday SetType(PublicHolidayType publicHolidayType)
        {
            this.Type = publicHolidayType;

            return(this);
        }