/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (EmployeeId != null) { hashCode = hashCode * 59 + EmployeeId.GetHashCode(); } if (EmployeeCode != null) { hashCode = hashCode * 59 + EmployeeCode.GetHashCode(); } if (EmployeeName != null) { hashCode = hashCode * 59 + EmployeeName.GetHashCode(); } hashCode = hashCode * 59 + Gender.GetHashCode(); if (DateOfBirth != null) { hashCode = hashCode * 59 + DateOfBirth.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } if (DepartmentId != null) { hashCode = hashCode * 59 + DepartmentId.GetHashCode(); } if (DepartmentName != null) { hashCode = hashCode * 59 + DepartmentName.GetHashCode(); } if (Email != null) { hashCode = hashCode * 59 + Email.GetHashCode(); } hashCode = hashCode * 59 + Salary.GetHashCode(); hashCode = hashCode * 59 + WorkStatus.GetHashCode(); if (PositionId != null) { hashCode = hashCode * 59 + PositionId.GetHashCode(); } if (PositionName != null) { hashCode = hashCode * 59 + PositionName.GetHashCode(); } if (TaxCode != null) { hashCode = hashCode * 59 + TaxCode.GetHashCode(); } if (JoinDate != null) { hashCode = hashCode * 59 + JoinDate.GetHashCode(); } if (IdentityNumber != null) { hashCode = hashCode * 59 + IdentityNumber.GetHashCode(); } if (IdentityDate != null) { hashCode = hashCode * 59 + IdentityDate.GetHashCode(); } if (IdentityPlace != null) { hashCode = hashCode * 59 + IdentityPlace.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Employee instances are equal /// </summary> /// <param name="other">Instance of Employee to be compared</param> /// <returns>Boolean</returns> public bool Equals(Employee other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EmployeeId == other.EmployeeId || EmployeeId != null && EmployeeId.Equals(other.EmployeeId) ) && ( EmployeeCode == other.EmployeeCode || EmployeeCode != null && EmployeeCode.Equals(other.EmployeeCode) ) && ( EmployeeName == other.EmployeeName || EmployeeName != null && EmployeeName.Equals(other.EmployeeName) ) && ( Gender == other.Gender || Gender.Equals(other.Gender) ) && ( DateOfBirth == other.DateOfBirth || DateOfBirth != null && DateOfBirth.Equals(other.DateOfBirth) ) && ( PhoneNumber == other.PhoneNumber || PhoneNumber != null && PhoneNumber.Equals(other.PhoneNumber) ) && ( DepartmentId == other.DepartmentId || DepartmentId != null && DepartmentId.Equals(other.DepartmentId) ) && ( DepartmentName == other.DepartmentName || DepartmentName != null && DepartmentName.Equals(other.DepartmentName) ) && ( Email == other.Email || Email != null && Email.Equals(other.Email) ) && ( Salary == other.Salary || Salary.Equals(other.Salary) ) && ( WorkStatus == other.WorkStatus || WorkStatus.Equals(other.WorkStatus) ) && ( PositionId == other.PositionId || PositionId != null && PositionId.Equals(other.PositionId) ) && ( PositionName == other.PositionName || PositionName != null && PositionName.Equals(other.PositionName) ) && ( TaxCode == other.TaxCode || TaxCode != null && TaxCode.Equals(other.TaxCode) ) && ( JoinDate == other.JoinDate || JoinDate != null && JoinDate.Equals(other.JoinDate) ) && ( IdentityNumber == other.IdentityNumber || IdentityNumber != null && IdentityNumber.Equals(other.IdentityNumber) ) && ( IdentityDate == other.IdentityDate || IdentityDate != null && IdentityDate.Equals(other.IdentityDate) ) && ( IdentityPlace == other.IdentityPlace || IdentityPlace != null && IdentityPlace.Equals(other.IdentityPlace) )); }