public Hashtable GetFullTimingsForMonth( int month, int yr ) { try { Hashtable datedata = new Hashtable(); DateTime startdate = new DateTime(yr, month, 1); DateTime stopdate = new DateTime(yr, month + 1, 1); for (DateTime date = startdate; date < stopdate; date = date.AddDays(1)) { TimeListElement time = new TimeListElement(); time.Date = date; time.Fajr = calcFajrTime(date); time.Sunrise = calcTuluTime(date); time.Midday = calcZawalTime(date); time.Zuhr = calcZuhrTime(date); time.AsrS = calcAsrSTime(date); time.AsrH = calcAsrHTime(date); time.Sunset = calcMaghribTime(date); time.Isha = calcIshaTime(date); datedata[date.ToShortDateString()] = time; } // bool result = false; // lock ( availableYears.SyncRoot ) // { // result = availableYears.ContainsKey ( yr.ToString () ); // } // if ( result == false ) // { // Thread t = PrepareTables ( yr , latitude, latdir, longitude, longdir , daylightadjustment, dltadjsign ); // waitForThread ( t , 1000 , 5 , "Time routine for Month : " // + month.ToString () + " Year : " + yr.ToString() + " timed out." ); // // } // //lock so that we dont return half-baked data to the client. // Hashtable data; // lock ( availableYears.SyncRoot ) // { // data = (Hashtable)availableYears[yr.ToString()]; // } // return data; return datedata; } catch (Exception ex) { Exceptions.TimeCalculatorException exception = new libpraytt.Exceptions.TimeCalculatorException(ex.Message); exception.OriginalException = ex; throw exception; } }
public Hashtable GetTimingsForDate( DateTime date ) { try { Hashtable datedata = new Hashtable(); TimeListElement time = new TimeListElement(); time.Date = date; time.Fajr = calcFajrTime(date); time.Sunrise = calcTuluTime(date); time.Midday = calcZawalTime(date); time.Zuhr = calcZuhrTime(date); time.AsrS = calcAsrSTime(date); time.AsrH = calcAsrHTime(date); time.Sunset = calcMaghribTime(date); time.Isha = calcIshaTime(date); datedata[date.ToShortDateString()] = time; return datedata; } catch (Exception ex) { Exceptions.TimeCalculatorException exception = new libpraytt.Exceptions.TimeCalculatorException(ex.Message); exception.OriginalException = ex; throw exception; } }
public Hashtable GetPrayerTimingsForYear( int yr, Prayers prayer ) { try { Hashtable datedata = new Hashtable(); DateTime startdate = new DateTime(yr, 1, 1); DateTime stopdate = new DateTime(yr + 1, 1, 1); for (DateTime date = startdate; date < stopdate; date = date.AddDays(1)) { TimeListElement time = new TimeListElement(); time.Date = date; switch (prayer) { case Prayers.Fajr: time.Fajr = calcFajrTime(date); break; case Prayers.Sunrise: time.Sunrise = calcTuluTime(date); break; case Prayers.Midday: time.Midday = calcZawalTime(date); break; case Prayers.Zuhr: time.Zuhr = calcZuhrTime(date); break; case Prayers.AsrS: time.AsrS = calcAsrSTime(date); break; case Prayers.AsrH: time.AsrH = calcAsrHTime(date); break; case Prayers.Sunset: time.Sunset = calcMaghribTime(date); break; case Prayers.Isha: time.Isha = calcIshaTime(date); break; } datedata[date.ToShortDateString()] = time; } return datedata; } catch (Exception ex) { Exceptions.TimeCalculatorException exception = new libpraytt.Exceptions.TimeCalculatorException(ex.Message); exception.OriginalException = ex; throw exception; } }
public Hashtable GetSummaryTimingsForYear( int yr, int granularity ) { try { Hashtable datedata = new Hashtable(); DateTime startdate = new DateTime(yr, 1, 1); DateTime stopdate = new DateTime(yr + 1, 1, 1); for (DateTime date = startdate; date < stopdate; date = date.AddDays(granularity)) { TimeListElement time = new TimeListElement(); time.Date = date; time.Fajr = calcFajrTime(date); time.Sunrise = calcTuluTime(date); time.Midday = calcZawalTime(date); time.Zuhr = calcZuhrTime(date); time.AsrS = calcAsrSTime(date); time.AsrH = calcAsrHTime(date); time.Sunset = calcMaghribTime(date); time.Isha = calcIshaTime(date); datedata[date.ToShortDateString()] = time; } return datedata; } catch (Exception ex) { Exceptions.TimeCalculatorException exception = new libpraytt.Exceptions.TimeCalculatorException(ex.Message); exception.OriginalException = ex; throw exception; } }
public Hashtable GetPrayerTimingsBetween2(DateTime startdate, DateTime stopdate, Prayers[] prayers, bool summarize, int granularity, ProgressCallback pcb) { try { if (!summarize) granularity = 1; TimeSpan diff = stopdate - startdate; diff.Add(TimeSpan.FromDays(1)); float progressstep = 100 / (float)diff.Days; float progress = 0; Hashtable datedata = new Hashtable(); for (DateTime date = startdate; date <= stopdate; date = date.AddDays(granularity)) { TimeListElement time = new TimeListElement(); time.Date = date; foreach (Prayers p in prayers) { switch (p) { case Prayers.Fajr: time.Fajr = calcFajrTime(date); break; case Prayers.Sunrise: time.Sunrise = calcTuluTime(date); break; case Prayers.Midday: time.Midday = calcZawalTime(date); break; case Prayers.Zuhr: time.Zuhr = calcZuhrTime(date); break; case Prayers.AsrS: time.AsrS = calcAsrSTime(date); break; case Prayers.AsrH: time.AsrH = calcAsrHTime(date); break; case Prayers.Sunset: time.Sunset = calcMaghribTime(date); break; case Prayers.Isha: time.Isha = calcIshaTime(date); break; } } progress += progressstep; pcb((int)progress); datedata[date.ToShortDateString()] = time; } return datedata; } catch (Exception ex) { Exceptions.TimeCalculatorException exception = new libpraytt.Exceptions.TimeCalculatorException(ex.Message); exception.OriginalException = ex; throw exception; } }