void BtnConfirmaClick(object sender, EventArgs e) { string msg = ""; bool result; string codigo = edtCodigo.Text.Trim(); if (acao == 'I') { acao = 'i'; return; } if (acao == 'A') { acao = 'a'; return; } if (acao == 'i') { result = sistemas.Inclui(codigo, edtDescricao.Text, ref msg); } else { result = sistemas.Altera(codigo, edtDescricao.Text, ref msg); } if (!result) { if (acao == 'i') { MessageBox.Show(codigo + "\n" + msg, "Erro na inclusão do sistema", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(codigo + "\n" + msg, "Erro na alteração do sistema", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.Cursor = Cursors.WaitCursor; sistemas.Carrega(dgvCadastro, ""); this.Cursor = Cursors.Default; int selecionado = Procura(codigo, true); if (selecionado >= 0) { dgvCadastro.Rows[selecionado].Cells[0].Selected = true; AtualizaDados(selecionado); } DesabilitaEdicao(); DesabilitaEdicaoLocal(); }
void FrmCadSistemasLoad(object sender, EventArgs e) { sistemas = new cSistemas(); this.Cursor = Cursors.WaitCursor; sistemas.Carrega(dgvCadastro, ""); this.Cursor = Cursors.Default; DesabilitaEdicaoLocal(); }
void FrmControleAcessoLoad(object sender, EventArgs e) { controle = new cControleAcesso(); usuarios = new cUsuarios(); this.Cursor = Cursors.WaitCursor; usuarios.Carrega(dbgUsuarios, "where IDT_ADMINISTRADOR <> 'S'"); this.Cursor = Cursors.Default; if (dbgUsuarios.Rows.Count == 0) { Close(); } iUsuario = 0; filiais = new cFiliais(); this.Cursor = Cursors.WaitCursor; filiais.Carrega(dbgFiliais); this.Cursor = Cursors.Default; if (dbgFiliais.Rows.Count == 0) { Close(); } iFilial = 0; sistemas = new cSistemas(); this.Cursor = Cursors.WaitCursor; sistemas.Carrega(dbgSistemas, "where COD_SISTEMA <> 1"); this.Cursor = Cursors.Default; if (dbgSistemas.Rows.Count == 0) { Close(); } iSistema = 0; ColoreFiliais(); ColoreSistemas(); CarregaProgramas(); ColoreProgramas(); }