[XmlRoot("Komunikaty")]
public class Komunikaty
{
[XmlElement("ogolne")]
public List<Komunikat> ogolne;
[XmlElement("helpdesk")]
public List<Komunikat> helpdesk;
public Komunikaty()
{
ogolne = new List<Komunikat>();
helpdesk = new List<Komunikat>();
}
public int OgolneIlosc()
{
return ogolne.Count;
}
public int HelpdeskIlosc()
{
return helpdesk.Count;
}
public int OgolneNowe()
{
int il = 0;
foreach (Komunikat k in ogolne)
{
if (k.odczytany == false)
il++;
}
return il;
}
public int HelpdeskNowe()
{
int il = 0;
foreach (Komunikat k in helpdesk)
{
if (k.odczytany == false)
il++;
}
return il;
}
public void OgolneOdczytane()
{
foreach (Komunikat k in ogolne)
{
k.odczytany = true;
}
}
public void HelpdeskOdczytane()
{
foreach (Komunikat k in helpdesk)
{
k.odczytany = true;
}
}
public void OgolnePut(string tytul, string data, string tresc, int id, int typ )
{
ogolne.Add(new Komunikat(tytul, data, tresc, id, typ));
}
public void HelpdeskPut(string tytul, string data, string tresc, int id, int typ)
{
helpdesk.Add(new Komunikat(tytul, data, tresc, id, typ));
}
public Komunikat OgolneGet(int i)
{
return ogolne[i];
}
public Komunikat HelpdeskGet(int i)
{
return helpdesk[i];
}
}
public class Komunikat
{
[XmlElement("temat")]
public string temat;
[XmlElement("data")]
public string data;
[XmlElement("odczytany")]
public bool odczytany;
[XmlElement("tresc")]
public string tresc;
[XmlElement("id")]
public int id;
[XmlElement("typ")]
public int typ;
public Komunikat()
{
}
public Komunikat(string _temat, string _data, string _tresc, int _id, int _typ)
{
this.temat = _temat;
this.data = _data;
this.tresc = _tresc;
this.id = _id;
this.typ = _typ;
}
public override string ToString()
{
return temat + Environment.NewLine + data + Environment.NewLine + tresc;
}
}