/** * Parses the EmployeeDto object from the SQL reader cache. * */ EmployeeDto ParseFromReaderCache(MySqlDataReader dataReader) { // id int id = 0; try { id = dataReader.GetInt32(0); } catch (SqlNullValueException) { /* log the error */ } // first name string firstName = "N/A"; try { firstName = dataReader.GetString(1); } catch (SqlNullValueException) { /* log the error */ } // last name string lastName = "N/A"; try { lastName = dataReader.GetString(2); } catch (SqlNullValueException) { /* log the error */ } // birth place string birthPlace = "N/A"; try { birthPlace = dataReader.GetString(3); } catch (SqlNullValueException) { /* log the error */ } // current place string currentPlace = "N/A"; try { currentPlace = dataReader.GetString(4); } catch (SqlNullValueException) { /* log the error */ } // gender EmployeeGender gender = EmployeeGender.UNDEFINED; try { gender = EmployeeGenderExtensions.GetEnumValue(dataReader.GetInt32(5)); } catch (SqlNullValueException) { /* log the error */ } // department DepartmentCode departmentCode = DepartmentCode.UNKNOWN; try { departmentCode = DepartmentCodeExtensions.GetEnumValue(dataReader.GetString(6)); } catch (SqlNullValueException) { /* log the error */ } // oib string OIB = "N/A"; try { OIB = dataReader.GetString(7); } catch (SqlNullValueException) { /* log the error */ } return((EmployeeDto) new Employee(id, firstName, lastName, birthPlace, currentPlace, gender, departmentCode, OIB).ToDto()); }
public IDataObject ToDataObject() { return(new Employee( 0, FirstName, LastName, BirthPlace, CurrentPlace, EmployeeGenderExtensions.GetEnumValue(Gender), DepartmentCodeExtensions.GetEnumValue(Department), OIB )); }