Пример #1
0
        private bool ValidateAssessment()
        {
            ErrorText = "";
            if (NewAssessment.Title.IsNull())
            {
                ErrorText = "Assement must have a name.";
            }

            if (NewAssessment.Start >= NewAssessment.End)
            {
                ErrorText = "Assements start date must be before the end date.";
            }

            if (Course.Start > NewAssessment.Start)
            {
                ErrorText = $"Assement cannot begin before course start date of {Course.Start:MM/dd/yyyy}.";
            }

            if (Course.End < NewAssessment.End)
            {
                ErrorText = $"Assement cannot end after course end date of {Course.End:MM/dd/yyyy}.";
            }

            return(ErrorText.IsNull());
        }
Пример #2
0
        private async Task <bool> ValidateCourse(Course course)
        {
            ErrorText = "";
            if (course.Title.IsNull())
            {
                ErrorText = "* Must provide a course name.";
            }

            if (course.Start == null || course.End == null)
            {
                ErrorText = "* Must provide a course start and end date.";
            }

            if (course.Start >= course.End)
            {
                ErrorText = "* Course start date can not be after course end date.";
            }

            if (course.Status.IsNull())
            {
                ErrorText = "* Must select a course status.";
            }

            if (course.InstructorName.IsNull())
            {
                ErrorText = "* Must provide course instructor's information.";
            }

            if (!course.InstructorEmail.IsValidEmail())
            {
                ErrorText = "* Must provide a valid email for course instructor.";
            }

            if (!course.InstructorPhone.IsValidPhoneNumber())
            {
                ErrorText = "* Must provide a valid phone number for course instructor.";
            }

            if (Term.Start > course.Start)
            {
                ErrorText = $"* Course cannot begin before term start date of {Term.Start}.";
            }

            if (Term.End < course.End)
            {
                ErrorText = $"* Course cannot end after term end date of {Term.End}.";
            }

            return(ErrorText.IsNull());
        }
Пример #3
0
        private bool ValidateTerm()
        {
            ErrorText = "";

            if (NewTerm.End <= NewTerm.Start)
            {
                ErrorText = $"* Term end date must be after start date.";
            }

            if (NewTerm.Title.IsNull())
            {
                ErrorText = $"* Term must have a Title.";
            }

            return(ErrorText.IsNull());
        }