private void CheckStudentsData() { for (int i = 0; i < m_studentList.Count; i++) { StudentDataContainer container = (StudentDataContainer)m_studentList[i]; StudentDataContainer.CheckDataResult result = container.CheckData(); if (result.Result != StudentDataContainer.Result.OK) { throw new StudentAddException(result, string.Format( Resource1.ListErrorFormat, i + 1, ErrorStringFromResult(result))); } } }
private static string ErrorStringFromResult( StudentDataContainer.CheckDataResult result) { string errorText = null; if (result.Result == StudentDataContainer.Result.EmptyField) { errorText = string.Format(Resource1.EmptyFieldFormat, result.FieldName); } else { errorText = string.Format(Resource1.ForbiddenCharFormat, result.FieldName); } return(errorText); }
public StudentAddException(StudentDataContainer.CheckDataResult result, string message) : base(message) { Result = result; }
public StudentAddException(StudentDataContainer.CheckDataResult result) { }