// button edit the logged user data
        private void button_Edit_User_Click(object sender, EventArgs e)
        {
            MY_DB mydb = new MY_DB();

            Int32  id    = Globals.GlobalUserId; // get the user id
            string fname = textBoxFName.Text;
            string lname = textBoxLName.Text;
            string uname = textBoxUsername.Text;
            string pass  = textBoxPassword.Text;

            MemoryStream pic = new MemoryStream();

            pictureBoxUserImage.Image.Save(pic, pictureBoxUserImage.Image.RawFormat);

            if (uname.Equals("") || pass.Equals("")) // check if the username or the password are empty
            {
                MessageBox.Show("Required Fields: username and password", "Edit Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (user.updateUser(id, fname, lname, uname, pass, pic))
                {
                    MessageBox.Show("Your Inormation Has Been UpDated", "Edit Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Error", "Edit Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        // button login
        private void button_login_Click(object sender, EventArgs e)
        {
            MY_DB db = new MY_DB();

            SqlDataAdapter adapter = new SqlDataAdapter();

            DataTable table = new DataTable();

            SqlCommand command = new SqlCommand("SELECT * FROM [user] WHERE username = @usn AND pass = @pass", db.getConnection);

            if (verifFields("login")) // check empty fields
            {
                command.Parameters.AddWithValue("@usn", TextBoxUsername.Text);
                command.Parameters.AddWithValue("@pass", TextBoxPassword.Text);

                adapter.SelectCommand = command;

                adapter.Fill(table);

                if (table.Rows.Count > 0)
                {
                    int userid = Convert.ToInt32(table.Rows[0][0].ToString());

                    // we will get the user id and make it global ( visible in all forms and classes ) using Globals class
                    Globals.SetGlobalUserIId(userid);


                    // if this user exist
                    // we will set the dialogResult to OK
                    // that mean the login informatons are correct -> open the mainform
                    // check out the "Program.cs"
                    // learn more here -> https://stackoverflow.com/questions/4759334/how-can-i-close-a-login-form-and-show-the-main-form-without-my-application-closi

                    /*Hide();
                     * Main_Form mForm = new Main_Form();
                     * mForm.Show();*/
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    MessageBox.Show("Invalid Username Or Password", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            else
            {
                MessageBox.Show("Empty Username Or Password", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }