public void showCountryInfo(ICountry c) { ICountryName CName = c.getCountry(); OfficialLanguage Clanguage = c.getLanguage(); Console.WriteLine(CName.GetType().Name + ":" + Clanguage.GetType().Name); }
public static IEnumerable <IProvince> Provinces(this ICountry country) { Guard.AgainstNull(country, nameof(country)); return(country.States .SelectMany(x => x.Provinces) .OrderBy(x => x.Name)); }
public DataSet SelectCountryTest(ICountry country) { DataSet tableVerify = new DataSet(); tableVerify = dbEntity.SelectObject(country) as DataSet; return(tableVerify); }
public void SetCountry(ICountry country) { if (_country == null || !_country.Equals(country)) { _country = country; } }
protected ICity Roulette(IAnt ant) { if (ant.Visited.Count - 1 == ant.CitiesToVisit) { return(ant.Colony.Destination); } if (TraverseLevel == 3) { ICountry country = GetCountryRouletteForAnt(ant).GetNext(); IRegion region = country.Regions.FirstOrDefault().Value; ICity city = region.Cities.FirstOrDefault().Value; return(city); } if (TraverseLevel == 2) { IRegion region = GetRegionRouletteForAnt(ant).GetNext(); ICity city = region.Cities.FirstOrDefault().Value; return(city); } return(GetCityRouletteForAnt(ant).GetNext()); }
private void GetBankCode_Valid_Input_Return_Correct_Value( ICountry country, string bban, string bankCode) { var valueGot = BbanSplitterValidValidation.GetBankCode(country, bban); Assert.AreEqual(bankCode, valueGot); }
public async Task <IActionResult> PostalCodes(string countryCode) { NullGuard.NotNullOrWhiteSpace(countryCode, nameof(countryCode)); ICountry country = await GetCountry(countryCode); if (country == null) { return(RedirectToAction("PostalCodes", "Contact")); } IGetPostalCodeCollectionQuery query = new GetPostalCodeCollectionQuery { CountryCode = countryCode }; IEnumerable <IPostalCode> postalCodes = await _queryBus.QueryAsync <IGetPostalCodeCollectionQuery, IEnumerable <IPostalCode> >(query); IEnumerable <PostalCodeViewModel> postalCodeViewModels = postalCodes.AsParallel() .Select(postalCode => _contactViewModelConverter.Convert <IPostalCode, PostalCodeViewModel>(postalCode)) .OrderBy(postalCodeViewModel => postalCodeViewModel.City) .ToList(); PartialViewResult result = PartialView("_PostalCodeTablePartial", postalCodeViewModels); result.ViewData.Add("CountryCode", countryCode); return(result); }
/// <summary> /// The method returns true or false if the Bank Code is valid or not for the specified Country. /// </summary> /// <param name="country"> /// Country that contains the information to validate the Bank Code. /// </param> /// <param name="bankCode"> /// Bank Code to validate. /// </param> /// <returns> /// True/False /// </returns> /// <exception cref="InvalidCountryException"> /// If Country is null an <see cref="InvalidCountryException" /> will be thrown. /// </exception> public override bool IsValid(ICountry country, string bankCode) { CheckNotNullCountry(country); return(IsValidDetailLenght(bankCode, country.BankCodeLength) && IsValidDetailStructure(bankCode, country.BankCodeStructure)); }
public async Task <IActionResult> AddAssociatedCompany(string countryCode) { NullGuard.NotNullOrWhiteSpace(countryCode, nameof(countryCode)); IRefreshableToken token = await _tokenHelperFactory.GetTokenAsync <IRefreshableToken>(TokenType.MicrosoftGraphToken, HttpContext); if (token == null) { return(Unauthorized()); } ICountry country = await GetCountry(countryCode); if (country == null) { return(BadRequest()); } CompanyViewModel companyViewModel = new CompanyViewModel { Address = new AddressViewModel { Country = country.DefaultForPrincipal ? null : country.UniversalName }, PrimaryPhone = country.PhonePrefix, SecondaryPhone = country.PhonePrefix }; ViewData.TemplateInfo.HtmlFieldPrefix = "Company"; return(PartialView("_EditCompanyPartial", companyViewModel)); }
/// <summary> /// Initializes Exchange object /// </summary> /// <param name="ExchangeName">Name</param> /// <param name="defaultCurrency">Default currency</param> /// <param name="defaultCountry">Default country</param> /// <param name="defaultSettlementPeriod">Default settlement period</param> public Exchange(string ExchangeName, ICurrency defaultCurrency, ICountry defaultCountry, short defaultSettlementPeriod) { this.exchangeName = ExchangeName; this.defaultCountry = defaultCountry; this.DefaultCurrency = defaultCurrency; this.defaultSettlementPeriod = defaultSettlementPeriod; }
private void GetaccountNumber_Valid_Input_Return_Correct_Value( ICountry country, string bban, string accountNumber) { var valueGot = BbanSplitterValidValidation.GetAccountNumber(country, bban); Assert.AreEqual(accountNumber, valueGot); }
private void ValidateInput(ICountry country) { if (!country.IsValidCountryCode) { throw new ArgumentException("Country code must be a two or three character country code."); } }
public Task Visit(ICountry country) { _lastVisted = country; _countries.Add(country); country.AddVisitor(this); return(Task.CompletedTask); }
/// <summary> /// The method returns true or false if the BBAN is valid or not for the specified Country. /// </summary> /// <param name="country"> /// Country that contains the information to validate the BBAN. /// </param> /// <param name="bban"> /// BBAN to validate. /// </param> /// <returns> /// True/False /// </returns> /// <exception cref="InvalidCountryException"> /// If Country is null an <see cref="InvalidCountryException" /> will be thrown. /// </exception> public override bool IsValid(ICountry country, string bban) { CheckNotNullCountry(country); return(IsValidDetailLenght(bban, country.BbanLength) && IsValidDetailStructure(bban, country.BbanStructure)); }
public void AddLocation(ICountry model) { var entity = MapModelToEntity(model); Add(entity).Save(); model.Id = entity.Id; }
private void OnDelete() { if (deletedCountriesIndex.Count < CountriesDB.Countries.Count) { if (deletedCountriesIndex.Count + 1 == CountriesDB.Countries.Count && MessageBox.Show($"Do you really want to delete {CountriesDB.Countries[currCountryIndex].CountryName}?", "Please select", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { deletedCountriesIndex.Add(currCountryIndex); CountriesDB.Countries[currCountryIndex].IsDeleted = true; ICountry test = CountryFactory.CreateEmptyCountry(@"Images\noImage.png"); CurrCountry.CountryName = test.CountryName; CurrCountry.CapitalName = test.CapitalName; CurrCountry.CountryInfo = test.CountryInfo; CurrCountry.CountryFlag = test.CountryFlag; } else if (MessageBox.Show($"Do you really want to delete {CountriesDB.Countries[currCountryIndex].CountryName}?", "Please select", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { deletedCountriesIndex.Add(currCountryIndex); CountriesDB.Countries[currCountryIndex].IsDeleted = true; OnNext(); } } }
internal Attempt<ITaxMethod> CreateTaxMethodWithKey(Guid providerKey, ICountry country, decimal percentageTaxRate, bool raiseEvents = true) { if(CountryTaxRateExists(providerKey, country.CountryCode)) return Attempt<ITaxMethod>.Fail(new ConstraintException("A TaxMethod already exists for the provider for the countryCode '" + country.CountryCode + "'")); var taxMethod = new TaxMethod(providerKey, country.CountryCode) { Name = country.CountryCode == "ELSE" ? "Everywhere Else" : country.Name, PercentageTaxRate = percentageTaxRate, Provinces = country.Provinces.ToTaxProvinceCollection() }; if(raiseEvents) if (Creating.IsRaisedEventCancelled(new Events.NewEventArgs<ITaxMethod>(taxMethod), this)) { taxMethod.WasCancelled = false; return Attempt<ITaxMethod>.Fail(taxMethod); } using (new WriteLock(Locker)) { var uow = _uowProvider.GetUnitOfWork(); using (var repository = _repositoryFactory.CreateTaxMethodRepository(uow)) { repository.AddOrUpdate(taxMethod); uow.Commit(); } } if(raiseEvents) Created.RaiseEvent(new Events.NewEventArgs<ITaxMethod>(taxMethod), this); return Attempt<ITaxMethod>.Succeed(taxMethod); }
public ProfesorController(ITeacher teacher, IContactType contactType, IDocumentType documentType, ICountry country, ICity city, IAddressType addressType, IStatus status, IEducationType educationType, ITeacherEducation teacherEducation, INationality nationality, IMatirialStatus matirialStatus, IProvince province, ITeacherHiringType teacherHiringType, ITeacherFileType teacherFileType, ITeacherFile teacherFile, IWebHostEnvironment hostingEnv, IConfiguration config, IContactAddress contactAddress, IContactCommunication contactCommunication, IUniversity university ) { _teacher = teacher; _contactType = contactType; _documentType = documentType; _country = country; _city = city; _addressType = addressType; _status = status; _educationType = educationType; _teacherEducation = teacherEducation; _nationality = nationality; _matirialStatus = matirialStatus; _province = province; _teacherHiringType = teacherHiringType; _teacherFileType = teacherFileType; _teacherFile = teacherFile; _hostingEnv = hostingEnv; _config = config; _contactAddress = contactAddress; _contactCommunication = contactCommunication; _university = university; }
/// <summary> /// Initializes a new instance of the <see cref="ShipCountry"/> class. /// </summary> /// <param name="catalogKey"> /// The catalog key. /// </param> /// <param name="country"> /// The country. /// </param> public ShipCountry(Guid catalogKey, ICountry country) { Ensure.ParameterCondition(catalogKey != Guid.Empty, "catalogKey"); Ensure.ParameterNotNull(country, "country"); _country = country; _catalogKey = catalogKey; }
public ProcedureController(ICountry serv, IProductName prodName, IProductCode prodCode, IMarketingAuthorizNumber marketingAuthorizNumber, IPackSize packSize, IApprDocsType apprDocsType, IStrength strength, IManufacturer manufacturer, IArtwork artwork, IMarketingAuthorizHolder marketingAuthorizHolder, IPharmaceuticalForm pharmaceuticalForm, IProductService product, IProcedure procedure, IBaseEmailService emailService, IArchProccessor archProccessor) { _countryService = serv; _productNameService = prodName; _productCodeService = prodCode; _packSizeService = packSize; _marketingAuthorizNumberService = marketingAuthorizNumber; _apprDocsTypeService = apprDocsType; _strengthService = strength; _manufacturerService = manufacturer; _artworkService = artwork; _marketingAuthorizHolderService = marketingAuthorizHolder; _pharmaceuticalFormService = pharmaceuticalForm; _productService = product; _emailService = emailService; _procedureService = procedure; _archProccessor = archProccessor; emailer = new Emailer() { Login = WebConfigurationManager.AppSettings["login"], Pass = WebConfigurationManager.AppSettings["password"], From = WebConfigurationManager.AppSettings["from"], Port = int.Parse(WebConfigurationManager.AppSettings["smtpPort"]), SmtpServer = WebConfigurationManager.AppSettings["smtpSrv"], DirectorMail = WebConfigurationManager.AppSettings["directorMail"], DeveloperMail = WebConfigurationManager.AppSettings["developerMail"], }; _currentUser = GetCurrentUser(); }
/// <summary> /// The method returns true or false if the Account Number is valid or not for the specified Country. /// </summary> /// <param name="country"> /// Country that contains the information to validate the Account Number. /// </param> /// <param name="accountNumber"> /// Account Number to validate. /// </param> /// <returns> /// True/False /// </returns> /// <exception cref="InvalidCountryException"> /// If Country is null an <see cref="InvalidCountryException" /> will be thrown. /// </exception> public override bool IsValid(ICountry country, string accountNumber) { CheckNotNullCountry(country); return(IsValidDetailLenght(accountNumber, country.AccountNumberLength) && IsValidDetailStructure(accountNumber, country.AccountNumberStructure)); }
public Account(string username, string passwordHash, ICountry country, IServer server) { Username = username; PasswordHash = passwordHash; Country = country; Server = server; }
public void VerifyCountry() { ICountry country = BusinessObjectInitializer.CreateCountry(); Random random = new Random(); country.Code = DATestUtils.GenerateString(3, true, true); country.Name = DATestUtils.GenerateString(30, true, false); country.IdRegion = random.Next(1, 3); country.IdCurrency = random.Next(1, 12); country.Rank = random.Next(100000, 200000); int newId = InsertCountryTest(country); Assert.Greater(newId, 0); int rowsAffected = UpdateCountryTest(country); Assert.AreEqual(1, rowsAffected); DataTable resultTable = SelectCountryTest(country).Tables[0]; //Verifies that the table contains the correct column names and order StringCollection columns = new StringCollection(); columns.AddRange(new string[] { "Code", "Name", "RegionName", "CurrencyName", "Email", "Rank", "Id", "IdRegion", "IdCurrency" }); DATestUtils.CheckTableStructure(resultTable, columns); try { //we delete the 7 accounts associated with a country GlAccountTest accountTest = new GlAccountTest(); accountTest.Initialize(); IGlAccount glAccount = BusinessObjectInitializer.CreateGLAccount(); glAccount.IdCountry = newId; for (int i = 1; i <= 7; i++) { glAccount.Id = i; accountTest.DeleteGlAccountTest(glAccount); } accountTest.CleanUp(); } catch (Exception ex) { throw new Exception("Pre-Condition failed for delete operation. Gl/account operation meessage: " + ex.Message); } int rowCount = DeleteCountryTest(country); Assert.AreEqual(1, rowCount); }
public Country(ICountry data) { CountryId = data.CountryId; CountryUid = data.CountryUid; Name = data.Name; ISO3166 = data.ISO3166; ImageName = data.ImageName; }
public void ApplyDefaultForPrincipal_WhenDefaultCountryCodeDoesNotMatchCountryCode_AssertDefaultForPrincipalEqualToFalse() { ICountry sut = CreateSut(); sut.ApplyDefaultForPrincipal(_fixture.Create <string>()); Assert.That(sut.DefaultForPrincipal, Is.False); }
public void ApplyDefaultForPrincipal_WhenDefaultCountryCodeIsWhiteSpace_AssertDefaultForPrincipalEqualToFalse() { ICountry sut = CreateSut(); sut.ApplyDefaultForPrincipal(" "); Assert.That(sut.DefaultForPrincipal, Is.False); }
private static IBban GenerateBban(ICountry country, string bankCode, string accountNumber) { return(new Bban( country, bankCode, accountNumber, Container.Resolve <IValidators>())); }
public ParticipantController(IUnitOfWork uow, IParticipant participant, ISportType sportType, IGroup group, ICountry country) { _uow = uow; _participant = participant; _sportType = sportType; _Group = group; _Country = country; }
public void RunTests(int testId, string postcodeEntry, ICountry country, bool expectedPass, bool expectedShouldDisplayErrorMessage, string expectedErrorMessage) { var sut = new PostcodeValidator(country); var actualPass = sut.Validate(postcodeEntry, new VisaCardNetwork(), new List<CardNetwork> { CardNetwork.VISA }); Assert.That(actualPass.IsValid, Is.EqualTo(expectedPass)); Assert.That(actualPass.ErrorMessage, Is.EqualTo(expectedErrorMessage)); Assert.That(actualPass.ShouldDisplayErrorMessage, Is.EqualTo(expectedShouldDisplayErrorMessage)); }
private void OutputCountryDetails(ICountry country) { Console.WriteLine("Name: {0}", country.Name); Console.WriteLine("Region: {0}", country.Region); Console.WriteLine("Capital City: {0}", country.CapitalCity); Console.WriteLine("Longitude: {0}", country.Longitude); Console.WriteLine("Latitude: {0}", country.Latitude); }
private void ValidateCountry(ICountry country) { Assert.IsNotNull(country.Name, IsNullMessage(country_name)); Assert.IsNotNull(country.GoldMedals, IsNullMessage(country_goldMedals)); Assert.IsNotNull(country.SilverMedals, IsNullMessage(country_silverMedals)); Assert.IsNotNull(country.BronzeMedals, IsNullMessage(country_bronzeMedals)); Assert.IsNotNull(country.TotalMedals, IsNullMessage(country_totalMedals)); }
protected override async Task ManageRepositoryAsync(IUpdateCountryCommand command) { NullGuard.NotNull(command, nameof(command)); ICountry country = command.ToDomain(); await ContactRepository.UpdateCountryAsync(country); }
private static IBban GenerateBban(ICountry country, string bban) { return(new Bban( country, bban, Container.Resolve <IValidators>(), Container.Resolve <IBbanSplitter>())); }
private Mock <ICreateCountryCommand> CreateCommandMock(ICountry country = null) { Mock <ICreateCountryCommand> commandMock = new Mock <ICreateCountryCommand>(); commandMock.Setup(m => m.ToDomain()) .Returns(country ?? _fixture.BuildCountryMock().Object); return(commandMock); }
// // GET: /Account/ public AccountController(IUnitOfWork uow, IAccount accountService, ICountry countryService, IProvince provinceService, ICity cityService, IComment commentService) { _accountService = accountService; _countryService = countryService; _provinceService = provinceService; _cityService = cityService; _commentService = commentService; _uow = uow; }
private LanguageTag(ILanguage primaryLanguage, string extendedLanguage, IScript script, ICountry country, IRegion region, IEnumerable<string> variants, IEnumerable<string> extensions, string privateUse) { if (primaryLanguage == null) throw new ArgumentNullException("primaryLanguage"); this.primaryLanguage = primaryLanguage; this.extendedLanguage = extendedLanguage; this.script = script; this.country = country; this.region = region; this.variants = variants; this.extensions = extensions; this.privateUse = privateUse; }
void SetBillingCountry() { countryPicker.SelectedIndex = countryPicker.SelectedIndex > -1 ? countryPicker.SelectedIndex : 0; var selectedValue = countryPicker.Items[countryPicker.SelectedIndex]; _currentDiscoveredCountry = _countryDiscoverer.DiscoverCountry(selectedValue); postcodeEntry.Placeholder = _currentDiscoveredCountry.GetPostcodeTitle(); postcodeEntry.Text = string.Empty; if (_currentDiscoveredCountry.IsPostcodeNumeric()) { postcodeEntry.Keyboard = Keyboard.Numeric; postcodeEntry.Digits = "0123456789"; } else { postcodeEntry.Keyboard = Keyboard.Text; postcodeEntry.Digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } postcodeEntry.MaxLength = _currentDiscoveredCountry.GetPostcodeLength(); postcodeEntry.IsEnabled = _currentDiscoveredCountry.IsPostcodeRequired(); Validate(postcodeEntry); }
public static ILanguageTag Parse(string value) { if (string.IsNullOrEmpty(value)) return Empty; ILanguage primaryLanguage = null; string extendedLanguage = null; IScript script = null; ICountry country = null; var regionCode = -1; IRegion region = null; var variants = new List<string>(); var extensions = new List<string>(); string privateUse = null; var lower = value.ToLower(); if (grandfatheredTags.ContainsKey(lower)) { primaryLanguage = grandfatheredTags[lower].Item1; country = grandfatheredTags[lower].Item2; return new LanguageTag(primaryLanguage, country); } var count = 1; var singleton = string.Empty; foreach (var token in value.Split(new char[] {'-'}, StringSplitOptions.RemoveEmptyEntries)) { if (count == 1) { primaryLanguage = Language.GetLanguageByCode(token); } else { if (string.IsNullOrEmpty(singleton)) { switch (token.Length) { case 1: singleton = token; break; case 2: { if (token.IsMixedAlphaNumeric()) { variants.Add(token); } else { country = Geography.Country.GetCountryByCode(token); } break; } case 3: { if (token.IsMixedAlphaNumeric()) { variants.Add(token); } else { if (int.TryParse(token, out regionCode)) region = Geography.Region.GetRegionByCode(regionCode); else extendedLanguage = token; } break; } case 4: { if (token.IsMixedAlphaNumeric()) { variants.Add(token); } else { script = Culture.Script.GetScriptByCode(token); } break; } case 5: case 6: case 7: case 8: { variants.Add(token); break; } } } else { if (singleton.ToLower() == "x") { if (token.Length >= 1 && token.Length <= 8) { privateUse = string.Format("{0}-{1}", singleton, token); } } else if (token.Length >= 2 && token.Length <= 8) { extensions.Add(string.Format("{0}-{1}", singleton, token)); } singleton = string.Empty; } } count++; } return (primaryLanguage != null) ? new LanguageTag(primaryLanguage, extendedLanguage, script, country, region, variants, extensions, privateUse) : Empty; }
public static ILanguageTag Create(ILanguage primaryLanguage, ICountry country) { if (primaryLanguage == null) throw new ArgumentNullException("primaryLanguage"); if (country == null) throw new ArgumentNullException("country"); return new LanguageTag(primaryLanguage, country); }
private LanguageTag(ILanguage primaryLanguage, ICountry country) : this(primaryLanguage, null, null, country, null, new List<string>(), new List<string>(), null) { }
public ShipCountry(Guid catalogKey, ICountry country) : this(catalogKey, country.CountryCode, country.Provinces) { }
public LocationManager(IUnitOfWork uow) { this.countryrepo = uow.GetCountryRepository(); this.staterepo = uow.GetStateRepository(); this.cityrepo = uow.GetCityRepository(); }
public PostcodeValidator(ICountry country) { _country = country; }
public CountryController(IUnitOfWork uow, ICountry countryService) { _countryService = countryService; _uow = uow; }
public CanadianGovernment( ICountry country ) : base("Government of Canada") { this.country = country; }
public City(string name, ICountry country) { _name = name; _country = country; }
/// <summary> /// The create ship country with key. /// </summary> /// <param name="warehouseCatalogKey"> /// The warehouse catalog key. /// </param> /// <param name="country"> /// The country. /// </param> /// <param name="raiseEvents"> /// The raise events. /// </param> /// <returns> /// The <see cref="Attempt"/>. /// </returns> internal Attempt<IShipCountry> CreateShipCountryWithKey(Guid warehouseCatalogKey, ICountry country, bool raiseEvents = true) { Mandate.ParameterCondition(warehouseCatalogKey != Guid.Empty, "warehouseCatalog"); if (country == null) return Attempt<IShipCountry>.Fail(new ArgumentNullException("country")); var shipCountry = new ShipCountry(warehouseCatalogKey, country); if (raiseEvents) if (Creating.IsRaisedEventCancelled(new Events.NewEventArgs<IShipCountry>(shipCountry), this)) { shipCountry.WasCancelled = true; return Attempt<IShipCountry>.Fail(shipCountry); } // verify that a ShipCountry does not already exist for this pair var sc = GetShipCountriesByCatalogKey(warehouseCatalogKey).FirstOrDefault(x => x.CountryCode.Equals(country.CountryCode)); if (sc != null) return Attempt<IShipCountry>.Fail( new ConstraintException("A ShipCountry with CountryCode '" + country.CountryCode + "' is already associate with this WarehouseCatalog")); using (new WriteLock(Locker)) { var uow = _uowProvider.GetUnitOfWork(); using (var repository = _repositoryFactory.CreateShipCountryRepository(uow, _storeSettingService)) { repository.AddOrUpdate(shipCountry); uow.Commit(); } } if (raiseEvents) Created.RaiseEvent(new Events.NewEventArgs<IShipCountry>(shipCountry), this); return Attempt<IShipCountry>.Succeed(shipCountry); }