public void cadastraOcorrencia(LancamentoOcorrenciaModel olacamento) { string clausulaSQL = "CADASTRA_OCORRENCIA"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@DATA_CADASTRO", olacamento.dataOcorrencia); comandoSQL.Parameters.AddWithValue("@STATUS", olacamento.statusOcorrencia); comandoSQL.Parameters.AddWithValue("@DESCRICAO", olacamento.descricaoOcorrencia); comandoSQL.Parameters.AddWithValue("@BLOCO", olacamento.oAp.bloco); comandoSQL.Parameters.AddWithValue("@AP", olacamento.oAp.apartamento); comandoSQL.Parameters.AddWithValue("@DATA_RESOLUCAO", olacamento.dataOcorrencia); comandoSQL.Parameters.AddWithValue("@DATA_CANCEL", olacamento.dataCancelamento); comandoSQL.Parameters.AddWithValue("@CAMINHO_IMAGEM_EVIDENCIA", olacamento.imagemEvidencia); comandoSQL.Parameters.AddWithValue("@TIPO_OCORRENCIA", olacamento.oOcorrencia.codigoOcorencia); ExecutaComando(comandoSQL); } catch (Exception) { throw; } }
public listaLancamentoOcorrencia buscaOcorrenciaByMeses(LancamentoOcorrenciaModel olancamento, int mes, int ano) { string clausulaSQL = "LISTA_OCORRENCIA_MORADOR"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@BLOCO", olancamento.oAp.bloco); comandoSQL.Parameters.AddWithValue("@AP", olancamento.oAp.apartamento); comandoSQL.Parameters.AddWithValue("@MES", mes); comandoSQL.Parameters.AddWithValue("@ANO", ano); DataTable tbLancamento = new DataTable(); tbLancamento = ExecutaQuery(comandoSQL); return populaOcorrencia(tbLancamento); } catch (Exception) { throw; } }
public void cadastraOcorrencia(LancamentoOcorrenciaModel olacamento) { try { oPropriDAO.cadastraOcorrencia(olacamento); } catch (Exception e) { throw e; } }
public void cadastraOcorrencia(LancamentoOcorrenciaModel olacamento) { try { oPropriDAO.cadastraOcorrencia(olacamento); } catch (Exception e) { throw e; } }
public listaLancamentoOcorrencia buscaOcorrenciaById(LancamentoOcorrenciaModel olancamento) { string clausulaSQL = "LISTA_OCORRENCIA_MORADOR_byID"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@CODIGO", olancamento.codigoOcorrencia); DataTable tbLancamento = new DataTable(); tbLancamento = ExecutaQuery(comandoSQL); return(populaOcorrencia(tbLancamento)); } catch (Exception) { throw; } }
public listaLancamentoOcorrencia buscaOcorrenciaById(LancamentoOcorrenciaModel olancamento) { string clausulaSQL = "LISTA_OCORRENCIA_MORADOR_byID"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@CODIGO", olancamento.codigoOcorrencia); DataTable tbLancamento = new DataTable(); tbLancamento = ExecutaQuery(comandoSQL); return populaOcorrencia(tbLancamento); } catch (Exception) { throw; } }
public listaLancamentoOcorrencia listaReclamacoesAbertas(LancamentoOcorrenciaModel oLancamento) { string clausulaSQL = "LISTA_OCORRENCIA_ABERTAS"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@MES", oLancamento.dataOcorrencia); comandoSQL.Parameters.AddWithValue("@ANO", oLancamento.dataOcorrencia); DataTable tbLancamento = new DataTable(); tbLancamento = ExecutaQuery(comandoSQL); return(populaOcorrencia(tbLancamento)); } catch (Exception) { throw; } }
public listaLancamentoOcorrencia listaReclamacoesAbertas(LancamentoOcorrenciaModel oLancamento) { string clausulaSQL = "LISTA_OCORRENCIA_ABERTAS"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@MES", oLancamento.dataOcorrencia); comandoSQL.Parameters.AddWithValue("@ANO", oLancamento.dataOcorrencia); DataTable tbLancamento = new DataTable(); tbLancamento = ExecutaQuery(comandoSQL); return populaOcorrencia(tbLancamento); } catch (Exception) { throw; } }
public listaLancamentoOcorrencia buscaOcorrenciaByMeses(LancamentoOcorrenciaModel olancamento, int mes, int ano) { string clausulaSQL = "LISTA_OCORRENCIA_MORADOR"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@BLOCO", olancamento.oAp.bloco); comandoSQL.Parameters.AddWithValue("@AP", olancamento.oAp.apartamento); comandoSQL.Parameters.AddWithValue("@MES", mes); comandoSQL.Parameters.AddWithValue("@ANO", ano); DataTable tbLancamento = new DataTable(); tbLancamento = ExecutaQuery(comandoSQL); return(populaOcorrencia(tbLancamento)); } catch (Exception) { throw; } }
public void cadastraOcorrencia(LancamentoOcorrenciaModel olacamento) { string clausulaSQL ="CADASTRA_OCORRENCIA"; try { SqlCommand comandoSQL = new SqlCommand(clausulaSQL); comandoSQL.Parameters.AddWithValue("@DATA_CADASTRO", olacamento.dataOcorrencia); comandoSQL.Parameters.AddWithValue("@STATUS", olacamento.statusOcorrencia); comandoSQL.Parameters.AddWithValue("@DESCRICAO", olacamento.descricaoOcorrencia); comandoSQL.Parameters.AddWithValue("@BLOCO", olacamento.oAp.bloco); comandoSQL.Parameters.AddWithValue("@AP", olacamento.oAp.apartamento); comandoSQL.Parameters.AddWithValue("@DATA_RESOLUCAO", olacamento.dataOcorrencia); comandoSQL.Parameters.AddWithValue("@DATA_CANCEL", olacamento.dataCancelamento); comandoSQL.Parameters.AddWithValue("@CAMINHO_IMAGEM_EVIDENCIA", olacamento.imagemEvidencia); comandoSQL.Parameters.AddWithValue("@TIPO_OCORRENCIA", olacamento.oOcorrencia.codigoOcorencia); ExecutaComando(comandoSQL); } catch (Exception) { throw; } }
protected void btnOcorrencia_Click(object sender, EventArgs e) { if (drpListSubject.SelectedItem.Value != "-1") { LancamentoOcorrenciaModel oLancamento = new LancamentoOcorrenciaModel(); ApartamentoModel oApartamento = new ApartamentoModel(); OcorrenciaModel oOcorrencia = new OcorrenciaModel(); oLancamento.dataOcorrencia = DateTime.Now; oLancamento.statusOcorrencia = Util.Util.statusChamado.aberto.ToString().ToUpper(); oLancamento.descricaoOcorrencia = txtDescription.Text; oApartamento.bloco = Convert.ToInt32(Session["Bloco"]); oApartamento.apartamento = Convert.ToInt32(Session["AP"].ToString()); oLancamento.oAp = oApartamento; oLancamento.dataFinalizacao = DateTime.Now; oLancamento.dataCancelamento = DateTime.Now; double tamanhoArquivo = 0; double permitido = 1000; string erroRegra = "0"; string extensao = ""; string diretorio = ""; if (fileImagem.PostedFile.FileName != "") { arq = fileImagem.PostedFile.FileName; folder = System.Configuration.ConfigurationManager.AppSettings["EvidenciaMoradorOC"] + "/" + tira_acentos(arq); tamanhoArquivo = Convert.ToDouble(fileImagem.PostedFile.ContentLength) / 1024; extensao = arq.Substring(arq.Length - 4).ToLower(); if (tamanhoArquivo > permitido) { this.lblMsg.Text = "Tamanho Máximo permitido é de " + permitido + " kb!"; lblMsg.Visible = true; erroRegra = "1"; } if (extensao.Trim() != ".jpg" && extensao.Trim() != ".gif" && extensao.Trim() != ".png" && extensao.Trim() != ".bmp") { lblMsg.Text = "Extensão inválida, só são permitidas .jpg, .gif, .png,.bmp"; lblMsg.Visible = true; erroRegra = "2"; } if (erroRegra == "0") { if (!System.IO.File.Exists(diretorio)) { fileImagem.PostedFile.SaveAs(Server.MapPath(folder)); } else { lblMsg.Text = "Já existe uma imagem com esse nome!, por favor mude o nome do arquivo e tente novamente"; } } } if (erroRegra != "2" && erroRegra != "1") { diretorio = Server.MapPath(folder); oLancamento.imagemEvidencia = tira_acentos(arq); oOcorrencia.codigoOcorencia = Convert.ToInt32(drpListSubject.SelectedItem.Value); oLancamento.oOcorrencia = oOcorrencia; try { oProprietario.cadastraOcorrencia(oLancamento); dvCadastro.Visible = false; lblMsg.Visible = true; Session["MensagemCadastro"] = true; Response.Redirect("detalheOcorrencia.aspx"); } catch (Exception) { throw; } } } else { lblMsg.Visible = true; lblMsg.Text = "Por favor esolha um assunto!!"; } }
public listaLancamentoOcorrencia populaOcorrencia(System.Data.DataTable dt) { listaLancamentoOcorrencia olist = new listaLancamentoOcorrencia(); foreach (DataRow itemOcorrencia in dt.Rows) { LancamentoOcorrenciaModel oLancamento = new LancamentoOcorrenciaModel(); OcorrenciaModel oOcorrencia = new OcorrenciaModel(); ApartamentoModel Oap = new ApartamentoModel(); if (itemOcorrencia.Table.Columns.Contains("OCORRENCIA")) oLancamento.codigoOcorrencia = Convert.ToInt32(itemOcorrencia["OCORRENCIA"]); if (itemOcorrencia.Table.Columns.Contains("DATA_OCORRENCIA")) oLancamento.dataOcorrencia = Convert.ToDateTime(itemOcorrencia["DATA_OCORRENCIA"]); if (itemOcorrencia.Table.Columns.Contains("STATUS")) oLancamento.statusOcorrencia = itemOcorrencia["STATUS"].ToString(); if (itemOcorrencia.Table.Columns.Contains("DESCRICAO")) oLancamento.ocorrenciaLancamento = itemOcorrencia["DESCRICAO"].ToString(); if (itemOcorrencia.Table.Columns.Contains("DATA_FINALIZACAO")) oLancamento.dataFinalizacao = Convert.ToDateTime(itemOcorrencia["DATA_FINALIZACAO"]); if (itemOcorrencia.Table.Columns.Contains("DATA_CANCELAMENTO")) oLancamento.dataCancelamento = Convert.ToDateTime(itemOcorrencia["DATA_CANCELAMENTO"]); if (itemOcorrencia.Table.Columns.Contains("DescricaoOcorrencia")) oLancamento.descricaoOcorrencia = itemOcorrencia["DescricaoOcorrencia"].ToString(); if (itemOcorrencia.Table.Columns.Contains("imagem")) oLancamento.imagemEvidencia = itemOcorrencia["imagem"].ToString(); if (itemOcorrencia.Table.Columns.Contains("BLOCO")) Oap.apartamento = Convert.ToInt32(itemOcorrencia["BLOCO"]); if (itemOcorrencia.Table.Columns.Contains("AP")) Oap.bloco = Convert.ToInt32(itemOcorrencia["AP"]); oLancamento.oAp = Oap; olist.Add(oLancamento); } return olist; }
protected void btnOcorrencia_Click(object sender, EventArgs e) { if (drpListSubject.SelectedItem.Value != "-1") { LancamentoOcorrenciaModel oLancamento = new LancamentoOcorrenciaModel(); ApartamentoModel oApartamento = new ApartamentoModel(); OcorrenciaModel oOcorrencia = new OcorrenciaModel(); oLancamento.dataOcorrencia = DateTime.Now; oLancamento.statusOcorrencia = Util.Util.statusChamado.aberto.ToString().ToUpper(); oLancamento.descricaoOcorrencia = txtDescription.Text; oApartamento.bloco = Convert.ToInt32(Session["Bloco"]); oApartamento.apartamento = Convert.ToInt32(Session["AP"].ToString()); oLancamento.oAp = oApartamento; oLancamento.dataFinalizacao = DateTime.Now; oLancamento.dataCancelamento = DateTime.Now; double tamanhoArquivo = 0; double permitido = 1000; string erroRegra = "0"; string extensao = ""; string diretorio = ""; if (fileImagem.PostedFile.FileName != "") { arq = fileImagem.PostedFile.FileName; folder = System.Configuration.ConfigurationManager.AppSettings["EvidenciaMoradorOC"] + "/" + tira_acentos(arq); tamanhoArquivo = Convert.ToDouble(fileImagem.PostedFile.ContentLength) / 1024; extensao = arq.Substring(arq.Length - 4).ToLower(); if (tamanhoArquivo > permitido) { this.lblMsg.Text = "Tamanho Máximo permitido é de " + permitido + " kb!"; lblMsg.Visible = true; erroRegra = "1"; } if (extensao.Trim() != ".jpg" && extensao.Trim() != ".gif" && extensao.Trim() != ".png" && extensao.Trim() != ".bmp") { lblMsg.Text = "Extensão inválida, só são permitidas .jpg, .gif, .png,.bmp"; lblMsg.Visible = true; erroRegra = "2"; } if (erroRegra == "0") { if (!System.IO.File.Exists(diretorio)) { fileImagem.PostedFile.SaveAs(Server.MapPath(folder)); } else { lblMsg.Text = "Já existe uma imagem com esse nome!, por favor mude o nome do arquivo e tente novamente"; } } } if (erroRegra != "2" && erroRegra != "1") { diretorio = Server.MapPath(folder); oLancamento.imagemEvidencia = tira_acentos(arq); oOcorrencia.codigoOcorencia = Convert.ToInt32(drpListSubject.SelectedItem.Value); oLancamento.oOcorrencia = oOcorrencia; try { oProprietario.cadastraOcorrencia(oLancamento); dvCadastro.Visible = false; lblMsg.Visible = true; Session["MensagemCadastro"] = true; Response.Redirect("detalheOcorrencia.aspx"); } catch (Exception) { throw; } } } else { lblMsg.Visible = true; lblMsg.Text = "Por favor esolha um assunto!!"; } }
public listaLancamentoOcorrencia populaOcorrencia(System.Data.DataTable dt) { listaLancamentoOcorrencia olist = new listaLancamentoOcorrencia(); foreach (DataRow itemOcorrencia in dt.Rows) { LancamentoOcorrenciaModel oLancamento = new LancamentoOcorrenciaModel(); OcorrenciaModel oOcorrencia = new OcorrenciaModel(); ApartamentoModel Oap = new ApartamentoModel(); if (itemOcorrencia.Table.Columns.Contains("OCORRENCIA")) { oLancamento.codigoOcorrencia = Convert.ToInt32(itemOcorrencia["OCORRENCIA"]); } if (itemOcorrencia.Table.Columns.Contains("DATA_OCORRENCIA")) { oLancamento.dataOcorrencia = Convert.ToDateTime(itemOcorrencia["DATA_OCORRENCIA"]); } if (itemOcorrencia.Table.Columns.Contains("STATUS")) { oLancamento.statusOcorrencia = itemOcorrencia["STATUS"].ToString(); } if (itemOcorrencia.Table.Columns.Contains("DESCRICAO")) { oLancamento.ocorrenciaLancamento = itemOcorrencia["DESCRICAO"].ToString(); } if (itemOcorrencia.Table.Columns.Contains("DATA_FINALIZACAO")) { oLancamento.dataFinalizacao = Convert.ToDateTime(itemOcorrencia["DATA_FINALIZACAO"]); } if (itemOcorrencia.Table.Columns.Contains("DATA_CANCELAMENTO")) { oLancamento.dataCancelamento = Convert.ToDateTime(itemOcorrencia["DATA_CANCELAMENTO"]); } if (itemOcorrencia.Table.Columns.Contains("DescricaoOcorrencia")) { oLancamento.descricaoOcorrencia = itemOcorrencia["DescricaoOcorrencia"].ToString(); } if (itemOcorrencia.Table.Columns.Contains("imagem")) { oLancamento.imagemEvidencia = itemOcorrencia["imagem"].ToString(); } if (itemOcorrencia.Table.Columns.Contains("BLOCO")) { Oap.apartamento = Convert.ToInt32(itemOcorrencia["BLOCO"]); } if (itemOcorrencia.Table.Columns.Contains("AP")) { Oap.bloco = Convert.ToInt32(itemOcorrencia["AP"]); } oLancamento.oAp = Oap; olist.Add(oLancamento); } return(olist); }
void Interfaces.IProprietario.cadastraOcorrencia(LancamentoOcorrenciaModel olacamento) { throw new NotImplementedException(); }