コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //instance of data base managment;
            dataBaseOperations check_user_instance = new dataBaseOperations();
            //instance of cheking class;
            publicChecksAndOperations check_id_if_numeric = new publicChecksAndOperations();

            if (check_id_if_numeric.isNumericUlong(textBox1.Text))
            {
                //turn the string into int;
                ulong id = Convert.ToUInt32(textBox1.Text, 10);

                try
                {
                    //check if user exist in the system;
                    if (check_user_instance.userExist(textBox2.Text, id, "Professor"))
                    {
                        //In perception i thing that its importent to pass
                        //user object for the next managing form
                        //plese do it in all other form

                        //here i create new prof obj
                        professor prof = new professor(id);
                        //and then i pass it to the next form
                        //i'll catch it in the next form constractor
                        teachingStaffMenu porfMen = new teachingStaffMenu(prof);

                        this.Hide();
                        porfMen.ShowDialog();
                    }
                    else
                    {
                        //if lable 3 pop in previous case;
                        label3.Hide();
                        MessageBox.Show("the username or password is incorrect");
                    }
                }
                catch
                {
                    //if lable 3 pop in previous case;
                    label3.Hide();
                    MessageBox.Show("there was a problam with the conection");
                }
            }
            else if (textBox1.Text == "")
            {
                //show allert and paint it;
                label3.Show();
                label3.Text      = "please enter values";
                label3.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                //show allert and paint it;
                label3.Show();
                label3.Text      = "*there are illegal values";
                label3.ForeColor = System.Drawing.Color.Red;
            }
        }
コード例 #2
0
        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //declare that the application is closed to avoid open new windows and making bug;
            publicChecksAndOperations exitCheck = new publicChecksAndOperations();

            exitCheck.setUserExit();
            Application.Exit();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //instance of data base managment;
            dataBaseOperations check_user_instance = new dataBaseOperations();
            //instance of cheking class;
            publicChecksAndOperations check_id_if_numeric = new publicChecksAndOperations();

            if (check_id_if_numeric.isNumericUlong(textBox1.Text))
            {
                //turn the string into int;
                ulong id = Convert.ToUInt32(textBox1.Text, 10);

                try
                {
                    //check if user exist in the system;
                    if (check_user_instance.userExist(textBox2.Text, id, "Secretary"))
                    {
                        //hide this panel to show the other;

                        label3.Hide();

                        this.Hide();
                        secretary sec = new secretary(id);

                        secretaryMenu secMenu = new secretaryMenu(sec);
                        secMenu.ShowDialog();
                    }
                    else
                    {
                        //if lable 3 pop in previous case;
                        label3.Hide();
                        MessageBox.Show("the username or password is incorrect");
                    }
                }
                catch (Exception exc)
                {
                    //if lable 3 pop in previous case;
                    label3.Hide();
                    MessageBox.Show("there was a problam with the conection\n" + exc);
                }
            }
            else if (textBox1.Text == "")
            {
                //show allert and paint it;
                label3.Show();
                label3.Text      = "please enter values";
                label3.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                //show allert and paint it;
                label3.Show();
                label3.Text      = "*there are illegal values";
                label3.ForeColor = System.Drawing.Color.Red;
            }
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            secretaryLoginMenu  secretaryLoginForm  = new secretaryLoginMenu();
            professorLoginMenu  professorLoginForm  = new professorLoginMenu();
            instructorLoginMenu instructorLoginForm = new instructorLoginMenu();
            adminLoginMenu      adminLoginForm      = new adminLoginMenu();

            publicChecksAndOperations checkIfUserExit = new publicChecksAndOperations();

            if (comboBox1.Text == "secretary")
            {
                this.Hide();
                secretaryLoginForm.ShowDialog();
                if (!checkIfUserExit.didUserExit())
                {
                    this.Show();
                }
            }

            else if (comboBox1.Text == "professor")
            {
                this.Hide();
                professorLoginForm.ShowDialog();
                if (!checkIfUserExit.didUserExit())
                {
                    this.Show();
                }
            }
            else if (comboBox1.Text == "instructor")
            {
                this.Hide();
                instructorLoginForm.ShowDialog();
                if (!checkIfUserExit.didUserExit())
                {
                    this.Show();
                }
            }
            else if (comboBox1.Text == "Admin")
            {
                this.Hide();
                adminLoginForm.ShowDialog();
                if (!checkIfUserExit.didUserExit())
                {
                    this.Show();
                }
            }
        }