private static CountryDataGroup CreateCountryGroup(CountryDataItem cc) { CountryDataGroup group = new CountryDataGroup(); group.UniqueId = cc.UniqueId; group.Name = cc.Name; group.Currency = cc.Currency; group.Capital = cc.Capital; group.Key = cc.Key; _countryDataSource.AllGroups.Add(group); return(group); }
private static void CreateCountrysAndCountryGroups(XDocument doc) { int i = 0; foreach (XElement e in doc.Descendants("Country")) { CountryDataItem cc = new CountryDataItem(); CountryDataGroup group = null; cc.Name = e.Element("Name").Value; char key = char.ToUpper(cc.Name[0]); cc.Key = key; cc.UniqueId = ++i; cc.Capital = e.Element("Capital").Value; cc.Currency = e.Element("Currency").Value; cc.Region = e.Element("Region").Value; cc.UTC = e.Element("UTC").Value; cc.MapImage = "png/" + (e.Element("Name").Value) + ".png"; cc.CountryImg = "img/" + (e.Element("Name").Value) + ".png"; cc.StartDate = e.Element("StartDate").Value; cc.EndDate = e.Element("EndDate").Value; cc.LocalTime = e.Element("UTC").Value; cc.Longitude = e.Element("Longitude").Value; cc.Latitude = e.Element("Latitude").Value; cc.Language = e.Element("Language").Value; cc.DialCode = e.Element("DialCode").Value; group = _countryDataSource.AllGroups.FirstOrDefault(c => c.Key.Equals(key)); if (group == null) { group = CreateCountryGroup(cc); } cc.Group = group; if (group != null) { group.Items.Add(cc); } } }
private static CountryDataGroup CreateCountryGroup(CountryDataItem cc) { CountryDataGroup group = new CountryDataGroup(); group.UniqueId = cc.UniqueId; group.Name = cc.Name; group.Currency = cc.Currency; group.Capital = cc.Capital; group.Key = cc.Key; _countryDataSource.AllGroups.Add(group); return group; }
private static void CreateCountrysAndCountryGroups(XDocument doc) { int i = 0; foreach (XElement e in doc.Descendants("Country")) { CountryDataItem cc = new CountryDataItem(); CountryDataGroup group = null; cc.Name = e.Element("Name").Value; char key = char.ToUpper(cc.Name[0]); cc.Key = key; cc.UniqueId = ++i; cc.Capital = e.Element("Capital").Value; cc.Currency = e.Element("Currency").Value; cc.Region = e.Element("Region").Value; cc.UTC = e.Element("UTC").Value; cc.MapImage = "png/" + (e.Element("Name").Value) + ".png"; cc.CountryImg = "img/" + (e.Element("Name").Value) + ".png"; cc.StartDate = e.Element("StartDate").Value; cc.EndDate = e.Element("EndDate").Value; cc.LocalTime = e.Element("UTC").Value; cc.Longitude = e.Element("Longitude").Value; cc.Latitude = e.Element("Latitude").Value; cc.Language = e.Element("Language").Value; cc.DialCode = e.Element("DialCode").Value; group = _countryDataSource.AllGroups.FirstOrDefault(c => c.Key.Equals(key)); if (group == null) group = CreateCountryGroup(cc); cc.Group = group; if (group != null) group.Items.Add(cc); } }