public BugReport(LocDataElement loc, DateTime from, DateTime to, Prayers[] p) { location = loc; fromdate = from; todate = to; prayers = p; }
public ArrayList GetTime( Prayers [] prayers, bool allPrayers, bool summarize, int granularity , DateTime fromdate, DateTime todate, LocDataElement location, ProgressCallback pcb ) { TimeCalculator calc = new TimeCalculator (location.Longitude, location.Latitude, location.DaylightAdjustment, location.GMTDiff ); Hashtable table = calc.GetPrayerTimingsBetween2 ( fromdate, todate, prayers, summarize, granularity, pcb ); ArrayList result = new ArrayList (); foreach ( string s in table.Keys ) { TimeListElement tle = (TimeListElement)table[s]; FieldInfo [] fields = tle.GetType().GetFields(); string [] vals = new string [ fields.Length ]; for ( int i = 0 ; i < fields.Length; i ++ ) { if ( fields[i].GetValue(tle).GetType() == typeof ( System.DateTime ) ) { DateTimeFormatInfo dfi = new DateTimeFormatInfo(); dfi.ShortDatePattern = "dd/MM/yyyy"; vals [ i ] = ((DateTime)fields [ i ].GetValue (tle)).ToString("d",dfi); continue; } TimeSpan ts = (TimeSpan)fields[i].GetValue(tle); if ( ts != TimeSpan.Zero ) { DateTime dt = new DateTime ( 1,1,1,ts.Hours, ts.Minutes, ts.Seconds ); DateTimeFormatInfo dfi = new DateTimeFormatInfo ( ); dfi.LongTimePattern = "hh:mm:ss"; vals [ i ] = dt.ToString("T", dfi); } else vals [ i ] = string.Empty; } result.Add ( vals ); } result.Sort(new MyComparer()); return result; }
private void LoadLocationData( string filename ) { XmlDataDocument doc = new XmlDataDocument ( ); doc.Load ( filename ); XmlNodeList nodes = doc.GetElementsByTagName ( "loctest" ); foreach ( XmlNode node in nodes ) { string city = toProperCase(node.ChildNodes[0].InnerText); string country = toProperCase(node.ChildNodes[1].InnerText); string gmt = node.ChildNodes[3].InnerText; string la_dir = node.ChildNodes[4].InnerText; string la = node.ChildNodes[5].InnerText; string lo_dir = node.ChildNodes[6].InnerText; string lo = node.ChildNodes[7].InnerText; double latitude = double.Parse ( la ); double longitude = double.Parse ( lo ); bool sign = gmt[0] == '+' ? false : true; latitude = la_dir == "NORTH" ? latitude : -latitude; longitude = lo_dir == "EAST" ? longitude : -longitude; double GMTDiff = TimeSpan.Parse ( gmt.Remove (0,1) ).TotalHours; GMTDiff = sign ? -GMTDiff : GMTDiff; LocDataElement elt = new LocDataElement(); elt.City = city; elt.Country = country; elt.DaylightAdjustment = 0; elt.GMTDiff = GMTDiff; elt.Latitude = latitude; elt.Longitude = longitude; locdata.Add(elt); locdatalist.Add(elt); } }
public void AddBugReport(LocDataElement location, DateTime fromdate, DateTime todate, Prayers[] p) { BugReport r = new BugReport(location, fromdate, todate, p); reports.Add(r); }