private void btnlogin_Click(object sender, EventArgs e) { //CONSULTA O USUARIO try { if (string.IsNullOrEmpty(txtuser.Text) || txtuser.Text == "Usuario") { MessageBoxEx.Show("Digite seu usuario!"); return; } if (string.IsNullOrEmpty(txtpass.Text) || txtpass.Text == "Senha") { MessageBoxEx.Show("Digite sua senha!"); return; } LoginUsuario USUARIO = new USUARIODAL().CONSULTAlOGIN(new LoginUsuario() { LOGIN = txtuser.Text.Trim(), SENHA = txtpass.Text.Trim() }); if (USUARIO.ID > 0) { this.DialogResult = DialogResult.OK; Sessao.Instance.SalvaUsuarioSessao(USUARIO); } else { MessageBoxEx.Show("usuario com senha ou login errados. Ferifique os campos."); } } catch (Exception EX) { MessageBoxEx.Show(EX.ToString()); } }
private void FrmUsuario_Load(object sender, EventArgs e) { //TRAZ TODO OS USUARIOS var ListadeUsuario = new USUARIODAL().CONSULTA(new LoginUsuario()); DGVDADOS.DataSource = null; DGVDADOS.DataSource = ListadeUsuario; }
protected void BtnEntraLogin_Click(object sender, EventArgs e) { //CONSULTA O USUARIO try { if (string.IsNullOrEmpty(txtemail.Text) || txtemail.Text == "Usuario") { MensageBox("Digite seu usuario!"); return; } if (string.IsNullOrEmpty(txtsenha.Text) || txtsenha.Text == "Senha") { MensageBox("Digite sua senha!"); return; } LoginUsuario USUARIO = new USUARIODAL().CONSULTAlOGIN(new LoginUsuario() { LOGIN = txtemail.Text.Trim(), SENHA = txtsenha.Text.Trim() }); if (USUARIO.ID > 0) { Session["Usuario"] = USUARIO; //colocando o usuario na tela principal LbNomeusuario.Text = USUARIO.NOME; LbNivel.Text = USUARIO.CARGO; LbOlaine.Text = "Online"; //MensageBox("Usuario Logado"); } else { MensageBox("usuario com senha ou login errados. Ferifique os campos."); } } catch (Exception EX) { MensageBox(EX.ToString()); } }
private void Inicializacao() { //Iniciar combo fornecedores var ListFornecedor = new FornecedorDAL().ListaFornecedor(new FornecedorModel()); comboFornecedor.ValueMember = "ID"; comboFornecedor.DisplayMember = "NOME"; ListFornecedor.Insert(0, new FornecedorModel() { NOME = "Selecione..." }); comboFornecedor.DataSource = null; comboFornecedor.DataSource = ListFornecedor; //Iniciar combo categoria var ListaCategoria = new DespesasReceitasDAL().ListaCategoria(new despesasCategoria()); Combocategoria.DisplayMember = "NOME"; Combocategoria.ValueMember = "ID"; ListaCategoria.Insert(0, new despesasCategoria() { NOME = "Selecione..." }); Combocategoria.DataSource = null; Combocategoria.DataSource = ListaCategoria; //Inicar combo Usuario var ListaUsuario = new USUARIODAL().CONSULTA(new LoginUsuario()); comboUsuario.DisplayMember = "NOME"; comboUsuario.ValueMember = "ID"; ListaUsuario.Insert(0, new LoginUsuario() { NOME = "Selecione..." }); comboUsuario.DataSource = null; comboUsuario.DataSource = ListaUsuario; }