/// <summary> /// Determins if the staff list contains the staff. /// </summary> /// <returns><c>true</c>, if staff exists, <c>false</c> otherwise.</returns> /// <param name="s">S.</param> public bool ContainsStaff(Staff s) { bool contains = false; if(mStaff.Count > 0) { for (int i=0; i<mStaff.Count; i++) { if(mStaff[i].GetName().Equals(s.GetName()) && ( mStaff[i].GetOfficeNo().Equals(s.GetOfficeNo())) && ( mStaff[i].GetBuildingNo().Equals(s.GetBuildingNo()))) { contains = true; break; } } } return contains; }
/// <summary> /// Initializes a new instance of the <see cref="Staff"/> class. /// </summary> /// <param name="s">S.</param> public Staff(Staff s) { mName = s.GetName (); mBuildingNo = s.GetBuildingNo (); mOfficeNo = s.GetOfficeNo (); mEmail = s.GetEmail (); mPhoto = s.GetPhoto (); mPosition = s.GetPosition (); mPhones = new List<string> (); mOrganisations = new List<string> (); for(int i=0; i<s.NumberOfPhones(); i++) { this.AddPhone(s.GetPhoneAt(i)); } for(int i=0; i<s.NumberOfOrganisations(); i++) { this.AddOrganisation(s.GetOrganisationAt(i)); } }
/// <summary> /// Removes the staff. /// </summary> /// <returns><c>true</c>, if staff was removed, <c>false</c> otherwise.</returns> /// <param name="s">S.</param> public bool RemoveStaff(Staff s) { bool removed; int startSize = mStaff.Count; for (int i=0; i<mStaff.Count; i++) { if(mStaff[i].GetName().Equals(s.GetName()) && ( mStaff[i].GetOfficeNo().Equals(s.GetOfficeNo())) && ( mStaff[i].GetBuildingNo().Equals(s.GetBuildingNo()))) { mStaff.RemoveAt(i); break; } } if(mStaff.Count < startSize) removed = true; else removed =false; return removed; }