Com base na data, obtém os valores de hoje e os próximos dois dias do XML?
Objetivo: com base na data e no mês de hoje, obtenha os valores reais e os próximos dois dias do XML.
Problema: Embora meu c.Attribute ("Dia"). O valor muda, meu c.Attribute ("Month"). O valor permanece o mesmo. Portanto, se o dia atual for 30.04.2012, ele será exibido em 30 de abril de 2012, mas não em 01.05.2012 e em 02.05.2012. Como resolver isso?
Também não tenho certeza se issoDato = c.Attribute("Day").Value + "." + c.Attribute("Month").Value + "." + myDay.Year.ToString(),
é bom? Eu quero que a caixa de listagem mostre a data do xml que está recebendo.
Por favor ajude. Meu código, XML e classe abaixo.
<code>var filteredData3 = from c in loadedCustomData.Descendants("PrayerTime") where int.Parse(c.Attribute("Day").Value) >= myDay.Day && int.Parse(c.Attribute("Day").Value) < (myDay.Day + 3) && c.Attribute("Month").Value == myDay.Month.ToString() select new Bønn() { Dato = c.Attribute("Day").Value + "." + c.Attribute("Month").Value + "." + myDay.Year.ToString(), Fajr = TimeSpan.Parse(c.Attribute("Fajr").Value), Sunrise = TimeSpan.Parse(c.Attribute("Sunrise").Value), Zohr = TimeSpan.Parse(c.Attribute("Zohr").Value), Asr = TimeSpan.Parse(c.Attribute("Asr").Value), Maghrib = TimeSpan.Parse(c.Attribute("Maghrib").Value), Isha = TimeSpan.Parse(c.Attribute("Isha").Value), Jumma = TimeSpan.Parse(c.Attribute("Jumma").Value), }; listBox1.ItemsSource = filteredData3; </code>
Aqui está minha aula:
<code>public class Bønn { public TimeSpan Fajr { get; set; } public TimeSpan Sunrise { get; set; } public TimeSpan Zohr { get; set; } public TimeSpan Asr { get; set; } public TimeSpan Maghrib { get; set; } public TimeSpan Isha { get; set; } public TimeSpan Jumma { get; set; } public string Dato { get; set; } } </code>
Aqui está meu XML:
<code><PrayerTime Dag ="30" Måned="4" Fajr="04:09" Sunrise="05:19" Zohr="13:19" Asr="18:30" Maghrib="21:14" Isha="22:24" /> <PrayerTime Dag ="1" Måned="5" Fajr="04:08" Sunrise="05:16" Zohr="13:19" Asr="18:31" Maghrib="21:17" Isha="22:25" /> <PrayerTime Dag ="2" Måned="5" Fajr="04:06" Sunrise="05:13" Zohr="13:19" Asr="18:33" Maghrib="21:19" Isha="22:27" /> </code>