private void btnSignIn_Click(object sender, EventArgs e)
        {
            if (!username)
            {
                pbUserNameCorrect.Visible = false;
                pcUsernameWrong.Visible   = true;
            }
            if (!password)
            {
                pbPassCorrect.Visible   = false;
                pcPasswordWrong.Visible = true;
            }
            if (!confirm)
            {
                pbConfirmCorrect.Visible = false;
                pcConfirmWrong.Visible   = true;
            }

            if (password & confirm & username)
            {
                dbString db         = new dbString();
                string   connString = db.connectionSring;

                MySqlConnection conn = new MySqlConnection(connString);
                try
                {
                    //Send to db
                    // ConfigurationManager.ConnectionStrings["default"].ConnectionString;

                    conn.Open();
                    MySqlCommand comm = conn.CreateCommand();
                    comm.CommandText = "INSERT INTO `employeetable` (`empId`, `empName`, `empCallingName`, `empNIC`, `empAddress`, `empTelephone`, `empMobile`, `empGender`, `empEmail`, `empUsername`, `empPassword`, `empRole`) VALUES(NULL, '', '', '', '', '', '', '', '', @username, @password, '');";
                    comm.Parameters.AddWithValue("@username", txtUsername.Text);
                    comm.Parameters.AddWithValue("@password", txtPassword.Text);
                    comm.ExecuteNonQuery();
                    conn.Close();


                    //usernameVariable = txtUsername.Text;
                    this.Hide();
                    var createUser2 = new createUserAcc2Window(true, 0);
                    createUser2.Closed += (s, args) => this.Close();
                    createUser2.Show();
                }
                catch
                {
                    conn.Close();
                }
                finally
                {
                    //Close Connection
                }
            }
        }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var x = new createUserAcc2Window(false, Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value));

            x.ShowDialog();
        }