public Auditoria(DateTime dataAuditoria, int idAuditor, string nome, Ocorrencias ocorrencias) { data = dataAuditoria; this.idAuditor = idAuditor; nomeAuditor = nome; qtdOcorrencias = ocorrencias.QtdOcorrencias; this.ocorrencias = ocorrencias.ListOcorrencias; }
public void Editar(Ocorrencias ocorrencias) { OcorrenciasDAO ocorrenciasDao = new OcorrenciasDAO(); if (ocorrencias.CodOcorrencia != 0) { ocorrenciasDao.Update(ocorrencias); } }
public void Gravar(Ocorrencias ocorrencias) { OcorrenciasDAO ocorrenciasDao = new OcorrenciasDAO(); if ((ocorrencias.BA.Ba_Cod != 0) && (ocorrencias.Moradores.CodMorador != 0) && (ocorrencias.Motivo != "")) { ocorrenciasDao.Insert(ocorrencias); } }
public void VincularOcorrencia(Guid idOcorrencia) { if (idOcorrencia == Guid.Empty) { throw new DomainException(nameof(Ocorrencias), "Nenhum identificador de Ocorrência passado"); } Ocorrencias.Add(idOcorrencia); }
public void InformarLiberacao() { if (!Ativo) { throw new ComputadorDesativadoException(); } Ocorrencias.Add(Ocorrencia.OcorrenciaFabrica.ComputadorLiberado()); }
public MainController() { f = new Funcionario(); fs = new Funcionarios(); es = new Equipamentos(); vs = new Vulnerabilidades(); audis = new Auditorias(); os = new Ocorrencias(); LoadAll(); }
public static bool GuardaOcorrencias(string nomeFicheiro) { try { return(Ocorrencias.Save(nomeFicheiro)); } catch (Exception e) { throw new Exception("Erro ao guardar dados no ficheiro de ocorrencias " + e.Message); } }
public static bool ApagaOcorrencia(int id) { try { return(Ocorrencias.ApagaOcorrencia(ProcuraOcorrencia(id))); } catch (Exception e) { throw new Exception("Erro ao apagar ocorrencia: " + e.Message); } }
public static OcorrenciaDB ProcuraOcorrencia(int id) { try { return(Ocorrencias.ProcuraOcorrencia(id)); } catch (Exception e) { throw new Exception("Erro ao procurar ocorrencia: " + e.Message); } }
public static int InsereOcorrencia(Ocorrencia o) { try { return(Ocorrencias.InsereOcorrencia(o)); } catch (Exception e) { throw new Exception("Erro ao inserir ocorrencia: " + e.Message); } }
public ActionResult Edit([Bind(Include = "ocoid,datahoraocorrencia,Descricao,CondoNome,Status,ApeId,Codigo")] Ocorrencias ocorrencias) { if (ModelState.IsValid) { db.Entry(ocorrencias).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ApeId = new SelectList(db.Apartamento, "ApeId", "NomeApe", ocorrencias.ApeId); ViewBag.Codigo = new SelectList(db.Usuarios, "Codigo", "Email", ocorrencias.Codigo); return(View(ocorrencias)); }
// GET: Ocorrencias/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ocorrencias ocorrencias = db.Ocorrencias.Find(id); if (ocorrencias == null) { return(HttpNotFound()); } return(View(ocorrencias)); }
// GET: Ocorrencias/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ocorrencias ocorrencias = db.Ocorrencias.Find(id); if (ocorrencias == null) { return(HttpNotFound()); } ViewBag.ApeId = new SelectList(db.Apartamento, "ApeId", "NomeApe", ocorrencias.ApeId); ViewBag.Codigo = new SelectList(db.Usuarios, "Codigo", "Email", ocorrencias.Codigo); return(View(ocorrencias)); }
private void btnBuscar_Click(object sender, EventArgs e) { Ocorrencias ocorrencias = new Ocorrencias(); OcorrenciasBO ocorrenciasBO = new OcorrenciasBO(); OcorrenciasDAO ocorrenciasDAO = new OcorrenciasDAO(); this.dataGridView1.DefaultCellStyle.Font = new Font("Arial", 10); if (rbtApto.Checked) { try { ocorrencias.BA.Apto = txtBusca.Text; dataGridView1.DataSource = ocorrenciasDAO.BuscaApto(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma ocorrência encontrada"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } if (rbtBloco.Checked) { try { ocorrencias.BA.Bloco = txtBusca.Text; dataGridView1.DataSource = ocorrenciasDAO.BuscaBloco(txtBusca.Text); for (int i = 0; i == dataGridView1.RowCount; i++) { MessageBox.Show("Nenhuma ocorrência encontrada"); txtBusca.Clear(); } } catch { MessageBox.Show("Preencha corretamente as informações"); } } }
public async Task <RetornoCommands> Handle(IncluirOcorrenciaCommand request, CancellationToken cancellationToken) { try { var ocorrencia = new Ocorrencias(request.descricao, request.titulo, request.DataOcorrencia, request.idUsuario, request.nome); await _ocorrenciaRepository.insert(ocorrencia); return(new RetornoCommands { mensagens = "Operação realizada com sucesso !" }); } catch (Exception ex) { return(new RetornoCommands { mensagens = ex.Message.ToString() }); } }
public static bool CarregaOcorrencias(string nomeFicheiro) { try { if (File.Exists(nomeFicheiro)) { return(Ocorrencias.Load(nomeFicheiro)); } else { return(false); } } catch (Exception e) { throw new Exception("Erro ao carregar dados do ficheiro de ocorrencias " + e.Message); } }
public async Task SendAsync(Ocorrencias ocorrencias) { string URI = "http://homologacao.8quali.com.br/api/importacaoOcorrencia"; HttpClient client = new HttpClient(); Uri uri = new Uri(string.Format(URI, string.Empty)); string json = JsonConvert.SerializeObject(ocorrencias); var content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = null; response = client.PostAsync(uri, content).Result; //response = client.GetAsync(uri.ToString()); if (response.IsSuccessStatusCode) { string content1 = response.Content.ReadAsStringAsync().Result; Debug.WriteLine(@"\Ocorrencia successfully saved."); } }
public void Insert(Ocorrencias ocorrencias) { try { MySqlCommand comando = new MySqlCommand(); comando.CommandType = CommandType.Text; comando.CommandText = "Insert into Ocorrencias(CodMorador,Motivo,Data,BA_Cod) " + "values(@CodMorador,@Motivo,@Data,@BA_Cod)"; comando.Parameters.AddWithValue("@Motivo", ocorrencias.Motivo); comando.Parameters.AddWithValue("@Data", ocorrencias.Data); comando.Parameters.AddWithValue("@CodMorador", ocorrencias.Moradores.CodMorador); comando.Parameters.AddWithValue("@Ba_Cod", ocorrencias.BA.Ba_Cod); ConexaoBanco.CRUD(comando); } catch (Exception ex) { throw new Exception("Não foi possível se conectar" + ex.Message); } }
public void Update(Ocorrencias ocorrencias) { try { MySqlCommand comando = new MySqlCommand(); comando.CommandType = CommandType.Text; comando.CommandText = "Update ocorrencias set Data=@Data, CodMorador=@CodMorador, Motivo=@Motivo, " + "Ba_Cod=@Ba_Cod where CodOcorrencia=@CodOcorrencia"; comando.Parameters.AddWithValue("@Data", ocorrencias.Data); comando.Parameters.AddWithValue("@CodMorador", ocorrencias.Moradores.CodMorador); comando.Parameters.AddWithValue("@Motivo", ocorrencias.Motivo); comando.Parameters.AddWithValue("@Ba_Cod", ocorrencias.BA.Ba_Cod); comando.Parameters.AddWithValue("@CodOcorrencia", ocorrencias.CodOcorrencia); ConexaoBanco.CRUD(comando); } catch (Exception ex) { throw new Exception("Não foi possível se conectar" + ex.Message); } }
public ActionResult Create([Bind(Include = "ocoid,datahoraocorrencia,Descricao,CondoNome,Status,ApeId,Codigo")] Ocorrencias ocorrencias) { Condomino usuario = AdminLar.Repositories.Funcoes.GetCondomino(); if (usuario != null && usuario.Status == "Ativo") { ocorrencias.CondoNome = usuario.Con_Nome; ocorrencias.ApeId = usuario.ApeId; ocorrencias.datahoraocorrencia = DateTime.Now; ocorrencias.Status = "Ativo"; ocorrencias.Codigo = usuario.Codigo; db.Ocorrencias.Add(ocorrencias); db.SaveChanges(); return(RedirectToAction("Index", "Ocorrencias")); } else { return(RedirectToAction("AcessoNegado", "Landing")); } }
public BoletoInfo() { //BoletoID = 0; //CedenteID = 0; //SacadoID = 0; NumeroDocumento = "0"; NossoNumero = "0"; Quantidade = 0; ValorUnitario = 0; ValorDocumento = 0; ValorDesconto = 0; ValorAcrescimo = 0; ValorCobrado = 0; DataDocumento = DateTime.Now.Date; DataProcessamento = DateTime.Now.Date; DataVencimento = DateTime.MinValue; Demonstrativo = ""; Instrucoes = ""; DataPagamento = DateTime.Now.Date; SituacaoID = 0; LocalPagamento = BoletoTextos.LocalPagamento; Aceite = "N"; Especie = Especies.DM; // 1 Ocorrencia = Ocorrencias.Remessa; //1 ParcelaNumero = 0; ParcelaTotal = 0; CalculaMultaMora = true; Comando = 1; // 01 - Registro de títulos DataLimiteDesconto2 = DataVencimento; DataLimiteDesconto3 = DataVencimento; ValorDesconto2 = 0; ValorDesconto3 = 0; LinhaOrigem = ""; Reg = new Dictionary <string, object>(); }
public void Add(Ocorrencias ocorrencias) { sqlConnection.Insert(ocorrencias); }
public void Update(Ocorrencias ocorrencias) { sqlConnection.Update(ocorrencias); }
//Post 8quali private async void SwipeItem_Sincronizar(object sender, EventArgs e) { var item = (SwipeItem)sender; item.IsEnabled = false; item.BackgroundColor = Color.FromHex("597FAC"); item.IsVisible = false; using (UserDialogs.Instance.Loading(("Sincronizando dados..."))) { await Task.Run(() => { try { var param = (Ocorrencias)item.CommandParameter; param.sincronizar = false; ocorenciaDAL.Update(param); var usuarioIncluiu = usuarioDAL.GetAll().First(); var listaAnexos = ocorrenciaAnexoDAL.GetAll().Where(w => w.OcorrenciaId == param.OcorrenciaId).ToList(); foreach (var item2 in listaAnexos) { var bytes = GetPhoto(item2.FilePath); item2.Anexo = bytes; } var listaDispo = disposicaoInicial.GetAll().Where(w => w.OcorrenciaId == param.OcorrenciaId).ToList(); OcorrenciaAnexo[] anexos = new OcorrenciaAnexo[listaAnexos.Count]; DTODisposicaoInicial[] disposicoesInicial = new DTODisposicaoInicial[listaDispo.Count]; for (int j = 0; j < listaDispo.Count; j++) { disposicoesInicial[j] = listaDispo[j]; } for (int i = 0; i < listaAnexos.Count; i++) { anexos[i] = listaAnexos[i]; } Ocorrencias ocorrencias = new Ocorrencias(); ocorrencias.Codigo = param.Codigo; ocorrencias.Chave = param.Chave; ocorrencias.Descricao = param.Descricao; ocorrencias.UsuarioIncluiuLogin = usuarioIncluiu.email.ToString(); ocorrencias.DataInclusao = DateTime.Now; ocorrencias.Anexos = anexos; ocorrencias.DisposicaoInicials = disposicoesInicial; string output = JsonConvert.SerializeObject(ocorrencias); service.SendAsync(ocorrencias); } catch (Exception ex) { } }); } OnAppearing(); }
private static RetornoCNAB240 RetriveLine(String Line, RetornoCNAB240 Return, Int32 Count) { Object Identity; RetornoCNAB240 Result = (Return != null ? Return : throw new Exception("O retorno não pode ser nulo!")); Identity = Convert.ToInt32(Line.RetriveOnLine(8, 8)); switch ((IsFile)Identity) { case IsFile.HeaderFile: { Result.HeaderFile.Banco = new Itau(false); Result.HeaderFile.Banco.Codigo = Line.RetriveOnLine(1, 3); // CODIGO BANCARIO Result.HeaderFile.TipoInscricaoEmp = String.IsNullOrEmpty(Line.RetriveOnLine(18, 18).Trim())? 0 : Convert.ToInt32(Line.RetriveOnLine(18, 18)); // TIPO DE INSCRIÇÃO DA EMPRESA | CPF = '1' | CNPJ = '2' Result.HeaderFile.Empresa.CNPJ = Line.RetriveOnLine(19, 32); // NÚMERO DO CNPJ/CPF DA EMPRESA Result.HeaderFile.Empresa.Convenio = Line.RetriveOnLine(33, 45).Trim(); // CÓDIGO DO CONVÊNIO NO BANCO Result.HeaderFile.Empresa.ContaBancaria.AgenciaBancaria.Agencia = Line.RetriveOnLine(54, 57); // AGENCIA REFERENTE CONVÊNIO ASSINADO Result.HeaderFile.Empresa.ContaBancaria.Conta = Line.RetriveOnLine(66, 70); // NÚMERO DA C/C DO CLIENTE Result.HeaderFile.Empresa.ContaBancaria.Digito = Line.RetriveOnLine(72, 72); // DAC (Dígito de Auto Conferência) DA AGÊNCIA/ CONTA. Result.HeaderFile.Empresa.Nome = Line.RetriveOnLine(73, 102); // NOME DA EMPRESA Result.HeaderFile.Banco.Nome = Line.RetriveOnLine(103, 132).Trim(); // NOME DO BANCO Result.HeaderFile.CodigoRR = Line.RetriveOnLine(143, 143); // CÓDIGO REMESSA = 1/RETORNO = 2 Result.HeaderFile.DataGeracao = Line.RetriveOnLine(144, 151).FormatDate(); // DATA DE GERAÇÃO DO ARQUIVO Result.HeaderFile.HoraGeracao = Line.RetriveOnLine(152, 157).FormatHour(); // HORA DE GERAÇÃO DO ARQUIVO Result.HeaderFile.SequencialArquivo = Line.RetriveOnLine(158, 163); // NR. SEQUENCIAL DO ARQUIVO Result.HeaderFile.VLayout = Line.RetriveOnLine(164, 166); // NR. DA VERSÃO DO LAYOUT break; } case IsFile.HeaderAllotment: { HeaderAllotment HeaderAllotment = new HeaderAllotment(); HeaderAllotment.Banco = new Itau(false); Ocorrencias Ocorrencia = new Ocorrencias(); HeaderAllotment.Banco.Codigo = Line.RetriveOnLine(1, 3); // CODIGO BANCARIO HeaderAllotment.TipoInscricaoEmp = String.IsNullOrEmpty(Line.RetriveOnLine(18, 18).Trim()) ? 0 : Convert.ToInt32(Line.RetriveOnLine(18, 18)); // TIPO DE INSCRIÇÃO DA EMPRESA | CPF = '1' | CNPJ = '2' HeaderAllotment.Empresa.CNPJ = Line.RetriveOnLine(19, 32); // NÚMERO DO CNPJ/CPF DA EMPRESA HeaderAllotment.Empresa.Convenio = Line.RetriveOnLine(33, 45).Trim(); // CÓDIGO DO CONVÊNIO NO BANCO HeaderAllotment.Empresa.ContaBancaria.AgenciaBancaria.Agencia = Line.RetriveOnLine(54, 57); // AGENCIA REFERENTE CONVÊNIO ASSINADO HeaderAllotment.Empresa.ContaBancaria.Conta = Line.RetriveOnLine(66, 70); // NÚMERO DA C/C DO CLIENTE HeaderAllotment.Empresa.ContaBancaria.Digito = Line.RetriveOnLine(72, 72); // DAC (Dígito de Auto Conferência) DA AGÊNCIA/ CONTA. HeaderAllotment.Empresa.Nome = Line.RetriveOnLine(73, 102); // NOME DA EMPRESA HeaderAllotment.Empresa.Endereco.Nome = Line.RetriveOnLine(143, 172).Trim(); // ENDEREÇO EMPRESA NOME DA RUA, AV, PÇA, ETC... HeaderAllotment.Empresa.Endereco.Numero = String.IsNullOrEmpty(Line.RetriveOnLine(173, 177).Trim()) ? 0 : Convert.ToInt32(Line.RetriveOnLine(173, 177)); // NÚMERO DO LOCAL HeaderAllotment.Empresa.Endereco.Tipo = Line.RetriveOnLine(178, 192).Trim(); // CASA, APTO, SALA, ETC... HeaderAllotment.Empresa.Endereco.Cidade = Line.RetriveOnLine(193, 212).Trim(); // NOME DA CIDADE HeaderAllotment.Empresa.Endereco.CEP = Line.RetriveOnLine(213, 220).Trim(); // CEP HeaderAllotment.Empresa.Endereco.EstadoSigla = Line.RetriveOnLine(221, 222).Trim(); // SIGLA DO ESTADO HeaderAllotment.Ocorrencias = Ocorrencia.ReturnOccurrence(Line.RetriveOnLine(231, 240)); // CÓDIGO OCORRÊNCIAS Result.Allotment.Add(new Allotment() { HeaderAllotment = HeaderAllotment }); break; } case IsFile.DetailsAllotment: { DetailsAllotment DetailsAllotment = new DetailsAllotment(); DetailsAllotment.Banco = new Itau(false); Ocorrencias Ocorrencia = new Ocorrencias(); DetailsAllotment.Banco.Codigo = Line.RetriveOnLine(1, 3); // CODIGO BANCARIO DetailsAllotment.SequencialDetalhe = Line.RetriveOnLine(9, 13); // Nº SEQUENCIAL REGISTRO NO LOTE DetailsAllotment.CodigoIM = Line.RetriveOnLine(15, 17); // 000 = inclusão de debito | 999 = exlusão de debito DetailsAllotment.Cliente.ContaBancaria.AgenciaBancaria.Agencia = Line.RetriveOnLine(25, 28); // Nº. AGÊNCIA DEBITADA DetailsAllotment.Cliente.ContaBancaria.Conta = Line.RetriveOnLine(37, 41); // NR. DA CONTA DEBITADA DetailsAllotment.Cliente.ContaBancaria.Digito = Line.RetriveOnLine(43, 43); // DIGITO VERIFICADOR DA AG/CONTA DetailsAllotment.Cliente.Nome = Line.RetriveOnLine(44, 73).Trim(); // NOME DO DEBITADO DetailsAllotment.Cliente.DataCobranca = Line.RetriveOnLine(94, 101).FormatDate(); // DATA PARA O LANÇAMENTO DO DÉBITO DetailsAllotment.Banco.Moeda = Line.RetriveOnLine(102, 104); // TIPO DA MOEDA DetailsAllotment.Cliente.ValorMoeda = Line.RetriveOnLine(105, 119).FormatToMoney(5); // QUANTIDADE DA MOEDA OU IOF DetailsAllotment.Cliente.ValorAgendado = Line.RetriveOnLine(120, 134).FormatToMoney(2); // VALOR DO LANÇAMENTO PARA DÉBITO DetailsAllotment.DocumentoBanco = Line.RetriveOnLine(135, 154).Trim(); // NR. DO DOCUM. ATRIBUÍDO PELO BANCO DetailsAllotment.DataLancto = Line.RetriveOnLine(155, 162).FormatDate(); // DATA REAL DA EFETIVAÇÃO DO LANÇTO. DetailsAllotment.Empresa.Mora = (MoraTipo)Convert.ToInt32(Line.RetriveOnLine(178, 179)); //TIPO DO ENCARGO POR DIA DE ATRASO DetailsAllotment.Empresa.Juros = Convert.ToSingle(Line.RetriveOnLine(180, 196)); // VALOR DO ENCARGO P/ DIA DE ATRASO DetailsAllotment.Empresa.IdentificadorExtrato = Line.RetriveOnLine(197, 212).Trim(); // INFORMAÇÃO COMPL. P/ HISTÓRICO C/C DetailsAllotment.Cliente.CPF = Line.RetriveOnLine(217, 230).RemoveZeroLeftLine(11).Trim(); // Nº DE INSCRIÇÃO DO DEBITADO (CPF/CNPJ) DetailsAllotment.Ocorrencias = Ocorrencia.ReturnOccurrence(Line.RetriveOnLine(231, 240)); // CÓDIGO OCORRÊNCIAS Result.Allotment[Count].DetailsAllotment.Add(DetailsAllotment); break; } case IsFile.TrailerAllotment: { TrailerAllotment TrailerAllotment = new TrailerAllotment(); TrailerAllotment.Banco = new Itau(false); Ocorrencias Ocorrencia = new Ocorrencias(); TrailerAllotment.Banco.Codigo = Line.RetriveOnLine(1, 3); // CODIGO BANCARIO TrailerAllotment.SequencialLote = Line.RetriveOnLine(4, 7); // LOTE IDENTIFICAÇÃO DE SERVIÇO TrailerAllotment.Registro.TotalQtdLotes = Convert.ToInt32(Line.RetriveOnLine(18, 23)); //QTDE REGISTROS DO LOTE TrailerAllotment.ValorDebitoTotal = Line.RetriveOnLine(24, 41).FormatToMoney(2); //SOMA VALOR DOS DÉBITOS DO LOTE TrailerAllotment.ValorMoedaTotal = Line.RetriveOnLine(42, 59).FormatToMoney(5); //SOMATÓRIA DA QTDE DE MOEDAS DO LOTE TrailerAllotment.Ocorrencias = Ocorrencia.ReturnOccurrence(Line.RetriveOnLine(231, 240)); // CÓDIGO OCORRÊNCIAS Result.Allotment[Count].TrailerAllotment = TrailerAllotment; break; } case IsFile.TrailerFile: { Result.TrailerFile.Banco = new Itau(false); Result.TrailerFile.Banco.Codigo = Line.RetriveOnLine(1, 3); // CÓDIGO BANCO NA COMPENSAÇÃO Result.TrailerFile.SequencialLote = Line.RetriveOnLine(4, 7); // LOTE IDENTIFICAÇÃO DE SERVIÇO Result.TrailerFile.Registro.TotalQtdLotes = Convert.ToInt32(Line.RetriveOnLine(18, 23)); // QTDE LOTES DO ARQUIVO Result.TrailerFile.Registro.TotalQtdRegs = Convert.ToInt32(Line.RetriveOnLine(24, 29)); // QTDE REGISTROS DO ARQUIVO break; } } return(Result); }
private void btnAlterar_Click(object sender, EventArgs e) { for (int i = 0; i < dataGridView1.RowCount; i++) { dataGridView1.Rows[i].DataGridView.Columns.Clear(); } try { //pega codigo bloco apartamento BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); try { //pega codigo morador Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); //altera A ocorrencia try { Ocorrencias ocorrencias = new Ocorrencias(); OcorrenciasBO ocorrenciasBO = new OcorrenciasBO(); ocorrencias.Motivo = txtMotivo.Text.ToUpper(); if ((ocorrencias.Motivo == "") || (ocorrencias.Motivo == null)) { MessageBox.Show("Motivo não identificado"); } else { ocorrencias.CodOcorrencia = Convert.ToInt16(lblCodOcorrencia.Text); ocorrencias.Motivo = txtMotivo.Text.ToUpper(); ocorrencias.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); ocorrencias.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); ocorrencias.Data = Convert.ToDateTime(mskData.Text); ocorrenciasBO.Editar(ocorrencias); MessageBox.Show("Ocorrência editada com sucesso"); txtProprietario.Clear(); txtApto.Clear(); txtBloco.Clear();; txtMotivo.Clear(); mskData.Clear(); txtBusca.Clear(); panel1.Enabled = false; btnAlterar.Enabled = false; lblCodOcorrencia.Text = ""; } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }
private void btnCadastrar_Click(object sender, EventArgs e) { try { //puxar codigo do ba BA ba = new BA(); BABO babo = new BABO(); ba.Apto = txtApto.Text; ba.Bloco = txtBloco.Text; babo.BuscaCodBA(ba); if ((ba.Bloco == "") || (ba.Apto == "")) { MessageBox.Show("Bloco/Apartamento não encontrado"); txtApto.Clear(); txtBloco.Clear(); } else { lblBACod.Text = Convert.ToString(ba.Ba_Cod); //ouxar codigo do morador try { Moradores mor = new Moradores(); MoradoresBO morBO = new MoradoresBO(); mor.Nome = txtProprietario.Text; morBO.Buscar(mor); if (mor.Nome == "") { MessageBox.Show("Proprietário não encontrado"); txtProprietario.Clear(); } else { lblMoradorCod.Text = Convert.ToString(mor.CodMorador); try { //add ocorrencias Ocorrencias ocorrencias = new Ocorrencias(); OcorrenciasBO ocorrenciasBO = new OcorrenciasBO(); ocorrencias.Motivo = txtMotivo.Text; if ((ocorrencias.Motivo == "") || (ocorrencias.Motivo == null)) { MessageBox.Show("Motivo não identificado"); } else { ocorrencias.Motivo = txtMotivo.Text.ToUpper(); ocorrencias.Moradores.CodMorador = Convert.ToInt16(lblMoradorCod.Text); ocorrencias.BA.Ba_Cod = Convert.ToInt16(lblBACod.Text); ocorrencias.Data = Convert.ToDateTime(mskData.Text); ocorrenciasBO.Gravar(ocorrencias); MessageBox.Show("Ocorrência cadastrada com sucesso"); txtProprietario.Clear(); txtApto.Clear(); txtBloco.Clear(); txtMotivo.Clear(); mskData.Clear(); } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } } } catch { MessageBox.Show("Verifique os dados e tente novamente"); } }