Exemple #1
0
        private void btn_cad_usuario_Click(object sender, EventArgs e)
        {
            string usuario = txbNome.Text;
            string senha   = txbSenha.Text;

            bool result = UserDataBase.AddUser(usuario, senha);

            UserDataBase.GetUsuarios(dataGridView1);
        }
Exemple #2
0
        private void btn_editar_Click(object sender, EventArgs e)
        {
            int             disp;
            DataGridViewRow row = dataGridView1.Rows[dataGridView1.CurrentRow.Index];

            if (chkDisponivel.CheckState == CheckState.Checked)
            {
                disp = 1;
            }
            else
            {
                disp = 0;
            }

            UserDataBase.EditUser(txbNome.Text, int.Parse(row.Cells["cd_usuario"].Value.ToString()), txbSenha.Text, disp);
            UserDataBase.GetUsuarios(dataGridView1);
        }
Exemple #3
0
        private void btn_logar_Click(object sender, EventArgs e)
        {
            // var username = txbNome.Text;
            // var password = txbSenha.Text;

            int userId = UserDataBase.GetUserIdByUsernameAndPassword(txbNome.Text, txbSenha.Text);

            if (userId > 0)
            {
                // Now you can put users id in a session-variable or what you prefer
                // and redirect the user to the protected area of your website.
                MessageBox.Show(string.Format("You are userId : {0}", userId));
            }
            else
            {
                MessageBox.Show("Wrong username or password");
            }
        }
Exemple #4
0
 private void btn_list_users_Click(object sender, EventArgs e)
 {
     UserDataBase.GetUsuarios(dataGridView1);
 }