private void preencherLstv() { listView1.Items.Clear(); Queue array = new Queue(); if (tipoTela == "funcao") { FuncionarioDelegate funcionarioD = new FuncionarioDelegate(); array = funcionarioD.preencherCbxFuncao(); } else if (tipoTela == "fabricante") { FerramentaDelegate ferramentaDel = new FerramentaDelegate(); array = ferramentaDel.preencherCbxFabricante(); } else { FerramentaDelegate ferramentaDel = new FerramentaDelegate(); array = ferramentaDel.preencherCbxGrupo(); } while (array.Count != 0) { listView1.Items.Add(array.Dequeue().ToString()); } }
private void pesquisarFerramenta() { if (tipoTela == "adicionar") { objPesquisaFerramenta.codSituacao = "Disponível"; } FerramentaDelegate ferramentaDel = new FerramentaDelegate(); Queue arrayFerramentas = ferramentaDel.pesquisaFerramenta(objPesquisaFerramenta); ferramentas.Clear(); while (arrayFerramentas.Count != 0) { ferramentas.Add((Ferramenta)arrayFerramentas.Dequeue()); } }
private void manterCbx(string comando, string valorAntigo, string novoValor) { if (tipoTela == "funcao") { FuncionarioDelegate funcionarioDelegate = new FuncionarioDelegate(); funcionarioDelegate.manterFuncao(comando, valorAntigo, novoValor); } else if (tipoTela == "fabricante") { FerramentaDelegate ferramentaDel = new FerramentaDelegate(); ferramentaDel.manterFabricante(comando, valorAntigo, novoValor); } else if (tipoTela == "categoria") { FerramentaDelegate ferramentaDel = new FerramentaDelegate(); ferramentaDel.manterGrupo(comando, valorAntigo, novoValor); } }
private void btnDesativar_Click(object sender, EventArgs e) { if (objFerramenta == null) { new Mensagem("Selecione uma ferramenta \n primeiro!", "informacao", SGA.Properties.Resources.atencao).ShowDialog(); } else { Mensagem mensagem = new Mensagem("Deseja realmente excluir \n este registro?", "senha", SGA.Properties.Resources.key); while (1 == 1) { mensagem.tbxSenha.Text = ""; mensagem.ShowDialog(); try { if (mensagem.DialogResult == DialogResult.OK) { FuncionarioDelegate funcionarioDel = new FuncionarioDelegate(); Funcionario funcionario = usuarioLogado; funcionario.senha = Criptografia.Encrypt(mensagem.texto); funcionarioDel.Logar(funcionario); FerramentaDelegate ferramentaDel = new FerramentaDelegate(); ferramentaDel.desativaFerramenta(objFerramenta); new Mensagem("Registro excluído com sucesso!", "informacao", SGA.Properties.Resources.ok).ShowDialog(); usuarioLogado.alteracao = true; break; } else { break; } } catch (Exception erro) { if (erro.Message == "Matrícula e/ou Senha inválidos! \n Entre novamente com os dados!") { new Mensagem("Senha incorreta!", "informacao", SGA.Properties.Resources.erro).ShowDialog(); } else { new Mensagem(erro.Message, "informacao", SGA.Properties.Resources.erro).ShowDialog(); break; } } } } objFerramenta = null; pbxFerramenta.Image = null; montarTela(); }