protected void btnGuardar_Click(object sender, EventArgs e) { DetalleHistoriaDAO detalleHistoriaDAO = new DetalleHistoriaDAO(); Detalle_historia detalle_HistoriaDTO = new Detalle_historia(); detalle_HistoriaDTO.ID_mascota = int.Parse(Session["idMascotaEscogidaDoctor"].ToString()); detalle_HistoriaDTO.Nombre_doctor = txtNombreDoctor.Text; detalle_HistoriaDTO.Motivo_consulta = txtMotivo.Text; detalle_HistoriaDTO.Descripcion_caso = txtDescripcion.Text; detalle_HistoriaDTO.Antecedentes = txtAntecedentes.Text; detalle_HistoriaDTO.Valoracion_resultado = txtValoracion.Text; detalle_HistoriaDTO.Prescripcion_medica = txtPrescripcion.Text; detalle_HistoriaDTO.Fecha_consulta_medica = clFechaConsulta.SelectedDate; detalle_HistoriaDTO.Fecha_proxima_consulta = clProximaConsulta.SelectedDate; var registrar = detalleHistoriaDAO.RegistrarDetalle(detalle_HistoriaDTO); if (registrar == true) { ClientScript.RegisterStartupScript(this.GetType(), "alarm", "create_success_detail_modal()", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "alarm", "create_fail_detail_modal()", true); } }
public string RegistrarDetalle(Detalle_historia detalle) { try { bd.Detalle_historia.InsertOnSubmit(detalle); bd.SubmitChanges(); return("Se registro la informacion correctamente"); } catch (Exception ex) { return("No se pudieron guardar los cambios" + ex.Message); } }
public bool RegistrarDetalle(Detalle_historia detalle) { try { bd.Detalle_historia.InsertOnSubmit(detalle); bd.SubmitChanges(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MascotaDAO mascotaDAO = new MascotaDAO(); Mascotas mascotaDTO = mascotaDAO.ConsultaPorId(int.Parse(Session["idMascotaEscogidaDoctor"].ToString())); lblNombreMascota.Text = mascotaDTO.Nombre; lblRaza.Text = mascotaDTO.Raza; if (mascotaDTO.Especie == "Perro") { imgFotoMascota.ImageUrl = "~/Images/Perro_Perfil.jpg"; } else if (mascotaDTO.Especie == "Gato") { imgFotoMascota.ImageUrl = "~/Images/Perfil_gato.jpg"; } else if (mascotaDTO.Especie == "Hamster") { imgFotoMascota.ImageUrl = "~/Images/Raton_Perfil.jpg"; } else { imgFotoMascota.ImageUrl = "~/Images/Perfil_Otras mascotas.jpg"; } DetalleHistoriaDAO detalleHistoriaDAO = new DetalleHistoriaDAO(); Detalle_historia detalle_HistoriaDTO = detalleHistoriaDAO.ConsultarDetalle(int.Parse(Session["idDetalleHistoriaSelect"].ToString())); lblNombreDoctor.Text = detalle_HistoriaDTO.Nombre_doctor; lblMotivoConsulta.Text = detalle_HistoriaDTO.Motivo_consulta; lblDescripcionCaso.Text = detalle_HistoriaDTO.Descripcion_caso; lblAntecedentes.Text = detalle_HistoriaDTO.Antecedentes; lblValoracion.Text = detalle_HistoriaDTO.Valoracion_resultado; lblPrescripcion.Text = detalle_HistoriaDTO.Prescripcion_medica; lblFechaConsulta.Text = detalle_HistoriaDTO.Fecha_consulta_medica.ToShortDateString(); lblProximaConsulta.Text = detalle_HistoriaDTO.Fecha_proxima_consulta.ToString(); } }
public List <Detalle_historia> ConsultaDetallesIdMascota(int idMascota) { List <Detalle_historia> detalle_Historias = new List <Detalle_historia>(); var consultaDetalle = (from d in bd.Detalle_historia where d.ID_mascota == idMascota select d); foreach (var item in consultaDetalle) { Detalle_historia detalle = new Detalle_historia(); detalle.ID_detalle_historia = item.ID_detalle_historia; detalle.ID_mascota = item.ID_mascota; detalle.Nombre_doctor = item.Nombre_doctor; detalle.Motivo_consulta = item.Motivo_consulta; detalle.Descripcion_caso = item.Descripcion_caso; detalle.Antecedentes = item.Antecedentes; detalle.Valoracion_resultado = item.Valoracion_resultado; detalle.Prescripcion_medica = item.Prescripcion_medica; detalle.Fecha_consulta_medica = item.Fecha_consulta_medica; detalle.Fecha_proxima_consulta = item.Fecha_proxima_consulta; detalle_Historias.Add(detalle); } return(detalle_Historias); }