private void pictureBox4_Click(object sender, EventArgs e) { //Manda uma mensagem de aviso caso o usuario não selecione um relatorio if (dgv_Listagem.SelectedRows.Count <= 0) { MessageBox.Show("É necessario selecionar um registro"); return; } if (MessageBox.Show("Excluir registro?", "Excluir", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { //gerar um novo objeto de acordo com a seleção Relatorio relatorioClick = dgv_Listagem.SelectedRows[0].DataBoundItem as Relatorio; RelatorioNegocio relatorioNegocio = new RelatorioNegocio(); string retorno = relatorioNegocio.ExcluirRelatorio(relatorioClick); // manda uma mensagem caso o relatorio seja excluido com sucesso ou haja algum erro try { int num = Convert.ToInt32(retorno); MessageBox.Show("relatorio excluido" + "," + " com sucesso"); AtualizaGrid(); } catch (Exception) { MessageBox.Show("erro" + retorno); } } }
private void RelatorioInadimplentes_load() { RelatorioNegocio relatorioNegocio = new RelatorioNegocio(); Relatorio relatorio = new Relatorio(); lblTituloRelatorio.Text = "Relatório de Alunos Inadimplentes"; lblDataAtual.Text = DateTime.Now.ToLongDateString(); GridViewInadimplentes.Columns.Clear(); relatorio = relatorioNegocio.ObterRelatorioInadimplentes(); if (relatorio.NumProjetos > 0 || relatorio.NumAlunos > 0) { List <AlunoParcela> listAlunoProjeto = relatorioNegocio.ObterAlunosInadimplentes(); GridViewInadimplentes.Visible = true; bttImpressao.Visible = true; lbl1.Text = "R$ " + relatorio.ValorTotal.ToString(); textLBL1.Text = "Total: "; lbl2.Text = relatorio.NumAlunos.ToString() + " alunos"; textLBL2.Text = "Número de Alunos: "; lbl3.Text = relatorio.MediaDiasAtrasados.ToString() + " dias"; textLBL3.Text = "Média de dias Atrasados: "; lbl4.Text = relatorio.MaiorAtraso.ToString() + " dias"; textLBL4.Text = "Maior Atraso: "; textLBL4.Visible = true; lbl4.Visible = true; GridViewInadimplentes.DataSource = listAlunoProjeto; GridViewInadimplentes.AutoGenerateColumns = false; BoundField bfNomeAluno = new BoundField(); bfNomeAluno.DataField = "Nome"; bfNomeAluno.HeaderText = "Nome do Aluno"; GridViewInadimplentes.Columns.Add(bfNomeAluno); BoundField bfNumeroPece = new BoundField(); bfNumeroPece.DataField = "NumeroPECE"; bfNumeroPece.HeaderText = "Número PECE"; GridViewInadimplentes.Columns.Add(bfNumeroPece); BoundField bfParcelaVencida = new BoundField(); bfParcelaVencida.HtmlEncode = false; bfParcelaVencida.DataField = "ParcelaVencida"; bfParcelaVencida.DataFormatString = "{0:d}"; bfParcelaVencida.HeaderText = "Parcela Vencida"; GridViewInadimplentes.Columns.Add(bfParcelaVencida); BoundField bfValorDevido = new BoundField(); bfValorDevido.DataFormatString = "R$ {0:F2}"; bfValorDevido.DataField = "ValorParcela"; bfValorDevido.HeaderText = "Valor Devido"; GridViewInadimplentes.Columns.Add(bfValorDevido); GridViewInadimplentes.DataBind(); } else { PanelSucesso.Visible = true; } }
private void RelatorioArrecadacaoMes_load() { RelatorioNegocio relatorioNegocio = new RelatorioNegocio(); Relatorio relatorio = new Relatorio(); int mes = Convert.ToInt32(mnMesReferencia.Text); int ano = Convert.ToInt32(txtAnoReferencia.Text); lblTituloRelatorio.Text = "Relatório Mensal da Arrecadação Confirmada"; lblDataAtual.Text = DateTime.Now.ToLongDateString(); GridViewInadimplentes.Columns.Clear(); relatorio = relatorioNegocio.ObterRelatorioArrecadacaoMes(mes, ano); if (relatorio.NumProjetos > 0 || relatorio.NumAlunos > 0) { GridViewInadimplentes.Visible = true; bttImpressao.Visible = true; List <Projeto> listProjeto = relatorioNegocio.ObterArrecadacaoMes(mes, ano); lbl1.Text = "R$ " + relatorio.ValorTotal.ToString(); textLBL1.Text = "Total Arrecadado: "; lbl2.Text = "R$ " + relatorio.ValorJuros.ToString(); textLBL2.Text = "Arrecadação com os juros: "; lbl3.Text = relatorio.NumAlunos.ToString() + " alunos"; textLBL3.Text = "Número de Alunos: "; lbl4.Text = relatorio.NumProjetos.ToString() + " projetos"; textLBL4.Text = "Número de Projetos: "; textLBL4.Visible = true; lbl4.Visible = true; GridViewInadimplentes.DataSource = listProjeto; GridViewInadimplentes.AutoGenerateColumns = false; BoundField bfNomeProjeto = new BoundField(); bfNomeProjeto.DataField = "Nome"; bfNomeProjeto.HeaderText = "Nome do Projeto"; GridViewInadimplentes.Columns.Add(bfNomeProjeto); BoundField bfCodProjeto = new BoundField(); bfCodProjeto.DataField = "Codigo"; bfCodProjeto.HeaderText = "Código do Projeto"; GridViewInadimplentes.Columns.Add(bfCodProjeto); BoundField bfValorArrecadado = new BoundField(); bfValorArrecadado.DataField = "Valor"; bfValorArrecadado.DataFormatString = "R$ {0:F2}"; bfValorArrecadado.HeaderText = "Arrecadação no Mês"; GridViewInadimplentes.Columns.Add(bfValorArrecadado); GridViewInadimplentes.DataBind(); } else { PanelSucesso.Visible = true; } }
private void AtualizaGrid() { //Chama a classe RelatorioNegocios RelatorioNegocio relatorioNegocio = new RelatorioNegocio(); // instancia a grid view com a classe relatorio coleção RelatorioColecao relatorioColecao = relatorioNegocio.ConsultaRelatorio(); dgv_Listagem.DataSource = null; dgv_Listagem.DataSource = relatorioColecao; // atualiza a data grid e da um refresh nela dgv_Listagem.Update(); dgv_Listagem.Refresh(); }
private void pictureBox1_Click(object sender, EventArgs e) { //chama a classe relatorio e insere seus dados Relatorio relatorio = new Relatorio(); relatorio.DiaHora = Convert.ToDateTime(dtpHorario.Value); relatorio.Tabela = txtTabela.Text.Trim(); relatorio.Linha = txtLinha.Text.Trim(); relatorio.CodFiscal = Convert.ToInt32(cbbNomeFiscal.SelectedValue); relatorio.CodMotorista = Convert.ToInt32(cbbNomeMotorista.SelectedValue); // chama a classe relatorio RelatorioNegocio relatorioNegocio = new RelatorioNegocio(); //se a variavel receber inserir ela insere um novo relatorio if (tipoacaoglobal == "inserir") { string retorno = relatorioNegocio.InserirRelatorio(relatorio); // manda uma mensagem para o usuario caso a insersao seja concluida ou nao try { int num = Convert.ToInt32(retorno); MessageBox.Show("relatorio inserido com sucesso"); } catch (Exception) { MessageBox.Show("Erro" + retorno); } } else { // caso a variavel nao receba a insersao ela altera as informações relatorio.CodRelatorio = Convert.ToInt32(txtCodigo.Text); string retorno = relatorioNegocio.AlterarRelatorio(relatorio); try { int num = Convert.ToInt32(retorno); MessageBox.Show("Relatorio alterado com sucesso"); } catch (Exception) { MessageBox.Show("erro" + retorno); } } }
/// <summary> /// /// </summary> public RelatorioController() { _appRelatorio = new RelatorioNegocio(); }