private City FindCIty(string cityName, string stateName, string countryName) { Check_CityName_CountryName(cityName, countryName); stateName = If_stateName_Empty_Give_CountryName(stateName, countryName); CityDAL cityDAL = new CityDAL(_db, ErrorsGlobal); City city = cityDAL.FindByName(cityName, stateName, countryName); if (city == null) { throw new ErrorHandlerLibrary.ExceptionsNS.NotFoundException(string.Format("No city named '{0}, {1}, {2}' found. FindByName.TownDAL. ", cityName.ToTitleCase(), stateName.ToTitleCase(), countryName.ToTitleCase())); } return(city); }
private string If_TownName_Empty_Give_CityName_ForId(string townName, Guid?cityId) { if (!cityId.HasValue) { throw new ErrorHandlerLibrary.ExceptionsNS.RequiredDataMissingException("City Id missing. TownDal.FindByName"); } City city = new CityDAL(_db, ErrorsGlobal).FindFor(cityId); if (city == null) { throw new Exception("No city found. Check_FindByName_Params.TownDAL"); } if (townName.IsNullOrEmpty()) { townName = city.Name; } return(townName); }