Exemplo n.º 1
0
        public Appointment Find(int id)
        {
            Appointment result = default(Appointment);
            var         dac    = new AppointmentDAC();

            result = dac.ReadBy(id);
            return(result);
        }
Exemplo n.º 2
0
        public List <Appointment> ToList()
        {
            List <Appointment> result = default(List <Appointment>);

            var dac = new AppointmentDAC();

            result = dac.Read();
            return(result);
        }
Exemplo n.º 3
0
        public Appointment Add(Appointment appointment)
        {
            var dac = new AppointmentDAC();

            Dictionary <string, string> filters = new Dictionary <string, string>();

            filters.Add("MedicoId", appointment.DoctorId.ToString());
            filters.Add("Fecha", appointment.Date.ToString());

            List <Appointment> appointments = null;

            var data = dac.ReadyByFilters(filters);

            if (data != null && data.Count > 0)
            {
                appointments = new List <Appointment>();
                appointments.AddRange(data);
            }

            filters.Clear();
            filters.Add("PacienteId", appointment.PatientId.ToString());
            filters.Add("Fecha", appointment.Date.ToString());

            data = dac.ReadyByFilters(filters);
            if (data != null && data.Count > 0)
            {
                appointments = new List <Appointment>();
                appointments.AddRange(data);
            }

            if (appointments != null && appointments.Count > 0)
            {
                //Puede pasar una de dos, o que el doctor asignado tenga un turno para esa fecha y hora
                //O que lo tenga el paciente
                return(appointment);
            }

            Appointment result = default(Appointment);

            result = dac.Create(appointment);
            return(result);
        }
Exemplo n.º 4
0
        public void Delete(Appointment app)
        {
            var dac = new AppointmentDAC();

            dac.LogicDelete(app);
        }
Exemplo n.º 5
0
        public void Update(Appointment appointment)
        {
            var dac = new AppointmentDAC();

            dac.Update(appointment);
        }