private void btnLogar_Click(object sender, EventArgs e) { if (btnLogar.Text == "Logar") { modelLogin.ID = txtID.Text; Properties.SettingsLogado.Default.Nome = modelLogin.ID; modelLogin.Senha = txtSenha.Text; modelLogin.Status = "Conectado"; modelLogin.UltimoLog = DateTime.Now.ToString(); lblInvalido.Visible = false; modelLogin.Nivel = controllerLogin.VerificarLogin(modelLogin); if (modelLogin.Nivel != null) { this.Hide(); controllerLogin.InserirLog(modelLogin); controllerLogin.AlterarStatus(modelLogin); FrmPrincipal frmPrincipal = new FrmPrincipal(modelLogin); frmPrincipal.ShowDialog(); } else { txtID.Focus(); lblInvalido.Visible = true; return; } modelLogin.Status = "Desconectado"; modelLogin.UltimoLog = DateTime.Now.ToString(); controllerLogin.InserirLog(modelLogin); controllerLogin.AlterarStatus(modelLogin); Application.Exit(); } else if (btnLogar.Text == "OK") { modelLogin.ID = txtID.Text; modelLogin.Senha = txtSenha.Text; modelLogin.Nivel = controllerLogin.VerificarLogin(modelLogin); this.Close(); } }