/// <summary> /// Gets the TorahPortion that is read on that week's Shabbos. If, however, a YomTov falls on the Shabbos, and the Parsha gets pushed off, it returns null. /// </summary> /// <param name="Year">That Jewish year</param> /// <param name="Week">The number of the week starting from Rosh Hashanah</param> /// <param name="inIsrael">A boolean value indicating the user's location, this has an effect on the Parsha</param> /// <returns>The Torah portion that is read that Shabbos</returns> public TorahPortion?GetTorahPortion(int Year, int Week, bool inIsrael) { HebrewCalendar hebCal = new HebrewCalendar(); JewishDate date = hebCal.AddWeeks(new JewishDate(Year, 1, 1), Week - 1); return(GetTorahPortion(date, inIsrael)); }
private void SetWeeksTillSimchatTorah() { DateTime simchatTorah = GetDateTimeHebDate(hebYear, 1, 22); DateTime firstDay = GetDateTimeHebDate(hebYear, 1, 1); int currentWeekOfYear = GetWeekOfHebYear(firstDay); int simchatTorahWeekOfYear = GetWeekOfHebYear(simchatTorah); while (currentWeekOfYear != simchatTorahWeekOfYear) { firstDay = hebCal.AddWeeks(firstDay, 1); weeksTillSimchatTorah++; currentWeekOfYear = GetWeekOfHebYear(firstDay); } }