Exemplo n.º 1
0
 private void FormCadUsuarios_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F6)
     {
         if (btnConsultaGeral.Enabled)
         {
             LimparCampos();
             OrganizaBotoes();
             butAlterar.Enabled = false;
             FormGridUsuarios grid = new FormGridUsuarios(this);
             grid.MdiParent = this.ParentForm;
             grid.Show();
         }
     }
     else if (e.KeyCode == Keys.Enter)
     {
         if (e.Shift)
         {
             e.SuppressKeyPress = true;
             SendKeys.Send("+{TAB}");
         }
         else
         {
             e.SuppressKeyPress = true;
             SendKeys.Send("{TAB}");
         }
     }
 }
Exemplo n.º 2
0
        private void btnConsultaGeral_Click(object sender, EventArgs e)
        {
            LimparCampos();
            OrganizaBotoes();
            butAlterar.Enabled = false;
            FormGridUsuarios grid = new FormGridUsuarios(this);

            grid.MdiParent = this.ParentForm;
            grid.Show();
        }
Exemplo n.º 3
0
        private void butConsultar_Click(object sender, EventArgs e)
        {
            if (tbCodigo.Text.Length == 0)
            {
                LimparCampos();
                OrganizaBotoes();
                butAlterar.Enabled = false;
                FormGridUsuarios grid = new FormGridUsuarios(this);
                grid.MdiParent = this.ParentForm;
                grid.Show();
            }
            else
            {
                usu    = new Usuario();
                usu.Id = Convert.ToInt32(tbCodigo.Text);
                usu.ConsutarUsuario();
                if (usu.Nome != null)
                {
                    tbLogin.Text   = usu.Nome;
                    tbSenha.Text   = usu.Senha;
                    tbSenhaC.Text  = tbSenha.Text;
                    cbxPerfil.Text = usu.Perfil;

                    tbCodigo.Focus();
                    tbCodigo.SelectAll();
                    butAlterar.Enabled = true;
                    butExcluir.Enabled = true;
                    butSalvar.Enabled  = false;
                }
                else
                {
                    this.LimparCampos();
                    this.OrganizaBotoes();
                }
            }
        }