Exemplo n.º 1
0
        private void Add_MouseUp(object sender, MouseButtonEventArgs e)
        {
            int IsGeneralManager = 0;

            if (string.IsNullOrEmpty(Username.Text) || string.IsNullOrEmpty(Password.Text))
            {
                MessageBox.Show("Please enter the missing data.");
            }
            else
            {
                if (PasswordLengthChecker(Password.Text))
                {
                    if ((WelcomePage.ThereIsNoDelimiter(Username.Text)) && (WelcomePage.ThereIsNoDelimiter(Password.Text)))
                    {
                        if (GeneralManagerCheck.IsChecked == true)
                        {
                            IsGeneralManager = 1;
                        }
                        Admin admin = new Admin(Username.Text, Password.Text, IsGeneralManager);

                        WelcomePage.AllAdminsDictionary[Username.Text] = admin;
                        MessageBox.Show("Admin has been added.");
                    }
                    else
                    {
                        MessageBox.Show("The provided text can't contain any of the following characters.");
                    }
                }
                else
                {
                    return;
                }
            }
        }
 bool CheckAllTheRemainingTextBoxes()
 {
     if (WelcomePage.ThereIsNoDelimiter(CodeTextBox.Text) && WelcomePage.ThereIsNoDelimiter(CourseNameTextBox.Text) && WelcomePage.ThereIsNoDelimiter(InstructorTextBox.Text) && WelcomePage.ThereIsNoDelimiter(DescriptionTextBox.Text))
     {
         return(true);
     }
     MessageBox.Show("Some textbox contains '%' or '#' or '*'.");
     return(false);
 }
 bool CheckAllTheRemainingTextBoxes()
 {
     //check if there is delimiter in Instructor text box or Description text box
     if (WelcomePage.ThereIsNoDelimiter(InstructorTextBox.Text) && WelcomePage.ThereIsNoDelimiter(DescriptionTextBox.Text))
     {
         return(true);
     }
     MessageBox.Show("Some textbox contains '%' or '#' or '*'.");
     return(false);
 }
Exemplo n.º 4
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;
                }
            }
        }