コード例 #1
0
ファイル: UserManagement.cs プロジェクト: AndryHalcons/NAM
        //Este método crea los nuevos usuarios de la aplicacion
        private void ButtonAddUser_Click(object sender, EventArgs e)
        {
            listBoxRol.SelectedIndex = 0;
            bool   BUser       = Common.ValidadorCamposVacios(textBoxAddName.Text, "User");
            bool   BPass       = Common.ValidadorCamposVacios(textBoxAddPassword.Text, "Password");
            bool   Euser       = Sentencias.ValidarDatoExistente("usuarios", "User", textBoxAddName.Text);
            string rol         = listBoxRol.SelectedItem.ToString();
            string EncryptUser = textBoxAddName.Text;
            string EncryptPass = SecureCommon.EncryptHash(textBoxAddPassword.Text);

            if (Euser == true)
            {
                MessageBox.Show("User already exist!");
            }
            if (BUser == true && BPass == true && Euser == false)
            {
                Sentencias.Bbdd_apply_create_user(EncryptUser, EncryptPass, rol);
            }
            DatagridUser();
            textBoxAddName.Text     = null;
            textBoxAddPassword.Text = null;
        }