public void facebook()
        {
            Application.EnableVisualStyles();
            g = new GetTheMail();
            string mail = g.getMail();

            if (dataBaseOperations.facebookUserExist(mail, "Admin"))
            {
                //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 inst obj
                admin ad = new admin(dataBaseOperations.getIdByMail(mail));
                //and then i pass it to the next form
                //i'll catch it in the next form constractor
                adminMenu instrfMen = new adminMenu(ad);

                this.Hide();
                instrfMen.ShowDialog();
            }
            else
            {
                MessageBox.Show("the user not exist");
            }
            g.logout();
        }
        public void adminLogoff()
        {
            admin     admin     = new admin(id);
            adminMenu adminMenu = new adminMenu(admin);

            adminMenu.Close();
            Assert.IsNotNull(adminMenu);
        }
Exemple #3
0
        private void login()
        {
            db.OpenConn();
            Boolean error = false;

            switch (getAccessGroup())
            {
            case "Admin":
                if (ManagementButton.Checked)
                {
                    getID();
                    using (adminMenu adMenu = new adminMenu(new admin(id)))
                    {
                        this.Hide();
                        adMenu.ShowDialog(this);
                    }
                }
                else if (StudentButton.Checked)
                {
                    using (Form_adminMenu admin_menu = new Form_adminMenu())
                    {
                        this.Hide();
                        admin_menu.ShowDialog(this);
                    }
                }
                else
                {
                    MessageBox.Show("You must choose a button!");
                }
                break;

            case "Student":
                if (StudentButton.Checked)
                {
                    using (Form_studentMenu student_menu = new Form_studentMenu())
                    {
                        student_menu.setUsername(Username);
                        this.Hide();
                        student_menu.ShowDialog(this);
                    }
                }
                else
                {
                    MessageBox.Show("You must choose your right type!");
                }
                break;

            case "Associate":
                if (StudentButton.Checked)
                {
                    using (Form_associateMenu associate_menu = new Form_associateMenu())
                    {
                        this.Hide();
                        associate_menu.ShowDialog(this);
                    }
                }
                else
                {
                    MessageBox.Show("You must choose your right type!");
                }
                break;

            case "Secretary":
                if (ManagementButton.Checked)
                {
                    getID();
                    using (secretaryMenu secMenu = new secretaryMenu(new secretary(id)))
                    {
                        this.Hide();
                        secMenu.ShowDialog(this);
                    }
                }
                else if (StudentButton.Checked)
                {
                    using (Form_secretaryMenu secretary_menu = new Form_secretaryMenu())
                    {
                        this.Hide();
                        secretary_menu.ShowDialog(this);
                    }
                }
                else
                {
                    MessageBox.Show("You must choose a button!");
                }
                break;

            case "instructor":
                if (ManagementButton.Checked)
                {
                    getID();
                    using (teachingStaffMenu instrfMen = new teachingStaffMenu(new professor(id)))
                    {
                        this.Hide();
                        instrfMen.ShowDialog(this);
                    }
                }
                else
                {
                    MessageBox.Show("You must choose your right type!");
                }
                break;

            case "Professor":
                if (ManagementButton.Checked)
                {
                    getID();
                    using (teachingStaffMenu porfMen = new teachingStaffMenu(new professor(id)))
                    {
                        this.Hide();
                        porfMen.ShowDialog(this);
                    }
                }
                else
                {
                    MessageBox.Show("You must choose your right type!");
                }
                break;

            default:
                MessageBox.Show(getAccessGroup());
                error = true;
                break;
            }
            if (!error)
            {
                this.Show();
                this.BringToFront();
                this.userNameBox.Clear();
                this.passwordBox.Clear();
                this.ManagementButton.Checked = false;
                this.StudentButton.Checked    = false;
            }

            db.CloseConn(db.ConnStatus());
        }
        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, "Admin"))
                    {
                        //hide this panel to show the other;
                        label3.Hide();

                        //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 admin obj
                        admin adminInstance = new admin(id);
                        //and then i pass it to the next form
                        //i'll catch it in the next form constractor
                        adminMenu adMenu = new adminMenu(adminInstance);

                        this.Hide();
                        adMenu.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\n");
                }
            }
            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;
            }
        }