private void butEliminar_Click(object sender, RoutedEventArgs e)
        {
            switch (mostrando)
            {
            case 1:
                //medico
                break;

            case 2:
                //paciente
                break;

            case 3:
                TurnosPorPaciente seleccion = (TurnosPorPaciente)lista.SelectedItem;
                if (seleccion.Atendido)
                {
                    MessageBox.Show("Este turno no puede ser eliminado porque ya fue atendido.");
                    return;
                }

                MessageBoxResult messageBoxResult = MessageBox.Show("¿Esta seguro que desea eliminar el turno" +
                                                                    " del paciente " + seleccion.NombrePaciente + " con el medico " + seleccion.NombreMedico +
                                                                    " del dia " + seleccion.FechaString + "?",
                                                                    "Confirmacion de borrado", MessageBoxButton.YesNo);
                if (messageBoxResult == MessageBoxResult.Yes)
                {
                    EliminarTurno(seleccion.IdTurno);
                }
                break;

            case 4:
                //pago
                break;
            }
        }
        private void butEdit_Click(object sender, RoutedEventArgs e)
        {
            switch (mostrando)
            {
            case 1:
                editarPaciente();
                break;

            case 2:
                editarPaciente();
                break;

            case 3:
                TurnosPorPaciente seleccion = (TurnosPorPaciente)lista.SelectedItem;
                if (seleccion.Atendido)
                {
                    MessageBox.Show("Este turno no puede ser editado porque ya fue atendido.");
                    return;
                }
                editarTurno(seleccion.IdTurno);
                break;

            case 4:
                editarPaciente();
                break;
            }
        }
Example #3
0
        private void Button_Pago_Click(object sender, RoutedEventArgs e)
        {
            TurnosPorPaciente seleccion = (TurnosPorPaciente)TurnosGrid.SelectedItem;

            if (seleccion == null)
            {
                MessageBox.Show("Debe seleccionar un turno.");
                return;
            }

            CrearPago crearPago = new CrearPago(seleccion.IdTurno, seleccion.NombreMedico, seleccion.NombrePaciente, seleccion.IdPaciente);

            Layout.Frame.Navigate(crearPago);
        }
Example #4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            TurnosPorPaciente seleccion = (TurnosPorPaciente)TurnosGrid.SelectedItem;

            if (seleccion == null)
            {
                MessageBox.Show("Seleccione un Turno");
                return;
            }

            if (seleccion.Atendido)
            {
                MessageBox.Show("Este turno no puede ser editado porque ya fue atendido.");
                return;
            }
            editarTurno(seleccion.IdTurno);
        }
Example #5
0
        private void butBuscar_Click(object sender, RoutedEventArgs e)
        {
            DateTime?fechaDesde = null;
            DateTime?fechaHasta = null;
            int?     idMedico   = null;
            int?     idPaciente = null;
            double   totalWidth = 0;
            string   nombre     = string.Empty;
            string   apellido   = string.Empty;

            switch (mostrando)
            {
            case 1:
                nombre   = busqNombreBox.Text == string.Empty ? null : busqNombreBox.Text;
                apellido = busqApellidoBox.Text == string.Empty ? null : busqApellidoBox.Text;

                List <dynamic> medicosDynamicList = GetLista("Medico", nombre: nombre, apellido: apellido);

                List <ConsultorioSagradaFamilia.Models.Medico> medicos = new List <ConsultorioSagradaFamilia.Models.Medico>();

                foreach (var medicoDynamic in medicosDynamicList)
                {
                    ConsultorioSagradaFamilia.Models.Medico medico = new ConsultorioSagradaFamilia.Models.Medico
                    {
                        Apellido  = medicoDynamic.Apellido,
                        DNI       = medicoDynamic.DNI,
                        CUIL      = medicoDynamic.CUIL,
                        IdMedico  = medicoDynamic.IdMedico,
                        Matricula = medicoDynamic.Matricula,
                        Monto     = medicoDynamic.Monto,
                        Nombre    = medicoDynamic.Nombre
                    };

                    medicos.Add(medico);
                }

                lista.IsReadOnly    = true;
                lista.SelectionMode = DataGridSelectionMode.Single;

                totalWidth                  = lista.ActualWidth;
                lista.ItemsSource           = medicos;
                lista.Columns[1].Width      = totalWidth / 5;
                lista.Columns[4].Width      = totalWidth / 5;
                lista.Columns[5].Width      = totalWidth / 5;
                lista.Columns[6].Width      = totalWidth / 5;
                lista.Columns[7].Width      = totalWidth / 5;
                lista.Columns[0].Visibility = Visibility.Collapsed;
                lista.Columns[2].Visibility = Visibility.Collapsed;
                lista.Columns[3].Visibility = Visibility.Collapsed;
                lista.Columns[4].Header     = "Apellido y Nombre";
                break;

            case 2:
                nombre   = busqNombreBox.Text == string.Empty ? null : busqNombreBox.Text;
                apellido = busqApellidoBox.Text == string.Empty ? null : busqApellidoBox.Text;

                List <dynamic> pacientesDynamicList = GetLista("Paciente", nombre: nombre, apellido: apellido);

                List <Paciente> pacientes = new List <Paciente>();

                foreach (var pacienteDynamic in pacientesDynamicList)
                {
                    Paciente paciente = new Paciente
                    {
                        Apellido        = pacienteDynamic.Apellido,
                        DNI             = pacienteDynamic.DNI,
                        IdPaciente      = pacienteDynamic.IdPaciente,
                        Nombre          = pacienteDynamic.Nombre,
                        Direccion       = pacienteDynamic.Direccion,
                        FechaNacimiento = pacienteDynamic.FechaNacimiento
                    };

                    pacientes.Add(paciente);
                }

                lista.IsReadOnly    = true;
                lista.SelectionMode = DataGridSelectionMode.Single;

                totalWidth                  = lista.ActualWidth;
                lista.ItemsSource           = pacientes;
                lista.Columns[1].Width      = totalWidth / 4;
                lista.Columns[4].Width      = totalWidth / 4;
                lista.Columns[6].Width      = totalWidth / 4;
                lista.Columns[7].Width      = totalWidth / 4;
                lista.Columns[0].Visibility = Visibility.Collapsed;
                lista.Columns[5].Visibility = Visibility.Collapsed;
                lista.Columns[2].Visibility = Visibility.Collapsed;
                lista.Columns[3].Visibility = Visibility.Collapsed;
                lista.Columns[4].Header     = "Apellido y Nombre";
                lista.Columns[7].Header     = "Fecha de Nacimiento";
                break;

            case 3:

                if (dateBusqDesde.SelectedDate != null)
                {
                    fechaDesde = dateBusqDesde.SelectedDate;
                }
                if (dateBusqHasta.SelectedDate != null)
                {
                    fechaHasta = dateBusqHasta.SelectedDate;
                }
                if (combBuscMedico.SelectedValue != null)
                {
                    idMedico = (int)combBuscMedico.SelectedValue;
                    if (idMedico == 0)
                    {
                        idMedico = null;
                    }
                }
                if (combBuscPaciente.SelectedValue != null)
                {
                    idPaciente = (int)combBuscPaciente.SelectedValue;
                    if (idPaciente == 0)
                    {
                        idPaciente = null;
                    }
                }

                List <dynamic> turnosDynamicList = GetLista("TurnosPorPaciente", "idMedico", idMedico, "idPaciente",
                                                            idPaciente, fechaDesde, fechaHasta);

                List <TurnosPorPaciente> turnos = new List <TurnosPorPaciente>();

                foreach (var turnodynamic in turnosDynamicList)
                {
                    string[] fechaSplit = turnodynamic.FechaString.ToString().Split('-');
                    string   fechaReal  = fechaSplit[2] + "/" + fechaSplit[1] + "/" + fechaSplit[0];

                    string[] horaSplit  = turnodynamic.HoraString.ToString().Split('.');
                    string[] horaSplit2 = horaSplit[0].ToString().Split(':');
                    string   horaReal   = horaSplit2[0] + ":" + horaSplit2[1];

                    TurnosPorPaciente turno = new TurnosPorPaciente
                    {
                        CUILMedico      = turnodynamic.CUILMedico,
                        DNIMedico       = turnodynamic.DNIMedico,
                        Fecha           = turnodynamic.Fecha,
                        FechaString     = fechaReal,
                        HoraString      = horaReal != "00:00" ? horaReal : "En espera",
                        IdMedico        = turnodynamic.IdMedico,
                        IdPaciente      = turnodynamic.IdPaciente,
                        MatriculaMedico = turnodynamic.MatriculaMedico,
                        NombreMedico    = turnodynamic.NombreMedico,
                        NombrePaciente  = turnodynamic.NombrePaciente,
                        Atendido        = turnodynamic.Atendido,
                        IdTurno         = turnodynamic.IdTurno
                    };

                    turnos.Add(turno);
                }

                lista.IsReadOnly    = true;
                lista.SelectionMode = DataGridSelectionMode.Single;

                totalWidth                   = lista.ActualWidth;
                lista.ItemsSource            = turnos;
                lista.Columns[1].Width       = totalWidth / 5;
                lista.Columns[4].Width       = totalWidth / 5;
                lista.Columns[8].Width       = totalWidth / 5;
                lista.Columns[9].Width       = totalWidth / 5;
                lista.Columns[11].Width      = totalWidth / 5;
                lista.Columns[1].Header      = "Paciente";
                lista.Columns[4].Header      = "Médico";
                lista.Columns[8].Header      = "Fecha";
                lista.Columns[9].Header      = "Hora";
                lista.Columns[11].Header     = "Atendido";
                lista.Columns[0].Visibility  = Visibility.Collapsed;
                lista.Columns[2].Visibility  = Visibility.Collapsed;
                lista.Columns[3].Visibility  = Visibility.Collapsed;
                lista.Columns[5].Visibility  = Visibility.Collapsed;
                lista.Columns[6].Visibility  = Visibility.Collapsed;
                lista.Columns[7].Visibility  = Visibility.Collapsed;
                lista.Columns[10].Visibility = Visibility.Collapsed;

                break;

            case 4:

                if (dateBusqDesde.SelectedDate != null)
                {
                    fechaDesde = dateBusqDesde.SelectedDate;
                }
                if (dateBusqHasta.SelectedDate != null)
                {
                    fechaHasta = dateBusqHasta.SelectedDate;
                }
                if (combBuscMedico.SelectedValue != null)
                {
                    idMedico = (int)combBuscMedico.SelectedValue;
                    if (idMedico == 0)
                    {
                        idMedico = null;
                    }
                }
                if (combBuscPaciente.SelectedValue != null)
                {
                    idPaciente = (int)combBuscPaciente.SelectedValue;
                    if (idPaciente == 0)
                    {
                        idPaciente = null;
                    }
                }

                List <dynamic> pagosDynamicList = GetLista("PagosPorFormaPago", "idMedico", idMedico, "idPaciente",
                                                           idPaciente, fechaDesde, fechaHasta);

                List <PagosPorFormaPago> pagos = new List <PagosPorFormaPago>();

                foreach (var pagoDynamic in pagosDynamicList)
                {
                    PagosPorFormaPago pago = new PagosPorFormaPago
                    {
                        FormaPago        = pagoDynamic.FormaPago,
                        IdFormaPago      = pagoDynamic.IdFormaPago,
                        IdObraSocial     = pagoDynamic.IdObraSocial,
                        Monto            = pagoDynamic.Monto,
                        NombreObraSocial = pagoDynamic.NombreObraSocial,
                        Fecha            = pagoDynamic.Fecha,
                        IdMedico         = pagoDynamic.IdMedico,
                        IdPaciente       = pagoDynamic.IdPaciente,
                        NombreMedico     = pagoDynamic.NombreMedico,
                        NombrePaciente   = pagoDynamic.NombrePaciente
                    };

                    pagos.Add(pago);
                }

                lista.IsReadOnly    = true;
                lista.SelectionMode = DataGridSelectionMode.Single;

                totalWidth        = lista.ActualWidth;
                lista.ItemsSource = pagos;

                lista.Columns[0].Header     = "Fecha";
                lista.Columns[0].Width      = totalWidth / 5;
                lista.Columns[1].Width      = totalWidth / 5;
                lista.Columns[3].Visibility = Visibility.Collapsed;

                lista.Columns[4].Header = "Médico";
                lista.Columns[4].Width  = totalWidth / 5;
                lista.Columns[5].Header = "Paciente";
                lista.Columns[5].Width  = totalWidth / 5;

                lista.Columns[6].Visibility = Visibility.Collapsed;
                lista.Columns[7].Visibility = Visibility.Collapsed;

                lista.Columns[8].Header = "Obra Social";
                lista.Columns[8].Width  = totalWidth / 5;

                lista.Columns[9].Visibility  = Visibility.Collapsed;
                lista.Columns[10].Visibility = Visibility.Collapsed;

                break;
            }
        }