public override bool Equals(object obj) { if (obj == null) { return(false); } // If parameter cannot be cast to Point return false. Student st = obj as Student; if (st == null) { return(false); } return((IndexID.Equals(st.IndexID)) && (FirstName == st.FirstName) && (LastName == st.LastName) && (City == st.City) && (DateOfBirth.Equals(st.DateOfBirth))); }
//private bool canUpdate; //private bool isStudentSelected() //{ // return SelectedStudent != null; //} private bool isSelectedStudentAsPrevious() { if (City != null) { if (!City.Equals(SelectedStudent.City)) { return(false); } } else if (SelectedStudent.City != null) { if (!SelectedStudent.City.Equals(City)) { return(false); } } if (DateOfBirth != null) { if (!DateOfBirth.Equals(SelectedStudent.DateOfBirth)) { return(false); } } else if (SelectedStudent.DateOfBirth != null) { if (!SelectedStudent.DateOfBirth.Equals(DateOfBirth)) { return(false); } } if (FirstName != null) { if (!FirstName.Equals(SelectedStudent.FirstName)) { return(false); } } else if (SelectedStudent.FirstName != null) { if (!SelectedStudent.FirstName.Equals(FirstName)) { return(false); } } if (LastName != null) { if (!LastName.Equals(SelectedStudent.LastName)) { return(false); } } else if (SelectedStudent.LastName != null) { if (!SelectedStudent.LastName.Equals(LastName)) { return(false); } } if (SelectedGroup != null) { if (!SelectedGroup.Equals(SelectedStudent.Group)) { return(false); } } else if (SelectedStudent.Group != null) { if (!SelectedStudent.Group.Equals(SelectedGroup)) { return(false); } } if (IndexID != null) { if (!IndexID.Equals(SelectedStudent.IndexID)) { return(false); } } else if (SelectedStudent.IndexID != null) { if (!SelectedStudent.IndexID.Equals(IndexID)) { return(false); } } return(true); }