コード例 #1
0
        public void SubmitButtonExecute(object parameter)
        {
            bool doesStudentExist = false;

            if (Directory.Exists(DirectoryManager.AccountsDirectory) && (string)parameter == "")
            {
                Student tempStudent = DirectoryManager.ReadStudentobject(FirstName, LastName, Email);
                if (tempStudent != null)
                {
                    doesStudentExist = true;
                    verified         = false;
                    ErrorEmail       = "This Email Already Exist";
                }
                else
                {
                    ErrorEmail = string.Empty;
                }
            }

            if (this.Error == null && doesStudentExist == false && (string)parameter == "")
            {
                //just trying to invoke the setter in the Gender property to carry out the logic that is built into it.
                this.Gender = "";
                Student newStudent = new Student(FirstName, LastName, Gender, BirthDate, Program, CurrentLevel, CurrentSemester, Institution, Email);

                DirectoryManager.CreatePersonalDirectory(ref newStudent);
                verified       = true;
                CurrentStudent = Student.Login(FirstName, Email);
            }
        }