protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { lblTitulo.Text = "Agregar Paciente"; } else { lblTitulo.Text = "Editar Paciente"; ClinicaDataContext db = new ClinicaDataContext(); var temp = (from pac in db.Pacientes where pac.ID_Paciente == Convert.ToInt32(Request.QueryString["id"]) select pac).Single(); if (!IsPostBack) { txtNombre.Text = temp.Nombre; txtApellido.Text = temp.Apellido; txtDNI.Text = temp.Dni.ToString(); txtSexo.Text = temp.Sexo.ToString(); DateTime fecha = (DateTime)temp.FechaNacimiento; txtFecha.Text = fecha.ToString("yyyy-MM-dd"); txtEstadoCivil.Text = temp.EstadoCivil.ToString(); txtDomicilio.Text = temp.Domicilio; txtLocalidad.Text = temp.Localidad; txtTelefono.Text = temp.Telefono; txtOcupacion.Text = temp.Ocupacion; txtEmail.Text = temp.Email; } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { lblTitulo.Text = "Historia Clinica"; } else { lblTitulo.Text = "Historia Clínica"; ClinicaDataContext db = new ClinicaDataContext(); var temp = (from med in db.Pacientes where med.ID_Paciente == Convert.ToInt32(Request.QueryString["id"]) select med).Single(); if (!IsPostBack) { string grupoSanguineo = (temp.HistoriaClinica.GrupoSanguineo).ToString().TrimEnd(); txtGrupoSanguineo.SelectedValue = grupoSanguineo; txtAlergias.Text = temp.HistoriaClinica.Alergias; txtAntecedentes.Text = temp.HistoriaClinica.AntecedentesFamiliares; txtEnfermedades.Text = temp.HistoriaClinica.Enfermedades; } } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { lblTitulo.Text = "Agregar Medico"; tdEspecialidades.Visible = false; } else { lblTitulo.Text = "Editar Medico"; ClinicaDataContext db = new ClinicaDataContext(); var temp = (from med in db.Medicos where med.ID_Medico == Convert.ToInt32(Request.QueryString["id"]) select med).Single(); if (!IsPostBack) { txtNombre.Text = temp.Nombre; txtApellido.Text = temp.Apellido; txtMatricula.Text = temp.Matricula; } } }
protected void btnGuardar_Click(object sender, EventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); var temp = (from pac in db.Pacientes where pac.ID_Paciente == Convert.ToInt32(Request.QueryString["id"]) select pac).Single(); var nuevoPlan = new PacientePlan(); nuevoPlan.ID_Paciente = temp.ID_Paciente; nuevoPlan.Habilitado = true; nuevoPlan.ID_Plan = Convert.ToInt32(ddlPlan.SelectedValue); nuevoPlan.Estado = "Activo"; nuevoPlan.FechaInicio = Convert.ToDateTime(txtFechaInicio.Text); nuevoPlan.FechaFin = Convert.ToDateTime(txtFechaFin.Text); db.PacientePlans.InsertOnSubmit(nuevoPlan); db.SubmitChanges(); grdPlanPaciente.DataBind(); newObraSocial.Visible = false; newPlan.Visible = false; fechaInicio.Visible = false; fechaFin.Visible = false; btnCancelar.Visible = false; btnGuardar.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { lblTitulo.Text = "Agregar Turno"; } else { lblTitulo.Text = "Editar Turno"; ClinicaDataContext db = new ClinicaDataContext(); var temp = (from tur in db.Turnos where tur.ID_Turno == Convert.ToInt32(Request.QueryString["id"]) select tur).Single(); if (!IsPostBack) { //Se cargan los datos en los campos DateTime fecha = (DateTime)temp.FechaHora; txtFechaHora.Text = fecha.ToString(" yyyy-MM-dd HH:mm:ss"); ddlEstado.SelectedValue = temp.Estado; ddlPaciente.SelectedValue = temp.ID_Paciente.ToString(); ddlMedico.SelectedValue = temp.ID_Medico.ToString(); } } }
protected void btnGuardar_Click(object sender, EventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); if (Request.QueryString["id"] == null) { Paciente temp = new Paciente(); temp.HistoriaClinica.GrupoSanguineo = txtGrupoSanguineo.SelectedValue; temp.HistoriaClinica.Alergias = txtAlergias.Text; temp.HistoriaClinica.AntecedentesFamiliares = txtAntecedentes.Text; temp.HistoriaClinica.Enfermedades = txtEnfermedades.Text; db.Pacientes.InsertOnSubmit(temp); db.SubmitChanges(); } else { var temp = (from med in db.Pacientes where med.ID_Paciente == Convert.ToInt32(Request.QueryString["id"]) select med).Single(); temp.HistoriaClinica.GrupoSanguineo = txtGrupoSanguineo.SelectedValue; temp.HistoriaClinica.Alergias = txtAlergias.Text; temp.HistoriaClinica.AntecedentesFamiliares = txtAntecedentes.Text; temp.HistoriaClinica.Enfermedades = txtEnfermedades.Text; db.SubmitChanges(); } Response.Redirect("Pacientes.aspx"); }
protected void historiaClinica_Command(object sender, CommandEventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); var paciente = (from pac in db.Pacientes where pac.ID_Paciente == Convert.ToInt32(e.CommandArgument) select pac).Single(); Response.Redirect("HistoriaClinica.aspx?id=" + paciente.ID_Paciente + "&historia=" + paciente.ID_HistoriaClinica); }
protected void imgDelete_Command(object sender, CommandEventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); int idSeleccionado = Convert.ToInt32(e.CommandArgument.ToString()); var temp = (from pac in db.Pacientes where pac.ID_Paciente == idSeleccionado select pac).Single(); db.Pacientes.DeleteOnSubmit(temp); db.SubmitChanges(); grdPacientes.DataBind(); }
protected void imgDelete_Command(object sender, CommandEventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); int idSeleccionado = Convert.ToInt32(e.CommandArgument.ToString()); var temp = (from med in db.Medicos where med.ID_Medico == idSeleccionado select med).Single(); temp.Habilitado = false; db.SubmitChanges(); grdMedicos.DataBind(); }
protected void imgDelete_Command(object sender, CommandEventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); int idSeleccionado = Convert.ToInt32(e.CommandArgument.ToString()); var temp = (from ob in db.ObraSocials where ob.ID_ObraSocial == idSeleccionado select ob).Single(); db.ObraSocials.DeleteOnSubmit(temp); db.SubmitChanges(); grdObraSocial.DataBind(); }
protected void btnGuardar_Click(object sender, EventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); if (Request.QueryString["id"] == null) { HistoriaClinica hist = new HistoriaClinica(); db.HistoriaClinicas.InsertOnSubmit(hist); hist.Alergias = ""; hist.AntecedentesFamiliares = ""; hist.Enfermedades = ""; hist.GrupoSanguineo = ""; db.SubmitChanges(); Paciente temp = new Paciente(); temp.Nombre = txtNombre.Text; temp.Apellido = txtApellido.Text; temp.Sexo = Char.Parse(txtSexo.Text); temp.Dni = Int32.Parse(txtDNI.Text); temp.FechaNacimiento = Convert.ToDateTime(txtFecha.Text); temp.EstadoCivil = Char.Parse(txtEstadoCivil.Text); temp.Domicilio = txtDomicilio.Text; temp.Localidad = txtLocalidad.Text; temp.Telefono = txtTelefono.Text; temp.Ocupacion = txtOcupacion.Text; temp.Email = txtEmail.Text; db.Pacientes.InsertOnSubmit(temp); temp.ID_HistoriaClinica = hist.ID_HistoriaClinica; db.SubmitChanges(); } else { var temp = (from pac in db.Pacientes where pac.ID_Paciente == Convert.ToInt32(Request.QueryString["id"]) select pac).Single(); temp.Nombre = txtNombre.Text; temp.Apellido = txtApellido.Text; temp.Dni = Int32.Parse(txtDNI.Text); temp.Sexo = Char.Parse(txtSexo.Text); temp.EstadoCivil = Char.Parse(txtEstadoCivil.Text); temp.FechaNacimiento = Convert.ToDateTime(txtFecha.Text); temp.Domicilio = txtDomicilio.Text; temp.Localidad = txtLocalidad.Text; temp.Telefono = txtTelefono.Text; temp.Email = txtEmail.Text; temp.Ocupacion = txtOcupacion.Text; db.SubmitChanges(); } Response.Redirect("Pacientes.aspx"); }
protected void imgDelete_Command(object sender, CommandEventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); int idSeleccionado = Convert.ToInt32(e.CommandArgument.ToString()); //Se guarda la factura seleccionada var temp = (from fact in db.Facturas where fact.ID_Factura == idSeleccionado select fact).Single(); //Se da una baja logica temp.Habilitado = false; db.SubmitChanges(); grdFacturas.DataBind(); }
protected void imgDelete_Command(object sender, CommandEventArgs e) { if (Session["TipoUsuario"].ToString() == "Medico") { Response.Write("<script language='javascript'>alert('No se tiene los permisos necesarios para ejecutar esa accion')</script>"); } else { ClinicaDataContext db = new ClinicaDataContext(); int idSeleccionado = Convert.ToInt32(e.CommandArgument.ToString()); var temp = (from tur in db.Turnos where tur.ID_Turno == idSeleccionado select tur).Single(); db.Turnos.DeleteOnSubmit(temp); db.SubmitChanges(); grdTurnos.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { this.db = new ClinicaDataContext(); //Si se desea agregar una nueva factura, se setean los totales en 0 if (Request.QueryString["id"] == null) { lblTitulo.Text = "Agregar factura"; tdDetalles.Visible = false; if (!IsPostBack) { txtSubTotal.Text = "0"; txtIva.Text = "0"; txtDescuento.Text = "0"; txtTotal.Text = "0"; } } //Sino se cargan los datos de la factura selecionada y sus respectivos detalles else { lblTitulo.Text = "Editar factura"; //Se cargan los datos de la factura seleccionada var temp = (from fac in db.Facturas where fac.ID_Factura == Convert.ToInt32(Request.QueryString["id"]) && fac.Habilitado == true select fac).Single(); if (!IsPostBack) { //Se cargan los datos en los campos ddlPaciente.SelectedValue = temp.ID_Paciente.ToString(); ddlTipo.SelectedValue = temp.Tipo.ToString(); DateTime fecha = (DateTime)temp.Fecha; txtFecha.Text = fecha.ToString("yyyy-MM-dd"); ddlEstado.SelectedValue = temp.Estado; txtSubTotal.Text = temp.SubTotal.ToString(); txtIva.Text = temp.Iva.ToString(); calcularDescuento(Convert.ToInt32(temp.ID_Paciente)); txtTotal.Text = temp.Total.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { newObraSocial.Visible = false; newPlan.Visible = false; fechaInicio.Visible = false; fechaFin.Visible = false; btnCancelar.Visible = false; btnGuardar.Visible = false; ClinicaDataContext db = new ClinicaDataContext(); lblTitulo.Text = "Obra Social del Paciente"; var temp = (from pac in db.Pacientes where pac.ID_Paciente == Convert.ToInt32(Request.QueryString["id"]) select pac).Single(); if (!IsPostBack) { lblPaciente.Text = temp.Apellido + ", " + temp.Nombre; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] == null) { lblTitulo.Text = "Nueva Consulta"; } else { lblTitulo.Text = "Ver Consulta"; ClinicaDataContext db = new ClinicaDataContext(); var consulta = (from pac in db.ConsultaHistoriaClinicas where pac.ID_ConsultaHistoriaClinica == Convert.ToInt32(Request.QueryString["id"]) select pac).Single(); if (!IsPostBack) { txtAltura.Text = consulta.Altura.ToString(); txtPeso.Text = consulta.Peso.ToString(); txtSintomas.Text = consulta.Sintomas; txtDiagnostico.Text = consulta.DiagnosticoPresunto; txtPedidos.Text = consulta.PedidoEstudio; txtDerivaciones.Text = consulta.Derivaciones; txtTratamiento.Text = consulta.Tratamiento; txtReceta.Text = consulta.Receta; DateTime fecha = (DateTime)consulta.ProximoControl; txtControl.Text = fecha.ToString("yyyy-MM-dd"); if (consulta.Alta == 1) { cbAlta.Checked = true; } else { cbAlta.Checked = false; } } } }
protected void btnGuardar_Click(object sender, EventArgs e) { ClinicaDataContext db = new ClinicaDataContext(); if (Request.QueryString["id"] == null) { ConsultaHistoriaClinica temp = new ConsultaHistoriaClinica(); temp.ID_HistoriaClinica = Convert.ToInt32(Request.QueryString["historia"]); temp.Altura = Decimal.Parse(txtAltura.Text); temp.Peso = Decimal.Parse(txtPeso.Text); temp.Sintomas = txtSintomas.Text; temp.DiagnosticoPresunto = txtDiagnostico.Text; temp.PedidoEstudio = txtPedidos.Text; temp.Derivaciones = txtDerivaciones.Text; temp.Tratamiento = txtTratamiento.Text; temp.Receta = txtReceta.Text; temp.ProximoControl = Convert.ToDateTime(txtControl.Text); if (cbAlta.Checked == true) { temp.Alta = 1; } else { temp.Alta = 0; } db.ConsultaHistoriaClinicas.InsertOnSubmit(temp); db.SubmitChanges(); var paciente = (from pac in db.Pacientes where pac.ID_HistoriaClinica == temp.ID_HistoriaClinica select pac).Single(); Response.Redirect("HistoriaClinica.aspx?id=" + paciente.ID_Paciente + "&historia=" + paciente.ID_HistoriaClinica); } else { var consulta = (from med in db.ConsultaHistoriaClinicas where med.ID_ConsultaHistoriaClinica == Convert.ToInt32(Request.QueryString["id"]) select med).Single(); consulta.Altura = Decimal.Parse(txtAltura.Text); consulta.Peso = Decimal.Parse(txtPeso.Text); consulta.Sintomas = txtSintomas.Text; consulta.DiagnosticoPresunto = txtDiagnostico.Text; consulta.PedidoEstudio = txtPedidos.Text; consulta.Derivaciones = txtDerivaciones.Text; consulta.Tratamiento = txtTratamiento.Text; consulta.Receta = txtReceta.Text; consulta.ProximoControl = Convert.ToDateTime(txtControl.Text); if (cbAlta.Checked == true) { consulta.Alta = 1; } else { consulta.Alta = 0; } db.SubmitChanges(); var paciente = (from pac in db.Pacientes where pac.ID_HistoriaClinica == consulta.ID_HistoriaClinica select pac).Single(); Response.Redirect("HistoriaClinica.aspx?id=" + paciente.ID_Paciente + "&historia=" + paciente.ID_HistoriaClinica); } }