private void BuscarMascotaBtn_Click(object sender, EventArgs e) { MascotaDtg.DataSource = null; respuestaconsulta = mascotaService.Consultar(); consultar(); }
private void BuscarMascotaBtn_Click(object sender, EventArgs e) { MascotaDtg.DataSource = null; respuestaconsulta = mascotaService.Consultar(); Total = mascotaService.Totalizar().Cuenta.ToString(); TotalPerros = mascotaService.TotalizarTipo("Perro").Cuenta.ToString(); TotalGatos = mascotaService.TotalizarTipo("Gato").Cuenta.ToString(); TotalLoros = mascotaService.TotalizarTipo("Loro").Cuenta.ToString(); consultar(); }
public ResponseConsultaMascota GetInformacionMascota(int identificadorMascota) { ResponseConsultaMascota response = new ResponseConsultaMascota(); try { using (Pet_Shop_BusinessEntities db = new Pet_Shop_BusinessEntities()) { var resultQuery = (from x in db.Pet join y in db.Race on x.Id_Race equals y.Id join z in db.AnimalType on y.Id_Type_Animal equals z.Id join v in db.Person on x.Id_Person equals v.Id where x.Id == identificadorMascota select new { identificador = x.Id, nombre = x.Pet_Name, tipoAnimal = z.Description, raza = y.Description, fechaNacimiento = x.Day_Birth, nombreP = v.FirstName, apellidoP = v.LastName, telefono = v.Cellphone }).FirstOrDefault(); if (resultQuery != null) { response.mascota = new Mascota(resultQuery.identificador, resultQuery.nombre, resultQuery.tipoAnimal, resultQuery.raza, resultQuery.fechaNacimiento); response.propietario = new Propietario(resultQuery.nombreP, resultQuery.apellidoP, resultQuery.telefono); response.mensaje = new Mensaje("0000", "Consulta exitosa", null); } else { response.mensaje = new Mensaje("0004", "No se encontro informacion asociada al identificador: " + identificadorMascota, null); } } } catch (Exception ex) { response.mensaje = new Mensaje("0005", "Ocurrio un error inesperado durante el proceso, por favor pongase en contacto con el administrador del sistema", ex.Message); } return(response); }