protected virtual void Salvar_Click(object sender, EventArgs e) { try { if (ValidaAcessoFuncao(Operacao.Salvar)) { if (salvar(sender, e)) { if (this.atualizagrid != null) { this.atualizagrid(); } btnIncluir.Top = 40; btnIncluir.Visible = true; MessageBox.Show(Text + " salvo com sucesso.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); ImprimirRegistro(Id); } } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void CancelarPedido_Otica() { frmUtilCancelarPedido CancelarPedido = new frmUtilCancelarPedido(); try { if (ValidaAcessoFuncao(Operacao.Cancelar, CancelarPedido.Tag)) { if (dgvDados.CurrentRow != null) { if (dgvDados[0, dgvDados.CurrentRow.Index].Value != null) { if (Convert.ToInt32(dgvDados[0, dgvDados.CurrentRow.Index].Value) > 0) { Id = Convert.ToInt32(dgvDados[0, dgvDados.CurrentRow.Index].Value); DataGridViewCheckBoxCell cell = dgvDados[COL_CANCELADO, dgvDados.CurrentRow.Index] as DataGridViewCheckBoxCell; if (cell != null) { if (Convert.ToBoolean(cell.Value)) { Pedido_OticaBLL = new Pedido_OticaBLL(); Pedido_Otica Pedido_Otica = Pedido_OticaBLL.getPedido_Otica(p => p.Id == Id).FirstOrDefault(); if (MessageBox.Show("Pedido : " + Pedido_Otica.Id.ToString() + " - " + Pedido_Otica.cliente.nome_fantasia + " \n Já se encotra cancelado. Desfazer o cancelamento?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Pedido_Otica.cancelado = "N"; Pedido_Otica.data_cancelamento = null; Pedido_Otica.motivo_cancelamento = string.Empty; Pedido_OticaBLL.UsuarioLogado = Program.usuario_logado; Pedido_OticaBLL.AlterarPedido_Otica(Pedido_Otica); MessageBox.Show(Text + " salvo com sucesso.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { CancelarPedido.ExibeDialogo(this, Id); } } } } } this.atualizagrid(); } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { CancelarPedido.Dispose(); } }
private void dgvFiltro_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { try { executeEditingControlShowingChild(sender, e); } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridFiltros_CellLeave(object sender, DataGridViewCellEventArgs e) { try { executeCellLeaveChild(sender, e); } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dgvFiltro_CellEndEdit(object sender, DataGridViewCellEventArgs e) { try { executeCellEndEditChild(sender, e); dgvFiltro.Rows[e.RowIndex].ErrorText = String.Empty; } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { if (salvar(sender, e)) { MessageBox.Show(Text + " salvo com sucesso.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); DialogResult = DialogResult.OK; } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEntrar_Click(object sender, EventArgs e) { usuarioBLL = new UsuarioBLL(); try { this.Cursor = Cursors.WaitCursor; #if DEBUG Program.usuario_logado = usuarioBLL.Localizar(1); stUsuario.UsuarioLogado = Program.usuario_logado; this.DialogResult = DialogResult.OK; //Program.usuario_logado = usuarioBLL.loginSistema(txtUsuaio.Text, txtSenha.Text); //stUsuario.UsuarioLogado = Program.usuario_logado; //if (Program.usuario_logado != null) //{ // this.DialogResult = DialogResult.OK; //} //else //{ // MessageBox.Show("Usuário ou senha incorreto.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); // this.DialogResult = DialogResult.None; //} #else Program.usuario_logado = usuarioBLL.loginSistema(txtUsuaio.Text, txtSenha.Text); stUsuario.UsuarioLogado = Program.usuario_logado; if (Program.usuario_logado != null) { this.DialogResult = DialogResult.OK; } else { MessageBox.Show("Usuário ou senha incorreto.", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); this.DialogResult = DialogResult.None; } #endif this.Cursor = Cursors.Default; } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSalvar_Click(object sender, EventArgs e) { try { if (validacbPerfil()) { salvarnodefilho(tvFuncoes.Nodes); MessageBox.Show(Text + " salvo com sucesso.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); limparTela(); } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void Salvar_Click(object sender, EventArgs e) { try { if (ValidaAcessoFuncao(Operacao.Salvar)) { if (salvar(sender, e)) { DialogResult = DialogResult.OK; } } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void Salvar_Click(object sender, EventArgs e) { try { if (ValidaAcessoFuncao(Operacao.Cancelar)) { if (salvar(sender, e)) { MessageBox.Show(Text + " Pedido cancelado com sucesso.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void ImprimirRegistro(Int64?id) { frmRelReciboParcela relatorio = new frmRelReciboParcela(); try { relatorio.rvRelatorios.LocalReport.ReportEmbeddedResource = "prjbase.relatorios.relReciboParcela.rdlc"; relatorio.ExibeDialogo(this, id); } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { relatorio.Dispose(); } }
protected virtual void btnExcluir_Click(object sender, EventArgs e) { try { if (ValidaAcessoFuncao(Operacao.Excluir)) { if (dgvDados.CurrentRow != null) { this.Cursor = Cursors.WaitCursor; excluirRegistro(dgvDados.CurrentRow.Index); carregaConsulta(); AtualizaContadores(); this.Cursor = Cursors.Default; } } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void processaPagamento() { decimal saldo = 0; decimal saldo_inicial = 0; decimal entradas = 0; decimal saidas = 0; try { //Vamos realizar o processo de pagamento do contas a pagar. //Primeiro vamos ver se existe saldo no caixa para o pagamento da conta a pagar if (!chkPago.Checked) { Livro_CaixaBLL Livro_CaixaBLL = new Livro_CaixaBLL(); List <Livro_Caixa> lstLc = null; if (Id_filial != null) { lstLc = Livro_CaixaBLL.getLivro_Caixa(p => p.Id_filial == Id_filial & DbFunctions.TruncateTime(p.data) == DbFunctions.TruncateTime(DateTime.Now), true); } else { lstLc = Livro_CaixaBLL.getLivro_Caixa(p => DbFunctions.TruncateTime(p.data) == DbFunctions.TruncateTime(DateTime.Now), true); } Livro_Caixa Livro_Caixa = null; if (lstLc.Count > 0) { Livro_Caixa = lstLc.First(); } else { throw new Exception("Não existe movimentação aberta para realizar o pagamento."); } if (Livro_Caixa != null) { if (Livro_Caixa.status != "F") { entradas = Convert.ToDecimal(Livro_Caixa.item_livro_caixa.Where(p => p.tipo == "E").Sum(c => c.valor)); saidas = Convert.ToDecimal(Livro_Caixa.item_livro_caixa.Where(p => p.tipo == "S").Sum(c => c.valor)); saldo_inicial = Convert.ToDecimal(Livro_Caixa.saldo_inicial); //saldo obtido vamos comparar verificar se é suficinete para pagar saldo = ((saldo_inicial + entradas) - (-1 * saidas)); decimal valor = Convert.ToDecimal(txtValor.Text); if (valor <= saldo) { //Vamos registrar um item no livro de caixa e atualizar o conta a pagar //com a data de pagamento e o flag de pago. Item_Livro_CaixaBLL Item_LivroBLL = new Item_Livro_CaixaBLL(); try { Item_LivroBLL.UsuarioLogado = Program.usuario_logado; Item_Livro_Caixa Item_Livro = new Item_Livro_Caixa(); Item_Livro.Id_contaspagar = Convert.ToInt64(Id); Item_Livro.Id_empresa = Program.usuario_logado.Id_empresa; if (Id_filial != null) { Item_Livro.Id_filial = Id_filial; } Item_Livro.inclusao = DateTime.Now; Item_Livro.tipo = "S"; Item_Livro.descricao = "Contas a Pagar Documento: " + txtDocumento.Text; Item_Livro.usuario_inclusao = Program.usuario_logado.nome; Item_Livro.valor = valor; Item_Livro.Id_livro = Livro_Caixa.Id; Item_LivroBLL.AdicionarItem_Livro_Caixa(Item_Livro); if (Item_Livro.Id > 0) { Contas_PagarBLL = new Contas_PagarBLL(); Contas_PagarBLL.UsuarioLogado = Program.usuario_logado; Contas_Pagar cp = Contas_PagarBLL.Localizar(Id); cp.pago = "S"; cp.pagamento = DateTime.Now; cp.usuario_alteracao = Program.usuario_logado.nome; cp.alteracao = DateTime.Now; Contas_PagarBLL.AlterarContas_Pagar(cp); LoadToControls(); chkPago.Checked = true; chkPago.Enabled = false; chkPago.Visible = true; btnPagamento.Enabled = false; btnIncluir.Top = 40; btnIncluir.Visible = true; MessageBox.Show("Processo de Pagamento realizado com sucesso.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception) { throw; } } else { throw new Exception("saldo em caixa menor que o valor para pagamento."); } } else { throw new Exception("Não será possivel realizar o pagamento pois a movimentação diária está Fechada"); } } } } catch (Exception ex) { string mensagem = TrataException.getAllMessage(ex); MessageBox.Show(mensagem, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }