public static void EditarOcorrencia(ValidarJustificativaPontoView tela) { int codigoPonto = Convert.ToInt32(tela.tfCodPonto.Text); int codigoOcorrencia = Convert.ToInt32(tela.tfCodOcorrencia.Text); string Justificativa = tela.tfJustificativa.Text; int status = Convert.ToInt32(tela.cbStatus.SelectedValue); Ocorrencia o = new Ocorrencia(); o.SetCodOcorrencia(codigoOcorrencia); o.SetCodPonto(codigoPonto); o.SetJustificativa(Justificativa); o.SetStatus(status); OcorrenciaDAO obj = new OcorrenciaDAO(); int rs = obj.EditarOcorrencia(o); if (rs == 1) { MessageBox.Show("A ocorrencia foi alterada com sucesso."); } else { MessageBox.Show("Houve algum erro ao justificar a ocorrencia."); } }
public static void PreencherTabela(FunOcorrenciaView tela, int numRegistro) { OcorrenciaDAO obj = new OcorrenciaDAO(); DataSet ds = obj.VerificaPontos(numRegistro); tela.tabela.DataSource = ds; tela.tabela.DataMember = ds.Tables[0].TableName; }
public static void PreencheTabelaTodos(AdmVisualizarOcorrenciasView tela) { OcorrenciaDAO dao = new OcorrenciaDAO(); DataSet ds = dao.PreencheTabelaTodos(); tela.tabela.DataSource = ds; tela.tabela.DataMember = ds.Tables[0].TableName; }
public static void FiltraFuncionario(AdmVisualizarOcorrenciasView tela, string nome) { OcorrenciaDAO obj = new OcorrenciaDAO(); DataSet ds = obj.FiltraNome(nome); tela.tabela.DataSource = ds; tela.tabela.DataMember = ds.Tables[0].TableName; }
public static void PreencheTabela(AdmVisualizarOcorrenciasView tela) { OcorrenciaDAO obj = new OcorrenciaDAO(); DataSet ds = obj.PreencheTabelaAdm(); tela.tabela.DataSource = ds; tela.tabela.DataMember = ds.Tables[0].TableName; }
public static void PreencherCBStatus(ValidarJustificativaPontoView tela) { DataTable data = OcorrenciaDAO.PreencheCBStatus(); tela.cbStatus.DataSource = data; tela.cbStatus.ValueMember = "idStatus"; tela.cbStatus.DisplayMember = "descricao"; }
public static void PreencheCBStatus(FunCadastraOcorrencia tela) { DataTable data = OcorrenciaDAO.PreencheCBStatus(); tela.cbStatus.DataSource = data; tela.cbStatus.ValueMember = "idStatus"; tela.cbStatus.DisplayMember = "descricao"; tela.cbStatus.SelectedValue = 1; }
public static void PreencherCampos(ValidarJustificativaPontoView tela, int codigoOcorrencia) { OcorrenciaDAO dao = new OcorrenciaDAO(); IList <Ocorrencia> obj = dao.PreencherCampos(codigoOcorrencia); int count = obj.Count(); foreach (Ocorrencia o in obj) { tela.tfCodOcorrencia.Text = Convert.ToString(o.GetCodOcorrencia()); tela.tfCodPonto.Text = Convert.ToString(o.GetCodPonto()); tela.tfJustificativa.Text = o.GetJustificativa(); tela.cbStatus.SelectedValue = o.GetStatus(); } }
private void btnBusca_Click(object sender, EventArgs e) { OcorrenciaDAO novaOcorrencia = new OcorrenciaDAO(); ValidarNumerico validarId = new ValidarNumerico(); if (validarId.ValidarNumeros(txtIdBusca.Text, txtIdBusca.Name)) { int id = int.Parse(txtIdBusca.Text); dgvOcorrencia.DataSource = novaOcorrencia.retornaTabela(id); } else { MessageBox.Show("Por favor, digite apenas número", "Erro"); } }
private void btnEnviar_Click(object sender, EventArgs e) { String ocr = TxbOcorrencia.Text; if (String.IsNullOrEmpty(ocr)) { MessageBox.Show("Você deve fornecer uma ocorrência antes de prosseguir"); } else { var dao = new OcorrenciaDAO(); dao.setOcorrencia(ocr, idDivida); var registro = "ocorrencia registrada"; RelatorioDAO.inserirRegistro(idDivida, idDevedor, registro); this.Close(); } }
private void btnCadastro_Click(object sender, EventArgs e) { Ocorrencia novaOcorrencia = new Ocorrencia(); ValidarNumerico validar = new ValidarNumerico(); if (validar.ValidarNumeros(txtId.Text, txtId.Name)) { novaOcorrencia.IdCliente = int.Parse(txtId.Text); novaOcorrencia.Data = DateTime.Parse(dtpData.Text); novaOcorrencia.Tipo = cboTipo.Text; novaOcorrencia.Descricao = rtbDesc.Text; OcorrenciaDAO cadastrar = new OcorrenciaDAO(); cadastrar.InsertOcorrencia(novaOcorrencia); } else { MessageBox.Show("Por favor, digite apenas número", "Erro"); } }
private void Cadastrar(object sender, RoutedEventArgs e) { Ocorrencia o = new Ocorrencia(); o.Descricao = descricao.Text; o.DataOcorrencia = dataocorrencia.SelectedDate; Equipamento eq = EquipamentoDAO.ObterEquipamento(Convert.ToInt32(cboEquipamento.SelectedValue)); o.Equipamento = eq; o.OrdemDeServico = Convert.ToInt32(ordemservico.Text); o.PrevisaoRetorno = previsaoRetorno.SelectedDate; if (OcorrenciaDAO.CadastrarOcorrencia(o)) { MessageBox.Show("Ocorrência Cadastrada com sucesso!"); CarregarOcorrencias(); LimparFormulario(); } else { MessageBox.Show("Ocorrência não Cadastrada"); } }
private void mostrarDados() { this.devedor = this.dao.getDevedor(); this.d = this.ddao.getDivida(devedor.iddevedor); var hoje = DateTime.Now; int diasAtraso = (hoje.Date - d.dataVencimento.Date).Days; empresa = new EmpresaDAO().getEmpresa(d.idEmpresa); txbDevedor.Text = devedor.nome; txbEmail.Text = devedor.email; txbCpf.Text = devedor.cpf; txbTelefone.Text = devedor.telefone; txbContrato.Text = d.idDivida.ToString(); txbValor.Text = Utilitarios.calculoJuros(d.valor, d.dataVencimento).ToString("c"); txbDias.Text = diasAtraso.ToString(); txbJurosdia.Text = "1%"; txbData.Text = d.dataVencimento.ToString("dd/MM/yyyy"); txbCondicao.Text = d.status; txbEmpresa.Text = empresa.nome; txbValorInicial.Text = d.valor.ToString("c"); txbComissãoTotalMes.Text = Usuario.comissao.ToString(); txbComissao.Text = (0.05 * d.valor + Usuario.comissao).ToString("c"); //lista de ultimas ocorrencias var listaOcr = new OcorrenciaDAO().listLastOcorrencias(d.idDivida); foreach (var item in listaOcr) { lbOcr.Items.Add(item.conteudo + "data: " + item.dataocorrencia.ToString()); lbOcr.Items.Add(""); } }
public void CadastraOcorrencia(FunCadastraOcorrencia tela, string justificativa) { Ocorrencia o = new Ocorrencia(); o.SetCodPonto(Convert.ToInt32(tela.tfCod.Text)); o.SetStatus(Convert.ToInt32(tela.cbStatus.SelectedValue)); o.SetJustificativa(justificativa); OcorrenciaDAO obj = new OcorrenciaDAO(); int rs = obj.CadastraOcorrencia(o); if (rs == 1) { DialogResult dr = MessageBox.Show("Ocorrência cadastrado com sucesso.", "Confirma", MessageBoxButtons.OK); if (dr == DialogResult.OK) { tela.Close(); } } else { MessageBox.Show("Houve um erro ao cadastrar a ocorrencia."); } }
private void Atualizar(object sender, RoutedEventArgs e) { Ocorrencia oc = OcorrenciaDAO.BuscarOcorrencia(Convert.ToInt32(id.Text)); oc.DataDevolucao = dataDevolvido.SelectedDate; oc.Finalizado = true; if (OcorrenciaDAO.AtualizarOcorrencia(oc)) { MessageBox.Show("Ocorrência atualizada."); LimparFormulario(); CarregarOcorrencias(); btnCadastrar.Visibility = Visibility.Visible; lbDataDevolvido.Visibility = Visibility.Hidden; dataDevolvido.Visibility = Visibility.Hidden; btnAtualizar.Visibility = Visibility.Hidden; btnCancelarAtualizar.Visibility = Visibility.Hidden; } else { MessageBox.Show("Ocorrência não atualizada."); } }
private void CarregarOcorrencias() { List <Ocorrencia> ocorrencias = OcorrenciaDAO.ListarOcorrencias(); tabelaOcorrencias.ItemsSource = ocorrencias; }