示例#1
0
        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);
        }
示例#2
0
        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);
                }
            }
        }
示例#3
0
 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;
 }
示例#4
0
        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);                
            }           
        }