private void Calendario(object sender, RoutedEventArgs e) { // muestra un calendario con las horas seleccionadas var reserva = new ReservaHoras(); ventanaagenda ventanaagenda = new ventanaagenda(); ventanaagenda.Show(); ventanaagenda.llenarcalendario(this.calendario.SelectedDate.Value); }
// se agenda la hora private void AgendarHora(object sender, RoutedEventArgs e) { ReservaHoras reserva = new ReservaHoras(); Mascota mascota = new Mascota(); // validaciones if (this.txtRutCliente.Text == string.Empty) { MessageBox.Show("Debe ingresar el rut"); } else { if (validarRut(this.txtRutCliente.Text) == false) { MessageBox.Show("Debes ingresar un Rut valido"); } else { // se pasan los datos y se pasan a la clase cliente.Rut = this.txtRutCliente.Text; mascota.Nombre = cmbnombremascotas.SelectedValue.ToString(); cliente.Mascotas.Add(mascota); reserva.Calendario = this.calendario.SelectedDate.Value; reserva.hora = this.cmbhora.SelectedValue.ToString(); if (TipoAtencion.cirugia.ToString().Equals(cmbtipoatencion.SelectedValue)) { reserva.tipoAtencion = TipoAtencion.cirugia; } if (TipoAtencion.Control.ToString().Equals(cmbtipoatencion.SelectedValue)) { reserva.tipoAtencion = TipoAtencion.Control; } if (TipoAtencion.Especialidad.ToString().Equals(cmbtipoatencion.SelectedValue)) { reserva.tipoAtencion = TipoAtencion.Especialidad; } if (TipoAtencion.urgencia.Equals(cmbtipoatencion.SelectedValue)) { reserva.tipoAtencion = TipoAtencion.urgencia; } reserva.GenerarReserva(cliente.Rut, reserva.tipoAtencion, reserva.Calendario, reserva.hora, mascota.Nombre); MessageBox.Show("Se ha generado la hora para el paciente " + mascota.Nombre + reserva.hora + reserva.Calendario.ToString("yyyy/MM/dd")); } } this.txtRutCliente.Text = string.Empty; this.cmbnombremascotas.Items.Clear(); this.calendario.SelectedDate = DateTime.Now; this.cmbhora.Items.Clear(); }
private void Eliminar(object sender, RoutedEventArgs e) { // elimina la hora del cliente. var client = new Cliente(); var re = new ReservaHoras(); if (this.txtRutClienteeliminar.Text == string.Empty) { MessageBox.Show("Debe ingresar el Rut"); } if (validarRut(this.txtRutClienteeliminar.Text) == false) { MessageBox.Show("Debes ingresar un Rut valido"); } else { client.Rut = this.txtRutClienteeliminar.Text; re.Fecha = this.calendario.SelectedDate.Value; re.hora = this.cmbhoraeliminar.SelectedItem.ToString(); var ids = coneccion.trearidcliente(); string idcliente = string.Empty; for (int i = 0; i < ids.Count; i++) { var linea = ids[i].ToString().Split(';'); if (linea[1].Equals(client.Rut)) { idcliente = linea[0]; } } re.CancelarHora(idcliente, re.Fecha, re.hora); } this.txtRutClienteeliminar.Text = string.Empty; this.cmbhoraeliminar.Items.Clear(); this.cmbhoraeliminar.SelectedIndex = 0; this.calendario.SelectedDate = DateTime.Now; }