private void btn_recoveryPassword_Click(object sender, EventArgs e)
        {
            if (textBox_userName.TextLength > 0)
            {
                int    id       = -1;
                string username = textBox_userName.Text;
                try
                {
                    id = System.Convert.ToInt32(username);
                }
                catch (Exception) { }
                User user;
                if (id != -1)
                {
                    user = SettingDatabase.GetUserById(id);
                }
                else
                {
                    user = SettingDatabase.GetUserByEmail(username);
                }

                if (user != null)
                {
                    if (user.email != null)
                    {
                        MessageBox.Show("In your email you get this message: \n\nUser ID : " + user.ID + "\nEmail: " + user.email + "\nYour password is: " + user.password);
                    }
                    else
                    {
                        MessageBox.Show("you have to update you email in the system to get the option to recovery your password");
                    }
                }
                else
                {
                    MessageBox.Show("you have to update you email in the system to get the option to recovery your password");
                }
            }
        }
        private void btn_login_Click(object sender, EventArgs e)
        {
            if (textBox_userName.TextLength == 0)
            {
                MessageBox.Show("Must enter user id first!");
                connect_with_facebook = false;
                return;
            }
            int id = -1;

            try
            {
                id   = System.Convert.ToInt32(textBox_userName.Text.ToString());
                user = SettingDatabase.GetUserById(id);
            }
            catch (Exception) { user = SettingDatabase.GetUserByEmail(textBox_userName.Text); }



            string pass = textBox_password.Text.ToString();

            if (user == null)
            {
                MessageBox.Show("The user " + textBox_userName.Text + " dont exist!");
                connect_with_facebook = false;
                ResetDetailsLogin();
                return;
            }

            if (user != null && pass.Equals(user.password) || connect_with_facebook)
            {
                // move to new form
                if ("Student".Equals(user.permission))
                {
                    try
                    {
                        DbContextDal dal = new DbContextDal(); //New database connection
                        MessageBox.Show("Successfull Login as " + user.permission + " , continue to the Option Menu for you.\n");
                        Student student = dal.students.Find(user.ID);
                        this.Hide();
                        StudentMenu studentMenu = new StudentMenu(student);
                        studentMenu.refToLogInForm = this;
                        studentMenu.Show();
                        ResetDetailsLogin();
                    }
                    catch (Exception) { }
                }
                else if ("Grader".Equals(user.permission))
                {
                    DbContextDal dal  = new DbContextDal(); //New database connection
                    Grader       StCo = dal.Graders.Find(user.ID);
                    this.Hide();
                    GraderMenu graderMenu = new GraderMenu();
                    graderMenu.refToLogInForm = this;
                    graderMenu.Show();
                    ResetDetailsLogin();
                }
                else if ("StudentCoordinator".Equals(user.permission))
                {
                    DbContextDal       dal  = new DbContextDal(); //New database connection
                    StudentCoordinator StCo = dal.StudentCoordinators.Find(user.ID);
                    this.Hide();
                    StudentCoordinatorMenu StCoMenu = new StudentCoordinatorMenu(StCo);
                    StCoMenu.refToLogInForm = this;
                    StCoMenu.Show();
                    ResetDetailsLogin();
                }
                else if ("Grader".Equals(user.permission))
                {
                    DbContextDal dal  = new DbContextDal(); //New database connection
                    Grader       StCo = dal.Graders.Find(user.ID);
                    this.Hide();
                    GraderMenu graderMenu = new GraderMenu();
                    graderMenu.refToLogInForm = this;
                    graderMenu.Show();
                    ResetDetailsLogin();
                }
                else if ("Registrar".Equals(user.permission))
                {
                    DbContextDal dal = new DbContextDal(); //New database connection
                    Registrar    reg = dal.Registrars.Find(user.ID);
                    this.Hide();
                    RegistrarMenu menu = new RegistrarMenu(reg);
                    menu.refToLogInForm = this;
                    menu.Show();
                    ResetDetailsLogin();
                }
                else if ("Secretary".Equals(user.permission) || "Admin".Equals(user.permission))
                {
                    try
                    {
                        DbContextDal dal = new DbContextDal(); //New database connection
                        MessageBox.Show("Successfull Login as " + user.permission + " , continue to the Option Menu for you");
                        this.Hide();
                        Form_MenuSecretaryAdmin myForm = new Form_MenuSecretaryAdmin(user);
                        myForm.refToLogInForm = this;
                        myForm.Show();
                        ResetDetailsLogin();
                    }
                    catch (Exception) { }
                }
                else if ("Lecturer".Equals(user.permission) || "Practitioner".Equals(user.permission))
                {
                    try
                    {
                        MessageBox.Show("Successfull Login as " + user.permission + " , continue to the Option Menu for you");
                        Form_MenuLecturerPractitioner myForm = new Form_MenuLecturerPractitioner(user);
                        this.Hide();
                        myForm.refToLogInForm = this;
                        myForm.Show();
                        ResetDetailsLogin();
                    }
                    catch (Exception) { }
                }
                else
                {
                    MessageBox.Show("Successfull Login, for Null permmision!");
                }
            }
            else
            {
                MessageBox.Show("Wrong password !");
                textBox_password.Text = "";
            }
        }