protected void btnBuscarTurno_Click(object sender, EventArgs e) { try { COD = (int)(gdvEspecialista.SelectedDataKey.Value); EmpleadoEntidad emp = EmpleadoDao.ObtenerPorID(COD); DateTime horaInicio = emp.HoraIngreso; DateTime horario = DateTime.Parse((emp.HoraEgreso - emp.HoraIngreso).ToString()); int horas = int.Parse(horario.Hour.ToString()); List <HoraEntidad> HorarioCompleto = GenerarHorarios(horas, horaInicio); List <TurnoEntidad> TurnosOcupados = TurnoDao.TurnosPorFechaPorEspecialista((DateTime.Parse(txtFecha.Text)), ((int)gdvEspecialista.SelectedDataKey.Value)); if (TurnosOcupados != null) { if (TurnosOcupados.Count != 0) { HorarioCompleto = RestarTurnosOcupados(HorarioCompleto, TurnosOcupados); } } CargarTurnosDisponibles(HorarioCompleto); GrillaHoras.Visible = true; } catch (Exception ex) { divResultado.Visible = true; txtResultado.Text = "Ha ocurrido el siguiente error: " + ex.Message; } }
private void btnConfirmar_Click(object sender, EventArgs e) { TurnoDao turno = new TurnoDao(); turno.ConfirmarLlegadaPaciente(this._idTurno); this.Dispose(); }
private void Form3_Load(object sender, EventArgs e) { dgvTurno.MultiSelect = false; idsUsuario = new List <int>(); idsTurnos = new List <int>(); TurnoDao dao = new TurnoDao(); List <TurnoYUsuario> turnos = dao.turnosDeHoy(idProfesional); for (int i = 0; i < turnos.Count; i++) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell fecha = new DataGridViewTextBoxCell(); fecha.Value = turnos[i].FechaTurno; DataGridViewCell afiliado = new DataGridViewTextBoxCell(); afiliado.Value = turnos[i].Nombre + " " + turnos[i].Apellido; idsUsuario.Add(turnos[i].idUsuario); idsTurnos.Add(turnos[i].IdTurno); row.Cells.Add(fecha); row.Cells.Add(afiliado); dgvTurno.Rows.Add(row); } }
protected void btnReservar_Click(object sender, EventArgs e) { if (!ValidarPaciente(int.Parse(txtPaciente.Text))) { divResultado.Visible = true; txtResultado.Text = "El Numero de Documento ingresado no corresponde a un Paciente registrado."; return; } int? idPaciente = (PacienteDao.ObtenerPorNroDoc(int.Parse(txtPaciente.Text))).Id; DateTime fechaValidacion = DateTime.Parse(txtFecha.Text); if (ValidarSuperposicion(fechaValidacion, idPaciente, txtHora.Text)) { divResultado.Visible = true; txtResultado.Text = "El Paciente ya tiene un turno asignado en esa fecha para ese horario."; return; } TurnoEntidad TurnoGuardar = new TurnoEntidad(); TurnoGuardar.idPaciente = PacienteDao.ObtenerPorNroDoc(int.Parse(txtPaciente.Text)).Id; TurnoGuardar.fecha = txtFecha.Text; TurnoGuardar.hora = txtHora.Text; TurnoGuardar.codEmpleado = (int)gdvEspecialista.SelectedDataKey.Value; TurnoDao.Insertar(TurnoGuardar); Limpiar(); }
private void CargarTurnosDelDia(int idDoctor) { TurnoDao dao = new TurnoDao(); List <TurnoYUsuario> listaTurnos = dao.GetTurnos(idDoctor); for (int i = 0; i < listaTurnos.Count; i++) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell horaTurno = new DataGridViewTextBoxCell(); horaTurno.Value = listaTurnos[i].GetHora(); DataGridViewCell nombre = new DataGridViewTextBoxCell(); nombre.Value = listaTurnos[i].Nombre; DataGridViewCell apellido = new DataGridViewTextBoxCell(); apellido.Value = listaTurnos[i].Apellido; DataGridViewCell idTurno = new DataGridViewTextBoxCell(); idTurno.Value = listaTurnos[i].IdTurno; DataGridViewButtonCell boton1 = new DataGridViewButtonCell(); boton1.Value = "Confirmar"; DataGridViewButtonCell boton2 = new DataGridViewButtonCell(); boton2.Value = "Diagnosticar"; row.Cells.Add(horaTurno); row.Cells.Add(nombre); row.Cells.Add(apellido); row.Cells.Add(boton1); row.Cells.Add(boton2); row.Cells.Add(idTurno); grdResultado.Rows.Add(row); } }
private void cargarAños() { TurnoDao turno = new TurnoDao(); List <int> añosAMostrar = turno.añosConTurnos(); añosAMostrar.ForEach(año => this.cboAño.Items.Add(año)); }
protected bool ValidarSuperposicion(DateTime fecha, int?idPaciente, string hora) { List <TurnoEntidad> TurnosPaciente = TurnoDao.TurnosPorFechaPorPaciente(fecha, idPaciente); foreach (TurnoEntidad turno in TurnosPaciente) { if (String.Compare(hora, turno.hora) == 0) { return(true); } } return(false); }
protected void btnGuardar_Click(object sender, EventArgs e) { if (!Page.IsValid) { return; } try { if (!ValidarCombo()) { return; } IntervencionEntidad intervencion = new IntervencionEntidad(); intervencion.IdPaciente = IDPACIENTE; DateTime fecha; if (DateTime.TryParse(txtFecha.Text, out fecha)) { intervencion.Fecha = fecha; } DateTime hora; if (DateTime.TryParse(txtHora.Text, out hora)) { intervencion.Hora = hora; } intervencion.CodTratamiento = cboTratamiento.SelectedIndex; intervencion.MontoTotal = CalcularTotal(); intervencion.Observaciones = txtObservaciones.Text; intervencion.Condicion = 1; //Pendiente IntervencionDao.Insertar(intervencion, ListaInsumosxIntervencion); COD = intervencion.CodIntervencion.Value; TurnoDao.ModificarAsignacion(IDPACIENTE, fecha, hora); RestarInsumos(); Limpiar(); GrillaTurnos.Visible = false; cboInsumos.Items.Clear(); CargarInsumos(); } catch (Exception ex) { divResultado.Visible = true; txtResultado.Text = "Ha ocurrido el siguiente error: " + ex.Message; } }
protected void CargarTurnos() { gdvTurnos.DataSource = TurnoDao.ObtenerTurnos(txtBusquedaNombre.Text, txtBusquedaApellido.Text); gdvTurnos.DataKeyNames = new string[] { "idPaciente" }; gdvTurnos.DataBind(); }