public virtual string AnyIdentifiableTag(int row = -1) { if (!UserName.NullOrEmpty()) { return(UserName); } if (!FirstName.NullOrEmpty()) { if (!LastName.NullOrEmpty()) { return(FirstName + " " + LastName); } else { return(FirstName); } } if (!LastName.NullOrEmpty()) { return(LastName); } if (!StudentID.NullOrEmpty()) { return(StudentID); } if (row >= 0) { return($"on row {row}"); } return("Unidentifiable student"); }
public virtual List <ErrorType> GetErrors() { List <ErrorType> list = new List <ErrorType>(); if (FirstName.NullOrEmpty()) { list.Add(ErrorType.FirstName); } if (LastName.NullOrEmpty()) { list.Add(ErrorType.LastName); } if (UserName.NullOrEmpty()) { list.Add(ErrorType.UserName); } if (StudentID.NullOrEmpty()) { list.Add(ErrorType.StudentID); } return(list); }
/// <summary> /// Checks that all data is valid for the student /// </summary> /// <returns>Returns true if everything is okay, false if there is an error.</returns> public virtual bool ResolveErrors() { return(!FirstName.NullOrEmpty() && !LastName.NullOrEmpty() && !StudentID.NullOrEmpty() && !UserName.NullOrEmpty()); }