public static Country GetRecordById(string countryId, string idiomaId) { CountryTableAdapter localAdapter = new CountryTableAdapter(); if (string.IsNullOrEmpty(countryId)) { throw new ArgumentException("El identificador countryId no puede ser null o vacio"); } if (string.IsNullOrEmpty(idiomaId)) { throw new ArgumentException("El identificador idiomaId no puede ser null o vacio"); } Country theData = null; try { CountryDS.CountryDataTable theTable = localAdapter.GetCountryById(countryId, idiomaId); if (theTable != null && theTable.Rows.Count > 0) { CountryDS.CountryRow theRow = theTable[0]; theData = FillRecord(theRow); } } catch (Exception exc) { log.Error("Ocurrió un error mientras se obtenía el country de id =" + countryId, exc); throw exc; } return(theData); }
private static Country FillRecord(CountryDS.CountryRow row) { Country theNewRecord = new Country( row.CountryId, row.iso2, row.isoNumero, row.countryName); return(theNewRecord); }