예제 #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                patients       = new List <clsPatientModel>();
                appointment    = new clsAppointment();
                patientDetails = new clsPatientDetails();

                DateTime from = Convert.ToDateTime(dpFrom.Value);
                DateTime to   = Convert.ToDateTime(dpTo.Value);

                if ((from > to) || (from == to))
                {
                    throw new Exception("Invalid date");
                }

                var patientsRow = appointment.Retrieve();
                if (patientsRow.Count > 0)
                {
                    foreach (var item in patientsRow)
                    {
                        item.PatientDetails = new clsPatientDetailsModel();
                        item.PatientDetails = patientDetails.GetByPatientId(item.PatientId);
                    }
                }

                foreach (var item in patientsRow)
                {
                    foreach (var appointment in item.Appointments)
                    {
                        if ((appointment.Appointment.Date >= from.Date) && (appointment.Appointment.Date <= to.Date))
                        {
                            clsPatientModel sort = new clsPatientModel
                            {
                                PatientDetails = new clsPatientDetailsModel(),
                                Appointments   = new List <clsAppointmentModel>(),

                                PatientId = item.PatientId
                            };
                            sort.PatientDetails = item.PatientDetails;
                            sort.Appointments.Add(appointment);

                            patients.Add(sort);
                        }
                    }
                }

                AssignToGrid();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        //private void xuiButton1_Click(object sender, EventArgs e)
        //{
        //    RangeOfMotion range = new RangeOfMotion(this, NavigationType.Appointments);
        //    range.ShowDialog();
        //}

        //public void SetLabel(string label)
        //{
        //    //lblTest.Text = label;
        //}

        private void RetrieveTodayAppointment()
        {
            patients       = new List <clsPatientModel>();
            appointment    = new clsAppointment();
            patientDetails = new clsPatientDetails();

            var patientsRow = appointment.Retrieve();

            if (patientsRow.Count > 0)
            {
                foreach (var item in patientsRow)
                {
                    item.PatientDetails = new clsPatientDetailsModel();
                    item.PatientDetails = patientDetails.GetByPatientId(item.PatientId);
                }
            }

            foreach (var item in patientsRow)
            {
                foreach (var appointment in item.Appointments)
                {
                    if (appointment.Appointment.Date == DateTime.Today.Date)
                    {
                        clsPatientModel sort = new clsPatientModel
                        {
                            PatientDetails = new clsPatientDetailsModel(),
                            Appointments   = new List <clsAppointmentModel>(),

                            PatientId = item.PatientId
                        };
                        sort.PatientDetails = item.PatientDetails;
                        sort.Appointments.Add(appointment);

                        patients.Add(sort);
                    }
                }
            }
        }