public void Test_CrearResidente() { ResidenteBE nuevoResidente = new ResidenteBE(); nuevoResidente.C_Nombre = "Selena Demi"; nuevoResidente.C_Apellidos = "Gomez Lovato"; nuevoResidente.N_TipoDoc = 1; nuevoResidente.C_NumDocume = "83245901"; nuevoResidente.C_Correo = "*****@*****.**"; nuevoResidente.C_Clave = "StartDance14"; nuevoResidente.D_FecNacimi = new DateTime(1992, 07, 22); int idResidente = client.CrearResidente(nuevoResidente); Assert.AreNotEqual(client.ObtenerResidentePorID(idResidente), null); }
public ValidationException ActualizarResidente(ResidenteBE prmResidente) { vExc = new ValidationException(); try { objDA.ActualizarResidente(prmResidente); vExc.ValidationError = string.Format(resMensajes.msjGuardadoOK, "Residente"); return vExc; } catch (Exception ex) { throw new FaultException<ValidationException> (new ValidationException { ValidationError = string.Format(resMensajes.msjNoRegistrado, "Residente") }, new FaultReason(ex.Message)); } }
public int CrearResidente(ResidenteBE prmResidente) { try { if (ObtenerResidentePorNroDocumento(prmResidente.C_NumDocume) == null) { return objDA.CrearResidente(prmResidente); } else throw new FaultException<ValidationException> (new ValidationException { ValidationError = "Este Número de Documento ya ha sido registrado" }, new FaultReason("Residente Existente")); } catch (Exception ex) { throw new FaultException<ValidationException> (new ValidationException { ValidationError = ex.Message }, new FaultReason("Validation Failed")); } }
public ResidenteBE[] BuscarResidentes(string nombre, string apellidos, string numDocumento) { List<ResidenteBE> Residentes = new List<ResidenteBE>(); ResidenteBE residente = null; DbCommand SearchCommand = null; try { SearchCommand = _db.GetStoredProcCommand("Maestros.USP_GET_RESIDENTE"); _db.AddInParameter(SearchCommand, "@pv_nombre", DbType.String, nombre); _db.AddInParameter(SearchCommand, "@pv_Apellidos", DbType.String, apellidos); _db.AddInParameter(SearchCommand, "@pv_NumDocume", DbType.Int32, numDocumento); using (IDataReader dataReader = _db.ExecuteReader(SearchCommand)) { while (dataReader.Read()) { residente = new ResidenteBE(); residente.N_IdResidente = dataReader.GetInt32(0); residente.C_Nombre = dataReader.GetString(1); residente.C_Apellidos = dataReader.GetString(2); residente.N_TipoDoc = dataReader.GetInt32(3); residente.C_NumDocume = dataReader.GetString(4); residente.D_FecNacimi = dataReader.GetDateTime(5); residente.C_Correo = dataReader.IsDBNull(6) ? "" : dataReader.GetString(6); residente.B_Estado = dataReader.GetBoolean(7); Residentes.Add(residente); } } return Residentes.ToArray(); } catch (Exception ex) { throw ex; } }
public void ActualizarResidente(ResidenteBE prmResidente) { DbCommand updateCommand = null; try { updateCommand = _db.GetStoredProcCommand("Maestros.USP_UPDATE_RESIDENTE"); _db.AddInParameter(updateCommand, "@N_IdResidente", DbType.Int32, prmResidente.N_IdResidente); _db.AddInParameter(updateCommand, "@C_Nombre", DbType.String, prmResidente.C_Nombre); _db.AddInParameter(updateCommand, "@C_Apellidos", DbType.String, prmResidente.C_Apellidos); _db.AddInParameter(updateCommand, "@N_TipoDoc", DbType.Int32, prmResidente.N_TipoDoc); _db.AddInParameter(updateCommand, "@C_NumDocume", DbType.String, prmResidente.C_NumDocume); _db.AddInParameter(updateCommand, "@D_FecNacimi", DbType.DateTime, prmResidente.D_FecNacimi); _db.AddInParameter(updateCommand, "@C_Correo", DbType.String, prmResidente.C_Correo); _db.ExecuteNonQuery(updateCommand); } catch (Exception ex) { throw ex; } }
public ViviendaBE() { objResidente = new ResidenteBE(); }
public VisitanteBE() { O_ResidenteBE = new ResidenteBE(); }
public List<Queja> listarQuejas(string FechaIni, string FechaFin, string C_Tipo) { List<Queja> listarQuejas = new List<Queja>(); objconeccion = new SqlConnection(CadenaConexionSQL); SqlCommand objcomand = new SqlCommand("LISTAR_QuejaS", objconeccion); objcomand.CommandType = CommandType.StoredProcedure; objcomand.Parameters.Add("@FechaIni", SqlDbType.DateTime); objcomand.Parameters["@FechaIni"].Value = FechaIni; objcomand.Parameters.Add("@FechaFin", SqlDbType.DateTime); objcomand.Parameters["@FechaFin"].Value = FechaFin; objcomand.Parameters.Add("@C_Tipo", SqlDbType.VarChar,45); objcomand.Parameters["@C_Tipo"].Value = C_Tipo; objconeccion.Open(); SqlDataReader reader = objcomand.ExecuteReader(); while (reader.Read()) { Queja objQueja = new Queja(); objQueja.N_IdQueja = reader.GetInt32(0); objQueja.N_IdResidente = reader.GetInt32(1); objQueja.C_Tipo = reader.GetString(2); objQueja.C_Motivo = reader.GetString(3); objQueja.D_FecRegistro = reader.GetDateTime(4); objQueja.B_Estado = reader.GetBoolean(5); ResidenteBE objresidente = new ResidenteBE(); objresidente.C_Nombre = reader.GetString(6); objresidente.C_NumDocume = reader.GetString(7); objQueja.Residente = objresidente; objQueja.C_Detalle = reader.GetString(8); objQueja.D_FecQueja = reader.GetString(9); listarQuejas.Add(objQueja); } return listarQuejas; }
public ViviendaBE() { objResidente = new ResidenteBE(); }
private static Architects.Dominio.ResidenteBE GetEntity(ProxyResidente.ResidenteBE dataContract) { Architects.Dominio.ResidenteBE entResidente = new Architects.Dominio.ResidenteBE(); entResidente.N_IdResidente = dataContract.N_IdResidente; entResidente.C_NumDocume = dataContract.C_NumDocume; entResidente.C_Nombre = dataContract.C_Nombre; entResidente.C_Apellidos = dataContract.C_Apellidos; entResidente.D_FecNacimi = dataContract.D_FecNacimi; entResidente.B_Estado = dataContract.B_Estado; entResidente.C_Correo = dataContract.C_Correo; entResidente.C_Clave = dataContract.C_Clave; entResidente.N_TipoDoc = dataContract.N_TipoDoc; return entResidente; }
public ResidenteBE ObtenerResidentePorNroDocumento(string numeroDocumento) { List<ResidenteBE> listaResidentes = null; ResidenteBE result = null; try { listaResidentes = new List<ResidenteBE>(ListarResidentes()); var nres = from l in listaResidentes where l.C_NumDocume == numeroDocumento select l; foreach (var item in nres) { result = new ResidenteBE(); result.N_IdResidente = item.N_IdResidente; result.C_Nombre = item.C_Nombre; result.C_Apellidos = item.C_Apellidos; result.B_Estado = item.B_Estado; result.N_TipoDoc = item.N_TipoDoc; result.C_NumDocume = item.C_NumDocume; result.D_FecNacimi = item.D_FecNacimi; result.C_Correo = item.C_Correo; } return result; } catch (Exception ex) { throw new FaultException<ValidationException> (new ValidationException { ValidationError = ex.Message }, new FaultReason("Validation Failed")); } }
public VisitanteBE() { O_ResidenteBE = new ResidenteBE(); }
public Int32 CrearResidente(ResidenteBE prmResidente) { DbCommand insertCommand = null; try { insertCommand = _db.GetStoredProcCommand("Maestros.USP_INSERT_RESIDENTE"); _db.AddInParameter(insertCommand, "@C_Nombre", DbType.String, prmResidente.C_Nombre); _db.AddInParameter(insertCommand, "@C_Apellidos", DbType.String, prmResidente.C_Apellidos); _db.AddInParameter(insertCommand, "@N_TipoDoc", DbType.Int32, prmResidente.N_TipoDoc); _db.AddInParameter(insertCommand, "@C_NumDocume", DbType.String, prmResidente.C_NumDocume); _db.AddInParameter(insertCommand, "@D_FecNacimi", DbType.DateTime, prmResidente.D_FecNacimi); _db.AddInParameter(insertCommand, "@C_Correo", DbType.String, prmResidente.C_Correo); _db.AddInParameter(insertCommand, "@C_Clave", DbType.String, prmResidente.C_Clave); var result = _db.ExecuteScalar(insertCommand); return Int32.Parse(result.ToString()); } catch (Exception ex) { throw ex; } }
public ResidenteBE[] ListarResidentes() { List<ResidenteBE> Residentes = new List<ResidenteBE>(); ResidenteBE residente = null; try { using (IDataReader dataReader = _db.ExecuteReader("Maestros.USP_LIST_RESIDENTE")) { while (dataReader.Read()) { residente = new ResidenteBE(); residente.N_IdResidente = dataReader.GetInt32(0); residente.C_Nombre = dataReader.GetString(1); residente.C_Apellidos = dataReader.GetString(2); residente.N_TipoDoc = dataReader.GetInt32(3); residente.C_NumDocume = dataReader.GetString(4); residente.D_FecNacimi = dataReader.GetDateTime(5); residente.C_Correo = dataReader.IsDBNull(6) ? "" : dataReader.GetString(6); residente.B_Estado = dataReader.GetBoolean(7); Residentes.Add(residente); } } return Residentes.ToArray(); } catch (Exception ex) { throw ex; } }