Exemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((StudName != null ? StudName.GetHashCode() : 0) * 397) ^ (TeacherName != null ? TeacherName.GetHashCode() : 0));
     }
 }
Exemplo n.º 2
0
        //private void Button_Click(object sender, RoutedEventArgs e)
        //{



        //    //if (string.IsNullOrEmpty(StudName.Text.Trim()) || string.IsNullOrEmpty(StudID.Text.Trim()) || string.IsNullOrEmpty(StudPassword.Text.Trim()) || StudYear.SelectedIndex == -1)
        //    //{
        //    //    MessageBox.Show("Please Enter Missing Data");
        //    //}
        //    //else if (WelcomePage.ThereIsNoDelimiter(StudName.Text.Trim()) == false || WelcomePage.ThereIsNoDelimiter(StudID.Text.Trim()) == false || WelcomePage.ThereIsNoDelimiter(StudPassword.Text.Trim()) == false)
        //    //{
        //    //    MessageBox.Show("Please Don't Use special characters: (% , # , *) ");
        //    //}
        //    //else if (WelcomePage.IsNotAlphabet(StudName.Text.Trim()) == true)
        //    //{
        //    //    MessageBox.Show("Please Enter Correct Name");
        //    //}
        //    //else if(WelcomePage.NoSpace(StudPassword.Text.Trim())==false || WelcomePage.NoSpace(StudID.Text.Trim())==false)
        //    //{
        //    //    MessageBox.Show("ID and Password Must Not Contain Spaces");
        //    //}

        //    //else
        //    //{
        //    //    string name = StudName.Text.Trim();
        //    //    string id = StudID.Text.Trim();
        //    //    string pass = StudPassword.Text.Trim();
        //    //    string year = StudYear.SelectedItem.ToString();

        //    //    Student s = new Student(id, name, pass, year);

        //    //    if (WelcomePage.AllStudentsDictionary.ContainsKey(id))
        //    //    {
        //    //        MessageBox.Show("this ID already exist");

        //    //    }
        //    //    else
        //    //    {

        //    //        WelcomePage.AllStudentsDictionary[id]=s;
        //    //        MessageBox.Show("Student Added");

        //    //        StudName.Clear();
        //    //        StudID.Clear();
        //    //        StudPassword.Clear();
        //    //        StudYear.SelectedIndex = -1;

        //    //        /* if(StudYear.SelectedValue.ToString()!= "1st year")
        //    //        {
        //    //            FinishedCourses.Visibility = Visibility.Visible;
        //    //        }
        //    //        */

        //    //        CheckBox.Visibility = Visibility.Visible;


        //    //    }
        //    //}

        //}


        private void Image_MouseUp(object sender, MouseButtonEventArgs e)
        {
            if (string.IsNullOrEmpty(StudName.Text.Trim()) || string.IsNullOrEmpty(StudID.Text.Trim()) || string.IsNullOrEmpty(StudPassword.Text.Trim()) || StudYear.SelectedIndex == -1)
            {
                MessageBox.Show("Please enter the missing data.");
            }
            else if (WelcomePage.ThereIsNoDelimiter(StudName.Text.Trim()) == false || WelcomePage.ThereIsNoDelimiter(StudID.Text.Trim()) == false || WelcomePage.ThereIsNoDelimiter(StudPassword.Text.Trim()) == false)
            {
                MessageBox.Show("Please don't use special characters: (% , # , *) ");
            }
            else if (WelcomePage.IsNotAlphabet(StudName.Text.Trim()) == true)
            {
                MessageBox.Show("Please enter a correct name.");
            }
            else if (WelcomePage.NoSpace(StudPassword.Text.Trim()) == false || WelcomePage.NoSpace(StudID.Text.Trim()) == false)
            {
                MessageBox.Show("ID and password must not contain spaces.");
            }
            else
            {
                string name = StudName.Text.Trim();
                string id   = StudID.Text.Trim();
                string pass = StudPassword.Text.Trim();
                string year = StudYear.SelectedItem.ToString();

                Student s = new Student(id, name, pass, year);

                if (WelcomePage.AllStudentsDictionary.ContainsKey(id))
                {
                    MessageBox.Show("This ID already exists.");
                }
                else
                {
                    WelcomePage.AllStudentsDictionary[id] = s;
                    MessageBox.Show("Student had been added.");

                    StudName.Clear();
                    StudID.Clear();
                    StudPassword.Clear();
                    StudYear.SelectedIndex = -1;
                }
            }
        }