private void btnDividirComanda_Click(object sender, EventArgs e) { try { if (MyListView.VerificarSeExisteItensNoListView(ltvProdutos) > 0) { InstanciarMovimentacaoProdutoRepositorio(); List <BaixarEstoque> lista = new List <BaixarEstoque>(); foreach (var item in MyListView.RetornarValoresParaDarBaixaNoEstoque(ltvProdutos)) { lista.Add(item); _movimentacaoProdutoRepositorio.Cadastrar(PopulaMovimentacaoProduto(item)); } if (OpenMdiForm.OpenForWithShowDialog(new frmDividirComanda(lista /*, comandaLista*/)) == DialogResult.Yes) { CarregarValorDoCaixaAtualiza(); PosSalvamentoPadrao(); ExcluirComandaAtiva(); } } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnAlterar_Click(object sender, EventArgs e) { try { if (dgvCategoria.Rows.Count > 0) { Categoria categoria = _categoriaRepositorio.GetCategoriaPorID(PegaLinhaDoGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarCategoria(categoria, EnumTipoOperacao.Alterar)) == DialogResult.Yes) { CarregarGrid(); } } else { MyErro.MyCustomException("Selecione uma categoria."); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnNovo_Click(object sender, EventArgs e) { if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarCategoria(new Categoria(), EnumTipoOperacao.Salvar)) == DialogResult.Yes) { CarregarGrid(); } }
private void dgvProdutos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { InstanciarProdutoRepositorio(); if (e.RowIndex >= 0) { if (dgvProdutos.Rows.Count > 0 && _produtoRepositorio.GetQuantidade() > 0) { int linha = PegaLinhaDoGrid(); Produto produto = _produtoRepositorio.GetProdutoPorID(linha); OpenMdiForm.OpenForWithShowDialog(new frmCadastrarProduto(produto, EnumTipoOperacao.Detalhes)); LimparTxt(); FocarNoTxt(txtPesquisar); } } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnDeletar_Click(object sender, EventArgs e) { try { if (dgvUsuarios.Rows.Count > 0) { InstanciaUsuarioRepositorio(); Usuarios usuario = _usuarioRepositorio.GetUsuarioPorNome(PegaLinhaSelecionadaDOGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarLogin(usuario, EnumTipoOperacao.Deletar)) == DialogResult.Yes) { CarregaGrid(); } } else { MyErro.MyCustomException("Selecione um Usuário"); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void dgvEstoque_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { InstanciarEstoqueRepositorio(); if (dgvEstoque.Rows.Count > 0 && _estoqueRepositorio.GetQuantidade() > 0 && e.RowIndex >= 0) { int linha = PegarLinhaDoGrid(); Produto produto = _estoqueRepositorio.GetLinhaPeloID(linha); LimparTxt(); FocarNoTxt(); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarProduto(produto, EnumTipoOperacao.Estoque)) == DialogResult.Yes) { CarregaGrid(); } } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnAlterar_Click(object sender, EventArgs e) { try { InstanciarComandaRepositorio(); if (dgvComanda.Rows.Count > 0 && _comandaRepositorio.GetQuantidade() > 0) { Comanda comanda = _comandaRepositorio.GetComandaPorID(PegaLinhaSelecionadaDoGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarComanda(EnumTipoOperacao.Alterar, comanda)) == DialogResult.Yes) { CarregaGrid(); } } else { MyErro.MyCustomException("Selecione uma comanda."); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnDeletar_Click(object sender, EventArgs e) { try { InstanciarProdutoRepositorio(); if (dgvProdutos.Rows.Count > 0 && _produtoRepositorio.GetQuantidade() > 0) { Produto produto = _produtoRepositorio.GetProdutoPorID(PegaLinhaDoGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarProduto(produto, EnumTipoOperacao.Deletar)) == DialogResult.Yes) { CarregaGrid(); } } else { MyErro.MyCustomException("Selecione um produto"); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnNovo_Click(object sender, EventArgs e) { if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarComanda(EnumTipoOperacao.Salvar, new Comanda())) == DialogResult.Yes) { CarregaGridSelecao(); } }
private bool ConcluirVendaComCreditar() { try { bool retorno = false; if (cbbTipoDePagamento.Text == EnumTipoPagamento.Creditar.ToString()) { if (OpenMdiForm.OpenForWithShowDialog(new frmClienteCreditar(EnumTipoCreditar.Vender)) == DialogResult.Yes) { InstanciarFiadoRepositorio(); _fiadoRepositorio.Cadastrar(new Fiado() { IDCliente = Cliente.ClienteIDStatic, IDFuncionario = Usuarios.IDStatic, Valor = GetTotalDividoPelaParcela() }); PosSalvamentoPadrao(); MensagemDeAviso(); retorno = true; } else { retorno = false; } } return(retorno); } catch (CustomException erro) { throw new CustomException(erro.Message); } catch (Exception erro) { throw new Exception(erro.Message); } }
private void ltvProdutos_DoubleClick(object sender, EventArgs e) { try { InstanciarProdutoRepositorio(); Produto produto = _produtoRepositorio.GetProdutoPorCodigo(MyListView.RetornarValorPeloIndexDaColuna(ltvProdutos, 1)); if (produto != null) { if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarProduto(produto, EnumTipoOperacao.ListView)) == DialogResult.Yes) { if (MyListView.RemoverItem(ltvProdutos)) { GetValorNaComanda(); LimparTxt(new List <TextBox>() { txtValorPago }); FocarNoTxt(txt: txtValorPago); } } } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnDeletar_Click(object sender, EventArgs e) { try { if (dgvCliente.Rows.Count > 0) { InstanciarClienteRepositorio(); Model.Entidades.Cliente cliente = _clienteRepositorio.GetClientePorID(GetLinhaDoGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarCliente(cliente, EnumTipoOperacao.Deletar)) == DialogResult.Yes) { CarregarGrid(); } } else { MyErro.MyCustomException("Selecione um Cliente."); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void PosSalvamento() { if (Application.OpenForms.Count > 1) { this.DialogResult = DialogResult.Yes; } else { OpenMdiForm.OpenForWithShow(new frmLogin(), this); } }
private void Logar() { UsuarioRepositorio _usuarioRepositorio = new UsuarioRepositorio(); OpenMdiForm.OpenForWithShow ( formParaAbrir: _usuarioRepositorio.Logar(PreencherLogin()) == Existe ? new frmMenu(_usuarioRepositorio.GetUsuarioPorNome(PreencherLogin().Nome)) : new Form().FormException("Usuário ou senha incorretos"), formParaFechar: this ); }
private void btnDeletar_Click(object sender, EventArgs e) { try { InstanciarComandaRepositorio(); if (dgvComanda.Rows.Count > 0 && _comandaRepositorio.GetQuantidade() > 0) { InstanciarComandaRepositorio(); if (_enumComanda == EnumComanda.Seleção) { Comanda comanda = _comandaRepositorio.GetComandaPorID(PegaIDSelecionadaDoGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarComanda(EnumTipoOperacao.Deletar, comanda)) == DialogResult.Yes) { CarregaGridSelecao(); } } else if (_enumComanda == EnumComanda.Comanda) { Comanda comanda = _comandaRepositorio.GetComandaPorID(PegaIDSelecionadaDoGrid()); if (OpenMdiForm.OpenForWithShowDialog(new frmCriarAnomalias(new Anomalias { IDComanda = comanda.ID, IDUsuario = Usuarios.IDStatic, Valor = GetvalorDaComanda(), }, EnumAnomalia.Criar)) == DialogResult.Yes) { InstanciarVendaComComandaAtivaRepositorio(); int resultado = _vendaComComandaAtivaRepositorio.DeletaItensDaComandaPorCodigo(dgvComanda.CurrentRow.Cells["Código"].Value.ToString()); if (resultado > 0) { DialogMessage.MessageFullComButtonOkIconeDeInformacao("Itens da Comanda deletado com Sucesso.", "Titulo"); CarregarGridComanda(); FocarNoBtn(btn: btnSair); } } } } else { MyErro.MyCustomException("Selecione uma comanda."); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnPesuisarProduto_Click(object sender, EventArgs e) { try { OpenMdiForm.LoadNewKeepAnother(this, new frmPesquisarProduto(EnumMovimentacao.Pesquisa)); } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnGerenciarComanda_Click(object sender, EventArgs e) { try { OpenMdiForm.LoadNewKeepAnother(this, new frmGerenciarComanda(EnumComanda.Seleção)); } catch (CustomException error) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(error.Message, "Aviso"); } catch (Exception error) { SaveErroInTxt.RecordInTxt(error, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(error.Message, "Erro"); } }
private void btnLogin_Click(object sender, EventArgs e) { try { OpenMdiForm.OpenAndCloseNoMdi(new frmLogin(), this); } catch (CustomException error) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(error.Message, "Aviso"); } catch (Exception error) { SaveErroInTxt.RecordInTxt(error, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(error.Message, "Erro"); } }
private void btnSangria_Click(object sender, EventArgs e) { try { OpenMdiForm.LoadNewKeepAnother(this, new frmSangria()); } catch (CustomException error) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(message: error.Message, title: "Aviso"); } catch (Exception error) { SaveErroInTxt.RecordInTxt(error, this.GetType().Name); DialogMessage.MessageFullComButtonOkIconeDeInformacao(message: error.Message, title: "Aviso"); } }
private void btnPesuisarProduto_Click(object sender, EventArgs e) { try { OpenMdiForm.LoadNewKeepAnother(this, new frmPesquisarProduto(EnumMovimentacao.Neutro)); } catch (CustomException error) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(error.Message, "Aviso"); } catch (Exception error) { SaveErroInTxt.RecordInTxt(error, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(error.Message, "Erro"); } }
private void btnReceberCredito_Click(object sender, EventArgs e) { try { OpenMdiForm.OpenForWithShowDialog(new frmClienteCreditar(EnumTipoCreditar.Pagar)); CarregarValorDoCaixaAtualiza(); } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void Logar() { try { UsuarioRepositorio _usuarioRepositorio = new UsuarioRepositorio(); if (_usuarioRepositorio.Logar(PreencherLogin())) { new UsuarioRepositorio().AdicionarUltimoAcesso(PreencherLogin().Login); OpenMdiForm.OpenForWithShow(formParaAbrir: new frmMenu(_usuarioRepositorio.GetUsuarioPorLogin(PreencherLogin().Login)), formParaFechar: this); } else if (_usuarioRepositorio.GetUsuarioPorLogin(PreencherLogin().Login) == null && _usuarioRepositorio.GetUsuarioPorSenha(PreencherLogin().Senha) != null) { DialogMessage.MessageFullComButtonOkIconeDeInformacao("O Login: "******" não esta cadastrado.", "Aviso"); LimparTxt(new List <TextBox> { txtLogin }); FocarNotxt(txt: txtLogin); } else if (_usuarioRepositorio.GetUsuarioPorSenha(PreencherLogin().Senha) == null && _usuarioRepositorio.GetUsuarioPorLogin(PreencherLogin().Login) != null) { DialogMessage.MessageFullComButtonOkIconeDeInformacao("Senha incorreta.", "Aviso"); LimparTxt(new List <TextBox> { txtSenha }); FocarNotxt(txt: txtSenha); } else { DialogMessage.MessageFullComButtonOkIconeDeInformacao("Login e senha incorretos.", "Aviso"); LimparTxt(new List <TextBox> { txtLogin, txtSenha }); FocarNotxt(txt: txtLogin); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(message: erro.Message, title: "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(message: erro.Message, title: "Erro"); } }
private void btnNovo_Click(object sender, EventArgs e) { try { if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarProduto(new Produto(), EnumTipoOperacao.Salvar)) == DialogResult.Yes) { CarregaGrid(); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnAbrirCaixa_Click(object sender, EventArgs e) { try { if (OpenMdiForm.OpenForWithShowDialog(new frmAdicionarCaixa(EnumTipoOperacaoCaixa.Adicionar)) == DialogResult.Yes) { CarregarValorDoCaixaAtualiza(); FocarNoTxt(txtCodigoDaComanda); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnNovo_Click(object sender, EventArgs e) { try { if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarCliente(new Model.Entidades.Cliente(), EnumTipoOperacao.Salvar)) == DialogResult.Yes) { CarregarGrid(); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void btnAdicionarCategoria_Click(object sender, EventArgs e) { try { if (OpenMdiForm.OpenForWithShowDialog(new frmCadastrarCategoria(new Categoria(), EnumTipoOperacao.Salvar)) == DialogResult.Yes) { CarregarCategoriaComSelecao(); FocarNoTxt(txtDescricao); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }
private void dgvUsuarios_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { InstanciaUsuarioRepositorio(); if (dgvUsuarios.Rows.Count > 0 && e.RowIndex >= 0 && _usuarioRepositorio.GetQuantidadeUsuarios() > 0) { try { Usuarios usuario = _usuarioRepositorio.GetUsuarioPorNome(PegaLinhaSelecionadaDOGrid()); OpenMdiForm.OpenForWithShowDialog(new frmCadastrarLogin(usuario, EnumTipoOperacao.Detalhes)); LimparTxt(); FocarNoTxt(); } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } } }
private void dgvAvisosEstoque_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex >= 0) { var codigo = dgvAvisosEstoque.CurrentRow.Cells["Código"].Value.ToString(); if (codigo != null) { var formAlertEstoque = new frmGerenciarEstoque(); GerenciarGerenciamentoDeEstoque.FecharForm(formAlertEstoque); Estoque.CodigoEstoque = codigo; OpenMdiForm.LoadNewKeepAnother(ContainerContext.Context, formAlertEstoque); } } } catch (Exception erro) { SaveErroInTxt.RecordInTxt(erro, this.GetType().Name); throw; } }
private void dgvSangria_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { int idSangria = Convert.ToInt32(dgvSangria.CurrentRow.Cells[0].Value); InstanciarSangriaRepositorio(); SangriaViewModel sangriaViewModel = _sangriaRepositorio.GetViewModelPorID(id: idSangria); if (OpenMdiForm.OpenForWithShowDialog(new frmCriarSangria(EnumSangria.Exibir, sangriaViewModel)) == DialogResult.Yes) { ; } } catch (CustomException error) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(message: error.Message, title: "Aviso"); } catch (Exception error) { SaveErroInTxt.RecordInTxt(error, this.GetType().Name); DialogMessage.MessageFullComButtonOkIconeDeInformacao(message: error.Message, title: "Aviso"); } }
private void dgvProdutos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { InstanciarProdutoRepositorio(); if (_enumMovimentacao == EnumMovimentacao.Movimentacao) { Produto prod = _produtoRepositorio.GetProdutoPorID(GetIdNoGrid()); OpenMdiForm.OpenForWithShowDialog(new frmMovimentacaoProdutos(prod)); LimparTxt(txtPesquisar); FocarNoTxt(); } } catch (CustomException erro) { DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso"); } catch (Exception erro) { DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro"); } }