private void FormAnalogTuningDetail_Load(object sender, EventArgs e)
        {
            CountryCollection countries = new CountryCollection();

            comboBoxCountry.Items.AddRange(countries.Countries);

            if (TuningDetail != null)
            {
                //Editing
                textBoxChannel.Text         = TuningDetail.ChannelNumber.ToString();
                comboBoxInput.SelectedIndex = 0;
                if (TuningDetail.TuningSource == (int)TunerInputType.Cable)
                {
                    comboBoxInput.SelectedIndex = 1;
                }
                comboBoxCountry.SelectedIndex     = TuningDetail.CountryId;
                comboBoxVideoSource.SelectedIndex = TuningDetail.VideoSource;
                comboBoxAudioSource.SelectedIndex = TuningDetail.AudioSource;
                textBoxAnalogFrequency.Text       = SetFrequency(TuningDetail.Frequency, "2");
                checkBoxVCR.Checked = TuningDetail.IsVCRSignal;
            }
            else
            {
                //Editing
                textBoxChannel.Text               = "";
                comboBoxInput.SelectedIndex       = -1;
                comboBoxCountry.SelectedIndex     = -1;
                comboBoxVideoSource.SelectedIndex = -1;
                comboBoxAudioSource.SelectedIndex = -1;
                textBoxAnalogFrequency.Text       = "0";
                checkBoxVCR.Checked               = false;
            }
        }
        public void TestDelete()
        {
            Helper.DropAllCollections();

            var c = new Country {
                Code = "NL", Name = "Holanda"
            };

            c.Save();

            var countries = new CountryCollection();

            countries.Find(X => X.Code, "NL");
            Assert.AreEqual(1, countries.Count);

            foreach (Country country in countries)
            {
                country.Delete();
            }

            //TODO: Pruebas Replica Set
            //System.Threading.Thread.Sleep(5000);

            countries.Find(X => X.Code, "NL");
            Assert.AreEqual(0, countries.Count);
        }
Ejemplo n.º 3
0
 public CountryCollection FetchAll()
 {
     CountryCollection coll = new CountryCollection();
     Query qry = new Query(Country.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Ejemplo n.º 4
0
        protected void BindGrid()
        {
            CountryCollection       countryCollection       = CountryManager.GetAllCountries();
            PaymentMethodCollection paymentMethodCollection = PaymentMethodManager.GetAllPaymentMethods(null, false);

            if (countryCollection.Count == 0)
            {
                lblMessage.Text = GetLocaleResourceString("Admin.PaymentMethodsFilterControl.NoCountryDefined");
            }
            if (paymentMethodCollection.Count == 0)
            {
                lblMessage.Text = GetLocaleResourceString("Admin.PaymentMethodsFilterControl.NoPaymentMethodDefined");
            }

            List <PaymentMethodCountryMappingHelperClass> dt = new List <PaymentMethodCountryMappingHelperClass>();

            foreach (Country country in countryCollection)
            {
                PaymentMethodCountryMappingHelperClass map1 = new PaymentMethodCountryMappingHelperClass();
                map1.CountryId   = country.CountryId;
                map1.CountryName = country.Name;
                map1.Restrict    = new Dictionary <int, bool>();

                foreach (PaymentMethod paymentMethod in paymentMethodCollection)
                {
                    map1.Restrict.Add(paymentMethod.PaymentMethodId, PaymentMethodManager.DoesPaymentMethodCountryMappingExist(paymentMethod.PaymentMethodId, country.CountryId));
                }

                dt.Add(map1);
            }

            gvPaymentMethodCountryMap.DataSource = dt;
            gvPaymentMethodCountryMap.DataBind();
        }
 public void CanAddCountriesToCollection()
 {
     var c = new Country("MEE");
     var collection = new CountryCollection();
     collection.Add(c);
     Assert.That(collection.Count(), Is.EqualTo(1));
 }
Ejemplo n.º 6
0
        protected void BindGrid()
        {
            CountryCollection        countryCollection        = CountryManager.GetAllCountries();
            ShippingMethodCollection shippingMethodCollection = ShippingMethodManager.GetAllShippingMethods();

            if (countryCollection.Count == 0)
            {
                lblMessage.Text = GetLocaleResourceString("Admin.ShippingMethodsFilterControl.NoCountryDefined");
            }
            if (shippingMethodCollection.Count == 0)
            {
                lblMessage.Text = GetLocaleResourceString("Admin.ShippingMethodsFilterControl.NoShippingMethodDefined");
            }

            List <ShippingMethodCountryMappingHelperClass> dt = new List <ShippingMethodCountryMappingHelperClass>();

            foreach (Country country in countryCollection)
            {
                ShippingMethodCountryMappingHelperClass map1 = new ShippingMethodCountryMappingHelperClass();
                map1.CountryId   = country.CountryId;
                map1.CountryName = country.Name;
                map1.Restrict    = new Dictionary <int, bool>();

                foreach (ShippingMethod shippingMethod in shippingMethodCollection)
                {
                    map1.Restrict.Add(shippingMethod.ShippingMethodId, ShippingMethodManager.DoesShippingMethodCountryMappingExist(shippingMethod.ShippingMethodId, country.CountryId));
                }

                dt.Add(map1);
            }

            gvShippingMethodCountryMap.DataSource = dt;
            gvShippingMethodCountryMap.DataBind();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RadioWebStreamChannel"/> class.
 /// </summary>
 public RadioWebStreamChannel()
 {
   CountryCollection collection = new CountryCollection();
   _country = collection.GetTunerCountryFromID(31);
   Name = String.Empty;
   Url = String.Empty;
 }
Ejemplo n.º 8
0
        public void Cursor()
        {
            Helper.DropAllCollections();

            for (int i = 0; i < 50; i++)
            {
                Country c = new Country();
                c.Code = "C" + i.ToString();
                c.Name = "Name" + i.ToString();
                c.Save();
            }

            CountryCollection col = new CountryCollection();

            col.Find().Sort(col.Sort.Descending("Code"));

            Console.WriteLine(col.Count);

            foreach (var c in col)
            {
                Console.WriteLine(c.Code);
            }

            col.AddIncludeFields("Code");
            col.AddExcludeFields("Name");
            col.Find(C => C.Name, "Name%");

            foreach (var c in col)
            {
                Console.WriteLine(c.Code + " | " + c.Name);
            }
        }
        public void Cursor()
        {

            Helper.DropAllCollections();

            for (int i = 0; i < 50; i++)
            {
                Country c = new Country();
                c.Code = "C" + i.ToString();
                c.Name = "Name" + i.ToString();
                c.Save();
            }

            CountryCollection col = new CountryCollection();
            col.Find().Sort(col.Sort.Descending("Code"));
       
            Console.WriteLine(col.Count);

            foreach (var c in col)
            {
                Console.WriteLine(c.Code);
            }

            col.AddIncludeFields("Code");
            col.AddExcludeFields("Name");
            col.Find(C=>C.Name, "Name%");

            foreach (var c in col)
            {
                Console.WriteLine(c.Code + " | " + c.Name);
            }

        }
Ejemplo n.º 10
0
        void BindGrid()
        {
            CountryCollection countryCollection = CountryManager.GetAllCountries();

            gvCountries.DataSource = countryCollection;
            gvCountries.DataBind();
        }
Ejemplo n.º 11
0
        private void FillDropDowns()
        {
            this.ddlUPSCustomerClassification.Items.Clear();
            string[] customerClassifications = Enum.GetNames(typeof(UPSCustomerClassification));
            foreach (string cc in customerClassifications)
            {
                ListItem ddlItem1 = new ListItem(CommonHelper.ConvertEnum(cc), cc);
                this.ddlUPSCustomerClassification.Items.Add(ddlItem1);
            }

            this.ddlUPSPickupType.Items.Clear();
            string[] pickupTypies = Enum.GetNames(typeof(UPSPickupType));
            foreach (string pt in pickupTypies)
            {
                ListItem ddlItem1 = new ListItem(CommonHelper.ConvertEnum(pt), pt);
                this.ddlUPSPickupType.Items.Add(ddlItem1);
            }

            this.ddlUPSPackagingType.Items.Clear();
            string[] packagingTypies = Enum.GetNames(typeof(UPSPackagingType));
            foreach (string pt in packagingTypies)
            {
                ListItem ddlItem1 = new ListItem(CommonHelper.ConvertEnum(pt), pt);
                this.ddlUPSPackagingType.Items.Add(ddlItem1);
            }

            this.ddlShippedFromCountry.Items.Clear();
            CountryCollection countries = CountryManager.GetAllCountries();

            foreach (Country country in countries)
            {
                ListItem ddlItem1 = new ListItem(country.Name, country.CountryId.ToString());
                this.ddlShippedFromCountry.Items.Add(ddlItem1);
            }
        }
 public void CantAddDuplicateCountriesToCollection()
 {
     var c = new Country("MEE");
     var c2 = new Country("MEE");
     var collection = new CountryCollection();
     collection.Add(c);
     Assert.That(() => collection.Add(c2), Throws.ArgumentException);
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RadioWebStreamChannel"/> class.
        /// </summary>
        public RadioWebStreamChannel()
        {
            CountryCollection collection = new CountryCollection();

            _country = collection.GetTunerCountryFromID(31);
            Name     = String.Empty;
            Url      = String.Empty;
        }
Ejemplo n.º 14
0
        private void ImportImperatorCountry(
            Country country,
            CountryCollection imperatorCountries,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            NicknameMapper nicknameMapper,
            CharacterCollection characters,
            Date conversionDate
            )
        {
            // Create a new title or update existing title
            var name = DetermineName(country, imperatorCountries, tagTitleMapper, locDB);

            if (TryGetValue(name, out var existingTitle))
            {
                existingTitle.InitializeFromTag(
                    country,
                    imperatorCountries,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
            }
            else
            {
                Add(
                    country,
                    imperatorCountries,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    tagTitleMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
            }
        }
Ejemplo n.º 15
0
        public void FieldsCanBeSet()
        {
            var reader = new BufferedReader(
                "= {\n" +
                "\ttag=\"WTF\"" +
                "\tcountry_name = {\n" +
                "\t\tname=\"WTF\"\n" +
                "\t}\n" +
                "\tflag=\"WTF\"" +
                "\tcapital = 32\n" +
                "\tcurrency_data={ manpower=1 gold=2 stability=69 tyranny=4 war_exhaustion=2 aggressive_expansion=50 political_influence=4 military_experience=1}" +
                "\tmonarch=69" +
                "\tprimary_culture=athenian" +
                "\treligion=hellenic" +
                "\tcolor = rgb { 1 2 3 }" +
                "\tcolor2 = rgb { 4 5 6 }" +
                "\tcolor3 = rgb { 7 8 9 }" +
                "\tgovernment_key = dictatorship" +
                "}"
                );
            var country = Country.Parse(reader, 42);

            Assert.Equal((ulong)42, country.Id);
            Assert.Equal("WTF", country.Tag);
            Assert.Equal("WTF", country.Name);
            Assert.Equal("WTF", country.Flag);
            Assert.Equal((ulong)32, country.Capital);
            Assert.Equal(1, country.Currencies.Manpower);
            Assert.Equal(2, country.Currencies.Gold);
            Assert.Equal(69, country.Currencies.Stability);
            Assert.Equal(4, country.Currencies.Tyranny);
            Assert.Equal(2, country.Currencies.WarExhaustion);
            Assert.Equal(50, country.Currencies.AggressiveExpansion);
            Assert.Equal(4, country.Currencies.PoliticalInfluence);
            Assert.Equal(1, country.Currencies.MilitaryExperience);
            Assert.Null(country.Monarch);             // not linked yet
            Assert.Equal("athenian", country.PrimaryCulture);
            Assert.Equal("hellenic", country.Religion);
            Assert.Equal(new Color(new[] { 1, 2, 3 }), country.Color1);
            Assert.Equal(new Color(new[] { 4, 5, 6 }), country.Color2);
            Assert.Equal(new Color(new[] { 7, 8, 9 }), country.Color3);
            Assert.Equal("dictatorship", country.Government);
            Assert.Equal(GovernmentType.monarchy, country.GovernmentType);

            var countries = new CountryCollection {
                country
            };
            var monarch = ImperatorToCK3.Imperator.Characters.Character.Parse(
                new BufferedReader("{ country=42 }"),
                "69",
                null
                );

            monarch.LinkCountry(countries);
            Assert.NotNull(country.Monarch);
            Assert.Equal((ulong)69, country.Monarch.Id);
        }
Ejemplo n.º 16
0
        public void TestPop()
        {
            Helper.DropAllCollections();

            var c = new Country {
                Code = "PT", Name = "Portugal"
            };

            c.Save();
            c = new Country {
                Code = "ES", Name = "España"
            };
            c.Save();
            c = new Country {
                Code = "UK", Name = "Reino Unido"
            };
            c.Save();
            c = new Country {
                Code = "US", Name = "Estados Unidos"
            };
            c.Save();

            var countries = new CountryCollection();

            countries.Find();

            Assert.AreEqual(4, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "PT");

            Assert.AreEqual(3, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "ES");

            Assert.AreEqual(2, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "UK");

            Assert.AreEqual(1, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "US");

            Assert.AreEqual(0, countries.Count);

            c = countries.Pop();

            Assert.IsNull(c);
        }
Ejemplo n.º 17
0
        public void TestPopCustomSort()
        {
            Helper.DropAllCollections();

            var c = new Country {
                Code = "A", Name = "A"
            };

            c.Save();
            c = new Country {
                Code = "B", Name = "B"
            };
            c.Save();
            c = new Country {
                Code = "C", Name = "C"
            };
            c.Save();
            c = new Country {
                Code = "D", Name = "D"
            };
            c.Save();

            var countries = new CountryCollection();

            countries.Find();

            Assert.AreEqual(4, countries.Count);

            c = countries.Pop(new BsonDocument(), countries.Sort.Ascending(C => C.Code));

            Assert.AreEqual(c.Code, "A");

            Assert.AreEqual(3, countries.Count);

            c = countries.Pop(new BsonDocument(), countries.Sort.Ascending(C => C.Code));

            Assert.AreEqual(c.Code, "B");

            Assert.AreEqual(2, countries.Count);

            c = countries.Pop(new BsonDocument(), countries.Sort.Ascending(C => C.Code));

            Assert.AreEqual(c.Code, "C");

            Assert.AreEqual(1, countries.Count);

            c = countries.Pop(new BsonDocument(), countries.Sort.Ascending(C => C.Code));

            Assert.AreEqual(c.Code, "D");

            Assert.AreEqual(0, countries.Count);

            c = countries.Pop(new BsonDocument(), countries.Sort.Ascending(C => C.Code));

            Assert.IsNull(c);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Loads the countries.
        /// </summary>
        private void LoadCountries()
        {
            CountryController countryController = new CountryController();
            CountryCollection countryCollection = countryController.FetchAll();

            ddlCountry.DataSource     = countryCollection;
            ddlCountry.DataTextField  = "Name";
            ddlCountry.DataValueField = "Code";
            ddlCountry.DataBind();
        }
Ejemplo n.º 19
0
 private static LocBlock?GetValidatedName(Country imperatorCountry, CountryCollection imperatorCountries, LocDB locDB)
 {
     return(imperatorCountry.Name switch {
         // hard code for Antigonid Kingdom, Seleucid Empire and Maurya
         // these countries use customizable localization for name and adjective
         "PRY_DYN" => locDB.GetLocBlockForKey("get_pry_name_fallback"),
         "SEL_DYN" => locDB.GetLocBlockForKey("get_sel_name_fallback"),
         "MRY_DYN" => locDB.GetLocBlockForKey("get_mry_name_fallback"),
         _ => imperatorCountry.CountryName.GetNameLocBlock(locDB, imperatorCountries)
     });
Ejemplo n.º 20
0
        private void FillDropDowns()
        {
            this.ddlCountry.Items.Clear();
            CountryCollection countryCollection = CountryManager.GetAllCountries();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryID.ToString());
                this.ddlCountry.Items.Add(ddlCountryItem2);
            }
        }
Ejemplo n.º 21
0
        private void FillCountryDropDowns()
        {
            ddlCountry.Items.Clear();
            CountryCollection countryCollection = CountryManager.GetAllCountriesForRegistration();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryId.ToString());
                ddlCountry.Items.Add(ddlCountryItem2);
            }
        }
Ejemplo n.º 22
0
        public void LinkCountries(CountryCollection countries)
        {
            var counter = this.Count(character => character.LinkCountry(countries));

            Logger.Info($"{counter} countries linked to characters.");

            counter = this.Count(character => character.LinkHomeCountry(countries));
            Logger.Info($"{counter} home countries linked to characters.");

            counter = this.Count(character => character.LinkPrisonerHome(countries));
            Logger.Info($"{counter} prisoner homes linked to characters.");
        }
        public static CountryProtocol[] ConvertCollection(CountryCollection countries)
        {
            CountryProtocol[] protoCountries = new CountryProtocol[countries.Count];

            int i = 0;
            foreach(Country country in countries)
            {
                protoCountries[i] = new CountryProtocol( country );
                i++;
            }

            return protoCountries;
        }
        private void FillCountryDropDowns()
        {
            DropDownList ddlCountry = (DropDownList)CreateUserWizardStep1.ContentTemplateContainer.FindControl("ddlCountry");

            ddlCountry.Items.Clear();
            CountryCollection countryCollection = CountryManager.GetAllCountriesForRegistration();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryID.ToString());
                ddlCountry.Items.Add(ddlCountryItem2);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalogChannel"/> class.
        /// </summary>
        public AnalogChannel()
        {
            CountryCollection collection = new CountryCollection();

            _country        = collection.GetTunerCountryFromID(31);
            TunerSource     = TunerInputType.Cable;
            _videoInputType = VideoInputType.Tuner;
            _audioInputType = AudioInputType.Automatic;
            _channelNumber  = 4;
            _isRadio        = false;
            _vcrSginal      = false;
            Name            = String.Empty;
        }
Ejemplo n.º 26
0
        private static CountryCollection DBMapping(DBCountryCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            CountryCollection collection = new CountryCollection();
            foreach (DBCountry dbItem in dbCollection)
            {
                Country item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
Ejemplo n.º 27
0
        public void TestPopCustomSort()
        {

            Helper.DropAllCollections();

            var c = new Country { Code = "A", Name = "A" };
            c.Save();
            c = new Country { Code = "B", Name = "B" };
            c.Save();
            c = new Country { Code = "C", Name = "C" };
            c.Save();
            c = new Country { Code = "D", Name = "D" };
            c.Save();

            var countries = new CountryCollection();

            countries.Find();

            Assert.AreEqual(4, countries.Count);

            c = countries.Pop(Query.Null, SortBy<Country>.Ascending(C=>C.Code));

            Assert.AreEqual(c.Code, "A");

            Assert.AreEqual(3, countries.Count);

            c = countries.Pop(Query.Null, SortBy<Country>.Ascending(C=>C.Code));

            Assert.AreEqual(c.Code, "B");

            Assert.AreEqual(2, countries.Count);

            c = countries.Pop(Query.Null, SortBy<Country>.Ascending(C=>C.Code));

            Assert.AreEqual(c.Code, "C");

            Assert.AreEqual(1, countries.Count);

            c = countries.Pop(Query.Null, SortBy<Country>.Ascending(C=>C.Code));

            Assert.AreEqual(c.Code, "D");

            Assert.AreEqual(0, countries.Count);

            c = countries.Pop(Query.Null, SortBy<Country>.Ascending(C=>C.Code));

            Assert.IsNull(c);


        }
Ejemplo n.º 28
0
        protected void FillCountryDropDowns()
        {
            this.ddlTaxDefaultCountry.Items.Clear();
            ListItem noCountryItem = new ListItem(GetLocaleResourceString("Admin.TaxSettings.TaxDefaultCountry.SelectCountry"), "0");

            this.ddlTaxDefaultCountry.Items.Add(noCountryItem);
            CountryCollection countryCollection = CountryManager.GetAllCountries();

            foreach (Country country in countryCollection)
            {
                ListItem ddlCountryItem2 = new ListItem(country.Name, country.CountryID.ToString());
                this.ddlTaxDefaultCountry.Items.Add(ddlCountryItem2);
            }
        }
Ejemplo n.º 29
0
        public void TestPopCustomSortCustomQuery()
        {
            Helper.DropAllCollections();

            var c = new Country {
                Code = "A", Name = "1"
            };

            c.Save();
            c = new Country {
                Code = "B", Name = "1"
            };
            c.Save();
            c = new Country {
                Code = "C", Name = "C"
            };
            c.Save();
            c = new Country {
                Code = "D", Name = "1"
            };
            c.Save();

            var countries = new CountryCollection();

            countries.Find();

            Assert.AreEqual(4, countries.Count);

            c = countries.Pop(MongoQuery <Country> .Eq(C => C.Name, "1"), countries.Sort.Descending(C => C.Code));

            Assert.AreEqual(c.Code, "D");

            Assert.AreEqual(3, countries.Count);

            c = countries.Pop(MongoQuery <Country> .Eq(C => C.Name, "1"), countries.Sort.Descending(C => C.Code));

            Assert.AreEqual(c.Code, "B");

            Assert.AreEqual(2, countries.Count);

            c = countries.Pop(MongoQuery <Country> .Eq(C => C.Name, "1"), countries.Sort.Descending(C => C.Code));

            Assert.AreEqual(c.Code, "A");

            Assert.AreEqual(1, countries.Count);

            c = countries.Pop(MongoQuery <Country> .Eq(C => C.Name, "1"), countries.Sort.Descending(C => C.Code));

            Assert.IsNull(c);
        }
Ejemplo n.º 30
0
        public void TestPop()
        {

            Helper.DropAllCollections();

            var c = new Country { Code = "PT", Name = "Portugal" };
            c.Save();
            c = new Country { Code = "ES", Name = "España"};
            c.Save();
            c = new Country { Code = "UK", Name = "Reino Unido"};
            c.Save();                     
            c = new Country { Code = "US", Name = "Estados Unidos"};
            c.Save();

            var countries = new CountryCollection();

            countries.Find();

            Assert.AreEqual(4 , countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "PT");

            Assert.AreEqual(3, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "ES");

            Assert.AreEqual(2, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "UK");

            Assert.AreEqual(1, countries.Count);

            c = countries.Pop();

            Assert.AreEqual(c.Code, "US");

            Assert.AreEqual(0, countries.Count);

            c = countries.Pop();

            Assert.IsNull(c);


        }
Ejemplo n.º 31
0
        public static CountryProtocol[] ConvertCollection(CountryCollection countries)
        {
            CountryProtocol[] protoCountries = new CountryProtocol[countries.Count];

            int i = 0;

            foreach (Country country in countries)
            {
                protoCountries[i] = new CountryProtocol(country);
                i++;
            }

            return(protoCountries);
        }
Ejemplo n.º 32
0
        public void Test()
        {
            Helper.DropAllCollections();

            var country = new Country {
                Code = "NL", Name = "Holanda"
            };

            country.Save();
            country = new Country {
                Code = "UK", Name = "Reino Unido"
            };
            country.Save();
            country = new Country {
                Code = "ES", Name = "España"
            };
            country.Save();

            var col = new CountryCollection {
                FromPrimary = false
            };

            col.Find();

            foreach (Country c in col)
            {
                Console.WriteLine(c.Name);
            }

            col.Find().Limit(1);

            //Console.WriteLine(col.Cursor.Explain().ToJson());

            Assert.AreEqual(1, col.Count);
            Assert.AreEqual(3, col.Total);

            col = new CountryCollection {
                FromPrimary = true
            };
            col.Find().Limit(3).Sort(col.Sort.Ascending(C => C.Name));

            Assert.AreEqual(3, col.Count);
            Assert.AreEqual("ES", col.First().Code);

            col.Find(MongoQuery <Country> .Eq(C => C.Code, "NL"));

            Assert.AreEqual("NL", col.First().Code);
            //TODO: No esta implementado el last Assert.AreEqual("NL", col.Last().Code);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Loads a collection of Country objects from the database.
        /// </summary>
        /// <returns>A collection containing all of the Country objects in the database.</returns>
        public static CountryCollection LoadCollection(string spName, SqlParameter[] parms)
        {
            CountryCollection result = new CountryCollection();

            using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms))
            {
                while (reader.Read())
                {
                    Country tmp = new Country();
                    tmp.LoadFromReader(reader);
                    result.Add(tmp);
                }
            }
            return(result);
        }
Ejemplo n.º 34
0
        public static CountryCollection GetAllItem()
        {
            CountryCollection collection = new CountryCollection();

            using (var reader = SqlHelper.ExecuteReader("tblCountry_GetAll", null))
            {
                while (reader.Read())
                {
                    Country obj = new Country();
                    obj = GetItemFromReader(reader);
                    collection.Add(obj);
                }
            }
            return(collection);
        }
Ejemplo n.º 35
0
        public Form1()
        {
            InitializeComponent();

            CountryCollection countryCollection = new CountryCollection();

            cboCountry.DataSource    = countryCollection.GetCountries();
            cboCountry.DisplayMember = "CountryName";
            cboCountry.ValueMember   = "CountryId";


            StateCollections stateCollections = new StateCollections();

            cboState.DataSource    = stateCollections.GetStates();
            cboState.DisplayMember = "StateName";
            cboState.ValueMember   = "StateId";
        }
Ejemplo n.º 36
0
        private static CountryCollection DBMapping(DBCountryCollection dbCollection)
        {
            if (dbCollection == null)
            {
                return(null);
            }

            CountryCollection collection = new CountryCollection();

            foreach (DBCountry dbItem in dbCollection)
            {
                Country item = DBMapping(dbItem);
                collection.Add(item);
            }

            return(collection);
        }
Ejemplo n.º 37
0
        public void ImportImperatorCountries(
            CountryCollection imperatorCountries,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            CoaMapper coaMapper,
            GovernmentMapper governmentMapper,
            SuccessionLawMapper successionLawMapper,
            DefiniteFormMapper definiteFormMapper,
            ReligionMapper religionMapper,
            CultureMapper cultureMapper,
            NicknameMapper nicknameMapper,
            CharacterCollection characters,
            Date conversionDate
            )
        {
            Logger.Info("Importing Imperator Countries...");

            // landedTitles holds all titles imported from CK3. We'll now overwrite some and
            // add new ones from Imperator tags.
            var counter = 0;

            // We don't need pirates, barbarians etc.
            foreach (var country in imperatorCountries.Where(c => c.CountryType == CountryType.real))
            {
                ImportImperatorCountry(
                    country,
                    imperatorCountries,
                    tagTitleMapper,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    governmentMapper,
                    successionLawMapper,
                    definiteFormMapper,
                    religionMapper,
                    cultureMapper,
                    nicknameMapper,
                    characters,
                    conversionDate
                    );
                ++counter;
            }
            Logger.Info($"Imported {counter} countries from I:R.");
        }
Ejemplo n.º 38
0
        public void TestPerfMongoFindNormalVsExtensionMethods()
        {
            Helper.DropAllCollections();

            //Insert de Paises
            var c = new Country {
                Code = "ES", Name = "España"
            };

            c.Save();
            c = new Country {
                Code = "UK", Name = "Reino Unido"
            };
            c.Save();
            c = new Country {
                Code = "US", Name = "Estados Unidos"
            };
            c.Save();

            Stopwatch timer = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                var countries = new List <Country>();
                countries.MongoFind(
                    Builders <Country> .Filter.Or(MongoQuery <Country> .Eq(co => co.Code, "ES"), MongoQuery <Country> .Eq(co => co.Code, "UK")));
            }
            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para ExtensionMethod: {0}", timer.Elapsed));
            //Elapsed para ExtensionMethod: 00:04:29.8042031

            timer = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                CountryCollection mongoCol = new CountryCollection();
                mongoCol.Find(
                    mongoCol.Filter.Or(MongoQuery <Country> .Eq(co => co.Code, "ES"), MongoQuery <Country> .Eq(co => co.Code, "UK")));
                mongoCol.ToList();
            }

            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para StaticMethod: {0}", timer.Elapsed));
            //Elapsed para StaticMethod: 00:04:10.1821050
        }
Ejemplo n.º 39
0
        private void ImportImperatorGovernorship(
            Governorship governorship,
            CountryCollection imperatorCountries,
            Imperator.Characters.CharacterCollection imperatorCharacters,
            bool regionHasMultipleGovernorships,
            TagTitleMapper tagTitleMapper,
            LocDB locDB,
            ProvinceMapper provinceMapper,
            DefiniteFormMapper definiteFormMapper,
            ImperatorRegionMapper imperatorRegionMapper,
            CoaMapper coaMapper)
        {
            var country = imperatorCountries[governorship.CountryId];
            // Create a new title or update existing title
            var name = DetermineName(governorship, country, tagTitleMapper);

            if (TryGetValue(name, out var existingTitle))
            {
                existingTitle.InitializeFromGovernorship(
                    governorship,
                    country,
                    imperatorCharacters,
                    regionHasMultipleGovernorships,
                    locDB,
                    provinceMapper,
                    definiteFormMapper,
                    imperatorRegionMapper
                    );
            }
            else
            {
                Add(
                    governorship,
                    country,
                    imperatorCharacters,
                    regionHasMultipleGovernorships,
                    locDB,
                    provinceMapper,
                    coaMapper,
                    tagTitleMapper,
                    definiteFormMapper,
                    imperatorRegionMapper
                    );
            }
        }
        public void Test()
        {
            Helper.DropAllCollections();

            var country = new Country { Code = "NL", Name = "Holanda" };
            country.Save();
            country = new Country { Code = "UK", Name = "Reino Unido" };
            country.Save();
            country = new Country { Code = "ES", Name = "España" };
            country.Save();

            var col = new CountryCollection {FromPrimary = false};
            col.Find();

            foreach (Country c in col)
            {
                Console.WriteLine(c.Name);
            }

            col.Find().Limit(1);

            //Console.WriteLine(col.Cursor.Explain().ToJson());

            Assert.AreEqual(1, col.Count);
            Assert.AreEqual(3, col.Total);
       
            col = new CountryCollection {FromPrimary = true};
            col.Find().Limit(3).Sort(col.Sort.Ascending(C=>C.Name));
        
            Assert.AreEqual(3, col.Count);
            Assert.AreEqual("ES", col.First().Code);

            col.Find(MongoQuery<Country>.Eq(C => C.Code, "NL"));

            Assert.AreEqual("NL", col.First().Code);
            //TODO: No esta implementado el last Assert.AreEqual("NL", col.Last().Code);

       

        }
        public void TestDelete()
        {
            Helper.DropAllCollections();

            var c = new Country {Code = "NL", Name = "Holanda"};
            c.Save();

            var countries = new CountryCollection();
            countries.Find(X=>X.Code, "NL");
            Assert.AreEqual(1,countries.Count);

            foreach (Country country in countries)
            {
                country.Delete();
            }

            //TODO: Pruebas Replica Set
            //System.Threading.Thread.Sleep(5000);

            countries.Find(X=>X.Code, "NL");
            Assert.AreEqual(0, countries.Count);
        }
Ejemplo n.º 42
0
        public void TestPerfMongoFindNormalVsExtensionMethods()
        {
            Helper.DropAllCollections();

            //Insert de Paises
            var c = new Country {Code = "ES", Name = "España"};
            c.Save();
            c = new Country {Code = "UK", Name = "Reino Unido"};
            c.Save();
            c = new Country {Code = "US", Name = "Estados Unidos"};
            c.Save();

            Stopwatch timer = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                var countries = new List<Country>();
                countries.MongoFind(
                    Builders<Country>.Filter.Or(MongoQuery<Country>.Eq(co => co.Code, "ES"), MongoQuery<Country>.Eq(co => co.Code, "UK")));
            }
            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para ExtensionMethod: {0}", timer.Elapsed));
            //Elapsed para ExtensionMethod: 00:04:29.8042031

            timer = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                CountryCollection mongoCol = new CountryCollection();
                mongoCol.Find(
                    mongoCol.Filter.Or(MongoQuery<Country>.Eq(co=>co.Code, "ES"), MongoQuery<Country>.Eq(co => co.Code, "UK")));
                mongoCol.ToList();
            }

            timer.Stop();
            Console.WriteLine(string.Format("Elapsed para StaticMethod: {0}", timer.Elapsed));
            //Elapsed para StaticMethod: 00:04:10.1821050
        }
        public void Test()
        {
            Helper.DropAllCollections();

            var country = new Country { Code = "NL", Name = "Holanda" };
            country.Save();
            country = new Country { Code = "UK", Name = "Reino Unido" };
            country.Save();
            country = new Country { Code = "ES", Name = "España" };
            country.Save();

            var col = new CountryCollection {FromPrimary = false};
            col.Find().SetLimit(1);

            Console.WriteLine(col.Cursor.Explain().ToJson());

            Assert.AreEqual(1, col.Count);
            Assert.AreEqual(3, col.Total);

            col = new CountryCollection {FromPrimary = true};
            col.Find().SetLimit(3).SetSortOrder(SortBy<Country>.Ascending(C=>C.Name));              

            Assert.AreEqual(3, col.Count);
            Assert.AreEqual("ES", col.First().Code);

            col.Find(Query<Country>.EQ(C => C.Code, "NL"));

            Assert.AreEqual("NL", col.First().Code);
            Assert.AreEqual("NL", col.Last().Code);

            foreach (Country c in col)
            {

            }

        }
Ejemplo n.º 44
0
 public CountryCollection FetchByQuery(Query qry)
 {
     CountryCollection coll = new CountryCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
        /// <summary>
        /// Function to retrieve country collection
        /// </summary>
        /// <param name="queryCountries">countries query</param>
        /// <returns>country collection</returns>
        private static CountryCollection RetriveCountryCollection(IEnumerable<Country> queryCountries)
        {
            CountryCollection countryCollection = new CountryCollection();
            foreach (Country country in queryCountries)
            {
                countryCollection.Add(country);
            }

            return countryCollection;
        }
        public void TestInsert()
        {
            Helper.DropAllCollections();


            //Paris
            var geoArea = new GeoArea();
            geoArea.type = "Polygon";            
            var coordinates = new List<double[]>();
            coordinates.Add(new double[] { 48.979766324449706, 2.098388671875 });
            coordinates.Add(new double[] { 48.972555195463336, 2.5982666015625 });
            coordinates.Add(new double[] { 48.683254235765325, 2.603759765625 });
            coordinates.Add(new double[] { 48.66874533279169, 2.120361328125 });
            coordinates.Add(new double[] { 48.979766324449706, 2.098388671875 });
            geoArea.coordinates = new [] {coordinates.ToArray()};

            //Insert de Paises
            var c = new Country {Code = "es", Name = "España", Area = geoArea};
            try
            {
                c.Save();
                Assert.Fail();
            }
            catch (ValidatePropertyException ex)
            {
                Assert.AreEqual(ex.GetBaseException().GetType(), typeof (ValidatePropertyException));
                c.Code = "ES";
                c.Save();
            }

            c = new Country { Code = "UK", Name = "Reino Unido", Area = geoArea};
            c.Save();

            c = new Country { Code = "UK", Name = "Reino Unido", Area = geoArea };
            try
            {
                c.Save();
                Assert.Fail();
            }
            catch (DuplicateKeyException ex)
            {
                Assert.AreEqual(ex.GetBaseException().GetType(), typeof (DuplicateKeyException));
            }

            c = new Country { Code = "US", Name = "Estados Unidos", Area = geoArea };
            c.Save();

            var countries = new CountryCollection();

            countries.Find(x=>x.Code, "ES");
            Assert.AreEqual(countries.Count, 1);

            countries.Find(x=>x.Code, "UK");
            Assert.AreEqual(countries.Count, 1);

            countries.Find(x=>x.Code, "US");
            Assert.AreEqual(countries.Count, 1);

            countries.Find();
            Assert.AreEqual(countries.Count, 3);

            //Insert de personas
            var p = new Person
                {
                    Name = "Pepito Perez",
                    Age = 35,
                    BirthDate = DateTime.Now.AddDays(57).AddYears(-35),
                    Married = true,
                    Country = "ES",
                    BankBalance = decimal.Parse("3500,00")
                };

            p.Childs.Add(
                new Child {ID = 1, Age = 10, BirthDate = DateTime.Now.AddDays(57).AddYears(-10), Name = "Juan Perez"});
            p.Childs.Add(
                new Child {ID = 2, Age = 7, BirthDate = DateTime.Now.AddDays(57).AddYears(-7), Name = "Ana Perez"});

            p.Save();

            p = new Person
                {
                    Name = "Juanito Sanchez",
                    Age = 25,
                    BirthDate = DateTime.Now.AddDays(52).AddYears(-38),
                    Married = true,
                    Country = "ES",
                    BankBalance = decimal.Parse("1500,00")
                };

            p.Childs.Add(
                new Child {ID = 1, Age = 5, BirthDate = DateTime.Now.AddDays(7).AddYears(-5), Name = "Toni Sanchez"});

            p.Save();

            p = new Person
                {
                    Name = "Andres Perez",
                    Age = 25,
                    BirthDate = DateTime.Now.AddDays(25).AddYears(-25),
                    Married = false,
                    Country = "ES",
                    BankBalance = decimal.Parse("500,00")
                };

            p.Save();

            p = new Person
                {
                    Name = "Marta Serrano",
                    Age = 28,
                    BirthDate = DateTime.Now.AddDays(28).AddYears(-28),
                    Married = false,
                    Country = "ES",
                    BankBalance = decimal.Parse("9500,00")
                };

            p.Childs.Add(
                new Child {ID = 1, Age = 2, BirthDate = DateTime.Now.AddDays(2).AddYears(-2), Name = "Toni Serrano"});
            p.Save();

            p = new Person
                {
                    Name = "Jonh Smith",
                    Age = 21,
                    BirthDate = DateTime.Now.AddDays(21).AddYears(-21),
                    Married = false,
                    Country = "US",
                    BankBalance = decimal.Parse("10000,00")
                };

            p.Save();

            var persons = new List<Person>();
            persons.MongoFind();

            Assert.AreEqual(persons.Count, 5);
        }
Ejemplo n.º 47
0
        public void Test()
        {
            Helper.DropAllCollections();

            ConfigManager.Out = Console.Out;

            var c = new Country {Code = "es", Name = "España"};
            try
            {
                c.Save();
                Assert.Fail();
            }
            catch (ValidatePropertyException ex)
            {
                Assert.AreEqual(ex.GetBaseException().GetType(), typeof (ValidatePropertyException));
                c.Code = "ES";
                c.Save();
            }

            c = new Country {Code = "UK", Name = "Reino Unido"};
            c.Save();

            c = new Country {Code = "UK", Name = "Reino Unido"};
            try
            {
                c.Save();
                Assert.Fail();
            }
            catch (DuplicateKeyException ex)
            {
                Assert.AreEqual(ex.GetBaseException().GetType(), typeof (DuplicateKeyException));
            }

            using (var t = new MongoMapperTransaction())
            {
                var c2 = new Country {Code = "US", Name = "Francia"};
                c2.OnBeforeInsert += (s, e) => { ((Country) s).Name = "Estados Unidos"; };
                c2.Save();

                t.Commit();
            }

            var c3 = new Country();
            c3.FillByKey("US");
            Assert.AreEqual(c3.Name, "Estados Unidos");

            if (!c3.IsLastVersion())
                c3.FillFromLastVersion();

            var countries = new CountryCollection();
            countries.Find();
            Assert.AreEqual(countries.Count, 3);

            countries.Find().Limit(2).Sort(countries.Sort.Ascending(C=>C.Name));
            Assert.AreEqual(countries.Count, 2);
            Assert.AreEqual(countries.Total, 3);

            countries.Find(
                countries.Filter.Or(MongoQuery<Country>.Eq(co => co.Code, "ES"), MongoQuery<Country>.Eq(co => co.Code, "UK")));
            Assert.AreEqual(countries.Count, 2);

            var p = new Person
                {
                    Name = "Pepito Perez",
                    Age = 35,
                    BirthDate = DateTime.Now.AddDays(57).AddYears(-35),
                    Married = true,
                    Country = "XXXXX",
                    BankBalance = decimal.Parse("3500,00")
                };

            p.Childs.Add(
                new Child {ID = 1, Age = 10, BirthDate = DateTime.Now.AddDays(57).AddYears(-10), Name = "Juan Perez"});

            try
            {
                p.Save();
                Assert.Fail();
            }
            catch (ValidateUpRelationException ex)
            {
                Assert.AreEqual(ex.GetBaseException().GetType(), typeof (ValidateUpRelationException));
                p.Country = "ES";
                p.Save();
            }

            p.ServerUpdate(
                p.Update.Push(
                    MongoMapperHelper.ConvertFieldName("Person","Childs"),
                    new Child {ID = 2, Age = 2, BirthDate = DateTime.Now.AddDays(57).AddYears(-7), Name = "Ana Perez"}));

            var persons = new List<Person>();

            persons.MongoFind();
            
            persons.MongoFind("Childs.Age", 2);
            Assert.AreEqual(1, persons.Count);
        }
Ejemplo n.º 48
0
        public void TestPopCustomSortCustomQuery()
        {

            Helper.DropAllCollections();

            var c = new Country { Code = "A", Name = "1" };
            c.Save();
            c = new Country { Code = "B", Name = "1" };
            c.Save();
            c = new Country { Code = "C", Name = "C" };
            c.Save();
            c = new Country { Code = "D", Name = "1" };
            c.Save();

            var countries = new CountryCollection();

            countries.Find();

            Assert.AreEqual(4, countries.Count);

            c = countries.Pop(MongoQuery<Country>.Eq(C => C.Name, "1"),countries.Sort.Descending(C=>C.Code));

            Assert.AreEqual(c.Code, "D");

            Assert.AreEqual(3, countries.Count);

            c = countries.Pop(MongoQuery<Country>.Eq(C => C.Name, "1"),countries.Sort.Descending(C => C.Code));

            Assert.AreEqual(c.Code, "B");

            Assert.AreEqual(2, countries.Count);

            c = countries.Pop(MongoQuery<Country>.Eq(C => C.Name, "1"),countries.Sort.Descending(C => C.Code));

            Assert.AreEqual(c.Code, "A");

            Assert.AreEqual(1, countries.Count);

            c = countries.Pop(MongoQuery<Country>.Eq(C => C.Name, "1"),countries.Sort.Descending(C => C.Code));

            Assert.IsNull(c);


        }
        private void SetupReferenceData()
        {
            var countries = new Country { CountryId = "1", Name = "USA", Code = "USA" };

            var states = new State { StateId = "2", CountryId = "1", Name = "Florida" };

            var ports = new Port { PortId = "1", City = "Florida", Name = "Miami", State = "Florida", StateId = "2", CountryId = "1" };

            var brands = new Brand { BrandId = "1", Name = "Carnival" };

            var personTypes = new PersonTypeEntity { PersonTypeId = "1001", Name = "Daniel" };

            var loyaltyLevelTypes = new LoyaltyLevelType { LoyaltyLevelTypeId = "1001", Name = "abc", BrandId = "1", NoOfCruiseNights = 3, LogoImageAddress = "abc" };

            var documentType = new DocumentType { CountryId = "232", Code = "USA", DocumentTypeId = "1", Name = "Passport" };

            var brand = new BrandCollection();

            var country = new CountryCollection();
            country.Add(countries);

            var state = new StateCollection();
            state.Add(states);

            var documentTypes = new DocumentTypeCollection();
            documentTypes.Add(documentType);

            var port = new PortCollection();
            port.Add(ports);

            var personTypeEntity = new PersonTypeEntityCollection();
            personTypeEntity.Add(personTypes);

            var loyaltyLevelType = new LoyaltyLevelTypeCollection();
            loyaltyLevelType.Add(loyaltyLevelTypes);

            this.referenceData.AssignBrands(brand);
            this.referenceData.AssignCountries(country);
            this.referenceData.AssignStates(state);
            this.referenceData.AssignDocumentTypes(documentTypes);
            this.referenceData.AssignLoyaltyLevelTypes(loyaltyLevelType);
            this.referenceData.AssignPersonTypes(personTypeEntity);
            this.referenceData.AssignPorts(port);
        }
Ejemplo n.º 50
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalogChannel"/> class.
 /// </summary>
 public AnalogChannel()
 {
   CountryCollection collection = new CountryCollection();
   _country = collection.GetTunerCountryFromID(31);
   TunerSource = TunerInputType.Cable;
   _videoInputType = VideoInputType.Tuner;
   _audioInputType = AudioInputType.Automatic;
   _channelNumber = 4;
   _isRadio = false;
   _vcrSginal = false;
   Name = String.Empty;
 }
        /// <summary>
        /// Retrieves the loyalty level types.
        /// </summary>
        private void RetrieveLoyaltyLevelTypesAndAllCountries()
        {
            var task = Task.Run(async () => await CacheManager.RetrieveLoyaltyLevelTypes());
            task.Wait();

            if (!task.IsCanceled && !task.IsFaulted)
            {
                this.tempLoyaltyLevelTypes = task.Result.ToList();
            }

            this.allCountries = CommonMethods.RetrieveAllCountries();
        }
Ejemplo n.º 52
0
 public CountryCollection FetchByID(object CountryId)
 {
     CountryCollection coll = new CountryCollection().Where("CountryId", CountryId).Load();
     return coll;
 }
Ejemplo n.º 53
0
        /// <summary>
        /// Maps the countries.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <returns>Country collection</returns>
        private static async Task<CountryCollection> MapCountries(SqlDataReader dataReader)
        {
            var countryCollection = new CountryCollection();
            if (dataReader != null)
            {
                while (await dataReader.ReadAsync())
                {
                    var country = new Country
                    {
                        CountryId = dataReader.Int32Field(CountryId).ToString(),
                        Code = dataReader.StringField(Code),
                        Name = dataReader.StringField(Name),
                        CountryFlagAddress = dataReader.StringField(CountryFlagAddress)
                    };

                    byte[] bytes = await country.CountryFlagAddress.ImageAddressToByteArray();
                    country.CountryIcon = bytes.ToBitmapSource();
                    countryCollection.Add(country);
                }
            }

            return countryCollection;
        }
 /// <summary>
 /// Retrieves the countries.
 /// </summary>
 private void RetrieveCountries()
 {
     this.allCountries = CommonMethods.RetrieveAllCountries();
 }
        /// <summary>
        /// Fill recent person list
        /// </summary>
        /// <param name="machineName">machine name</param>
        private void FillRecentPersonList(string machineName)
        {
            this.RecentPersons.Clear();
            var task = Task.Run(async () => await PersonsService.RetrieveRecentPersonsAsync(machineName));
            task.Wait();

            if (!task.IsCanceled && !task.IsFaulted)
            {
                this.ShowTopRecentPersons(task.Result);
            }

            this.allCountries = CommonMethods.RetrieveAllCountries();
        }