Beispiel #1
0
 public EmployeePersonalInformation(HRMainForm HRMainForm)
 {
     try
     {
         InitializeComponent();
         dbconnection    = new MySqlConnection(connection.connectionString);
         this.HRMainForm = HRMainForm;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        private void txtPassword_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    string query = "select User_ID, User_Name from users where User_Name=@Name and Password=@Pass and (User_Type=0 or User_Type=2)";
                    conn.Open();
                    MySqlCommand comand = new MySqlCommand(query, conn);
                    comand.Parameters.AddWithValue("@Name", txtName.Text);
                    comand.Parameters.AddWithValue("@Pass", txtPassword.Text);
                    MySqlDataReader result = comand.ExecuteReader();


                    if (result != null)
                    {
                        while (result.Read())
                        {
                            UserControl.userID   = (int)result[0];
                            UserControl.userName = result[1].ToString();

                            HRMainForm f = new HRMainForm();
                            f.Show();
                        }

                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("please try again");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
 public EmployeesName(HRMainForm HRMainForm)
 {
     InitializeComponent();
     dbconnection    = new MySqlConnection(connection.connectionString);
     this.HRMainForm = HRMainForm;
 }