/// <summary> /// Builds a data object from the current row in a data reader.. /// </summary> /// <param name="dataReader">Container for database row.</param> /// <returns>Data object built from current row.</returns> private static GolferData GetDataObjectFromReader(SqlDataReader dataReader) { GolferData data = new GolferData(); if (dataReader.IsDBNull(dataReader.GetOrdinal("GolferId"))) { data.GolferId = IdType.UNSET; } else { data.GolferId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("GolferId"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("FirstName"))) { data.FirstName = StringType.UNSET; } else { data.FirstName = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("FirstName"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("MiddleInitial"))) { data.MiddleInitial = StringType.UNSET; } else { data.MiddleInitial = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("MiddleInitial"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("LastName"))) { data.LastName = StringType.UNSET; } else { data.LastName = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("LastName"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Phone"))) { data.Phone = StringType.UNSET; } else { data.Phone = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Phone"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Email"))) { data.Email = StringType.UNSET; } else { data.Email = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Email"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Address1"))) { data.Address.Address1 = StringType.UNSET; } else { data.Address.Address1 = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Address1"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Address2"))) { data.Address.Address2 = StringType.UNSET; } else { data.Address.Address2 = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Address2"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("City"))) { data.Address.City = StringType.UNSET; } else { data.Address.City = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("City"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("State"))) { data.Address.State = USStateCodeEnum.UNSET; } else { data.Address.State = USStateCodeEnum.GetInstance(dataReader.GetString(dataReader.GetOrdinal("State"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Country"))) { data.Address.Country = StringType.UNSET; } else { data.Address.Country = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Country"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("PostalCode"))) { data.Address.PostalCode = StringType.UNSET; } else { data.Address.PostalCode = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("PostalCode"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("DateOfBirth"))) { data.DateOfBirth = DateType.UNSET; } else { data.DateOfBirth = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("DateOfBirth"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Handicap"))) { data.Handicap = DecimalType.UNSET; } else { data.Handicap = new DecimalType(dataReader.GetDecimal(dataReader.GetOrdinal("Handicap"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("CourseNumber"))) { data.CourseNumber = StringType.UNSET; } else { data.CourseNumber = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("CourseNumber"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("PlayerNumber"))) { data.PlayerNumber = StringType.UNSET; } else { data.PlayerNumber = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("PlayerNumber"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("Gender"))) { data.Gender = GenderType.UNSET; } else { data.Gender = GenderType.GetInstance(dataReader.GetString(dataReader.GetOrdinal("Gender"))); } if (dataReader.IsDBNull(dataReader.GetOrdinal("GolferStatus"))) { data.GolferStatus = GolferStatusEnum.UNSET; } else { data.GolferStatus = GolferStatusEnum.GetInstance(dataReader.GetString(dataReader.GetOrdinal("GolferStatus"))); } return(data); }