public IEnumerable <AppointmentDTO> GetQueue(string ap_dept)
        {
            using (MyContext ctx = new MyContext())
            {
                var pp = ctx.Appointments.AsNoTracking().Where(e => e.ap_dept == ap_dept);
                List <AppointmentDTO> list = new List <AppointmentDTO>();
                foreach (var p in pp)
                {
                    AppointmentDTO pdto = new AppointmentDTO();
                    pdto.ap_patient = p.ap_patient;
                    pdto.ap_dept    = p.ap_dept;
                    pdto.date       = p.date.ToString();

                    PatientService pa1  = new PatientService();
                    var            dia1 = pa1.GetByID(p.ap_patient);

                    foreach (var s1 in dia1)
                    {
                        pdto.patient_name = s1.patient_name;
                    }
                    list.Add(pdto);
                }
                list = list.OrderBy(e => e.date).ToList();
                return(list);
            }
        }
Esempio n. 2
0
        public IEnumerable <DiagnosisDTO> GetBydia_patient(string dia_patient)
        {
            using (MyContext ctx = new MyContext())
            {
                var diags = ctx.Diagnosises.AsNoTracking().Where(e => e.dia_patient == dia_patient);
                List <DiagnosisDTO> list = new List <DiagnosisDTO>();
                foreach (var s in diags)
                {
                    DiagnosisDTO dia = new DiagnosisDTO();
                    // dia.doc_ID = s.doc_ID;
                    // dia.dia_patient = s.dia_patient;
                    dia.date     = s.date.ToString();
                    dia.med_Num  = s.med_Num;
                    dia.med_ID   = s.med_ID;
                    dia.result   = s.result;
                    dia.visit_ID = s.visit_ID;
                    //dia6.doc_ID = s.doc_ID;

                    PatientService pa1  = new PatientService();
                    var            dia1 = pa1.GetByID(dia_patient);

                    foreach (var s1 in dia1)
                    {
                        dia.patient_name = s1.patient_name;
                    }

                    DoctorService pa12 = new DoctorService();
                    var           dia2 = pa12.GetByID(s.doc_ID);

                    foreach (var s2 in dia2)
                    {
                        dia.doctor_name = s2.doctor_name;
                    }

                    list.Add(dia);
                }

                return(list);
            }
        }