public byte[] ObterImagem(Entity.Pessoa Pessoa) { string connectionString = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString; Entity.Pessoa objPessoaEntity = new Entity.Pessoa(); SqlConnection con = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand("SEL_Imagem", con); cmd.Parameters.AddWithValue("@cvIdPessoa", Pessoa.cvIdPessoa); con.Open(); SqlDataReader myReader = cmd.ExecuteReader(); if (myReader.Read()) { objPessoaEntity.ccImage = (byte[])myReader["ImgComprovResid"]; } myReader.Close(); con.Close(); return(objPessoaEntity.ccImage); }
public static string CarregarDados(int idPessoa) { JavaScriptSerializer objSerializer = new JavaScriptSerializer(); System.Data.DataTable dt = new System.Data.DataTable(); BLL.Pessoa objPessoaBLL = new BLL.Pessoa(); Entity.Pessoa objPessoaEntity = new Entity.Pessoa(); objPessoaEntity.cvIdPessoa = idPessoa; dt = objPessoaBLL.Obter(objPessoaEntity); List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >(); Dictionary <string, object> row = null; foreach (DataRow dr in dt.Rows) { row = new Dictionary <string, object>(); foreach (DataColumn col in dt.Columns) { row.Add(col.ColumnName, dr[col]); } rows.Add(row); } return(objSerializer.Serialize(rows)); }
public static int Salvar(Entity.Pessoa Pessoa) { System.Data.DataTable dt = new System.Data.DataTable(); Entity.Pessoa objCriarContaEntity = new Entity.Pessoa(); BLL.Pessoa objCriarContaBLL = new BLL.Pessoa(); try { if (Pessoa.ccNascimento != "") { Pessoa.cdNascimento = Convert.ToDateTime(Pessoa.ccNascimento); } objCriarContaEntity = Pessoa; if (Pessoa.cvIdPessoa != 0 && Pessoa.cvIdPessoa != null) { objCriarContaBLL.Atualizar(objCriarContaEntity); } else { objCriarContaBLL.Criar(objCriarContaEntity); } return(objCriarContaEntity.cvIdPessoa); } catch (Exception ex) { return(0); } }
public void AtualizarAnexo(Entity.Pessoa Pessoa) { string connectionString = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand("UPD_PessoaAnexo", con); cmd.Parameters.AddWithValue("@cvIdPessoa", Pessoa.cvIdPessoa); cmd.Parameters.AddWithValue("@ccImage", Pessoa.ccImage); cmd.CommandType = CommandType.StoredProcedure; con.Open(); try { cmd.ExecuteNonQuery(); } catch (Exception ex) { Pessoa.ccRet = 'N'; } finally { con.Close(); } }
public Entity.Pessoa Command() { var pessoa = new Entity.Pessoa { Nome = Nome, //PessoaTipo = new Entity.PessoaTipo { PessoaTipoId = (Common.PessoaTipoEnum)PessoaTipoId }, Ativo = true }; if (PessoaDocumentos.Count > 0) { pessoa.PessoaDocumentos = PessoaDocumentos.Select(x => new Entity.PessoaDocumento { PessoaDocumentoId = x.PessoaDocumentoTipoId, Valor = x.Valor }).ToList(); } if (PessoaContatos.Count > 0) { pessoa.PessoaContatos = PessoaContatos.Select(x => new Entity.PessoaContato { PessoaContatoId = x.PessoaContatoTipoId, Valor = x.Valor }).ToList(); } if (PessoaEnderecos.Count > 0) { pessoa.PessoaEnderecos = PessoaEnderecos.Select(x => new Entity.PessoaEndereco { Cep = x.Cep, Cidade = x.Cidade, Estado = x.Estado, Bairro = x.Bairro, Logradouro = x.Logradouro, Numero = x.Numero, Complemento = x.Complemento, Principal = x.Principal }).ToList(); } return(pessoa); }
public byte[] ObterImagem(Entity.Pessoa Pessoa) { try { DAL.Pessoa PessoaDAL = new DAL.Pessoa(); return(PessoaDAL.ObterImagem(Pessoa)); } catch (Exception ex) { throw ex; } }
public DataTable Obter(Entity.Pessoa Pessoa) { try { DAL.Pessoa PessoaDAL = new DAL.Pessoa(); return(PessoaDAL.Obter(Pessoa)); } catch (Exception ex) { throw ex; } }
public void Excluir(Entity.Pessoa Pessoa) { try { DAL.Pessoa PessoaDAL = new DAL.Pessoa(); PessoaDAL.Excluir(Pessoa); } catch (Exception ex) { throw ex; } }
public void AtualizarAnexo(Entity.Pessoa Pessoa) { try { DAL.Pessoa PessoaDAL = new DAL.Pessoa(); PessoaDAL.AtualizarAnexo(Pessoa); } catch (Exception ex) { throw ex; } }
public static int Excluir(int cvIdPessoa) { Entity.Pessoa objCriarContaEntity = new Entity.Pessoa(); BLL.Pessoa objCriarContaBLL = new BLL.Pessoa(); try { objCriarContaEntity.cvIdPessoa = cvIdPessoa; objCriarContaBLL.Excluir(objCriarContaEntity); return(1); } catch (Exception ex) { return(0); } }
public DataTable Obter(Entity.Pessoa Pessoa) { string connectionString = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); SqlDataAdapter da = new SqlDataAdapter("SEL_PESSOA", con); if (Pessoa.cvIdPessoa != 0) { da.SelectCommand.Parameters.AddWithValue("@cvIdPessoa", Pessoa.cvIdPessoa); } da.SelectCommand.CommandType = CommandType.StoredProcedure; DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
public void Atualizar(Entity.Pessoa Pessoa) { string connectionString = ConfigurationManager.ConnectionStrings["SQLConnection"].ConnectionString; SqlConnection con = new SqlConnection(connectionString); SqlCommand cmd = new SqlCommand("UPD_Pessoa", con); cmd.Parameters.AddWithValue("@cvIdPessoa", Pessoa.cvIdPessoa); cmd.Parameters.AddWithValue("@ccNome", Pessoa.ccNome); cmd.Parameters.AddWithValue("@ccEndereco", Pessoa.ccEndereco); cmd.Parameters.AddWithValue("@ccCidade", Pessoa.ccCidade); cmd.Parameters.AddWithValue("@ccCEP", Pessoa.ccCEP); cmd.Parameters.AddWithValue("@ccTelefoneCelular", Pessoa.ccTelefoneCelular); cmd.Parameters.AddWithValue("@ccTelefoneComercial", Pessoa.ccTelefoneComercial); cmd.Parameters.AddWithValue("@ccRG", Pessoa.ccRG); cmd.Parameters.AddWithValue("@ccCPF", Pessoa.ccCPF); cmd.Parameters.AddWithValue("@ccTelefoneResidencial", Pessoa.ccTelefoneResidencial); cmd.Parameters.AddWithValue("@ccUF", Pessoa.ccUF); cmd.Parameters.AddWithValue("@ccEmail", Pessoa.ccEmail); cmd.Parameters.AddWithValue("@cdNascimento", Pessoa.cdNascimento); cmd.Parameters.AddWithValue("@ccImage", Pessoa.ccImage); cmd.Parameters.Add("@NewId", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.CommandType = CommandType.StoredProcedure; con.Open(); try { cmd.ExecuteNonQuery(); Pessoa.cvIdPessoa = Convert.ToInt32(cmd.Parameters["@NewId"].Value); } catch (Exception ex) { Pessoa.ccRet = 'N'; } finally { con.Close(); } }
public void ProcessRequest(HttpContext context) { foreach (string file in context.Request.Files) { HttpPostedFile hpf = context.Request.Files[file]; String idPessoa = context.Request.QueryString["idPessoa"]; string savedFileName = Path.Combine(context.Server.MapPath("~/App_Data"), Path.GetFileName(hpf.FileName)); byte[] imageBytes = new byte[hpf.InputStream.Length + 1]; hpf.InputStream.Read(imageBytes, 0, imageBytes.Length); Entity.Pessoa objPessoaEntity = new Entity.Pessoa(); BLL.Pessoa objPessoaBLL = new BLL.Pessoa(); objPessoaEntity.ccImage = imageBytes; objPessoaEntity.cvIdPessoa = Convert.ToInt32(idPessoa); objPessoaBLL.AtualizarAnexo(objPessoaEntity); } }