Exemplo n.º 1
0
        public List <Appointment> createListOfAppointments(String query)
        {
            List <Appointment> appointments = new List <Appointment>();

            List <String> columnNames = DatabaseModel.ColumnNames.getAppointmentsColumnNames();

            String[,] results = _database.selectQuery(query, columnNames);

            DataTable table = CollectionsConverter.convertArrayToDataTable(results, columnNames);

            if (table.Rows.Count > 0)
            {
                appointments = (from p in table.AsEnumerable()
                                select new Appointment(int.Parse(p.Field <String>("patientID")), int.Parse(p.Field <String>("doctorID")), int.Parse(p.Field <String>("roomNumber")), MySqlDatesParser.parseDate(p.Field <String>("date")), p.Field <String>("reason"), int.Parse(p.Field <String>("caseID")))
                {
                }
                                ).ToList();
            }

            return(appointments);
        }
Exemplo n.º 2
0
        public List <Doctor> createListOfDoctors(String query)
        {
            List <Doctor> doctors = new List <Doctor>();

            List <String> columnNames = DatabaseModel.ColumnNames.getDoctorsColumnNames();

            String[,] results = _database.selectQuery(query, columnNames);

            DataTable table = CollectionsConverter.convertArrayToDataTable(results, columnNames);

            if (table.Rows.Count > 0)
            {
                doctors = (from p in table.AsEnumerable()
                           select new Doctor(p.Field <String>("name"), p.Field <String>("surname"), p.Field <String>("gender"), MySqlDatesParser.parseDate(p.Field <String>("dateOfBirth")), int.Parse(p.Field <String>("mobileNumber")), p.Field <String>("email"), p.Field <String>("specialty"), int.Parse(p.Field <String>("roomNumber")))
                {
                    doctorID = int.Parse(p.Field <String>("doctorID")),
                    employeeID = int.Parse(p.Field <String>("employeeID"))
                }
                           ).ToList();
            }

            return(doctors);
        }
Exemplo n.º 3
0
        public List <Sample> createListOfSamples(String query)
        {
            List <Sample> samples = new List <Sample>();

            List <String> columnNames = DatabaseModel.ColumnNames.getSamplesColumnNames();

            String[,] results = _database.selectQuery(query, columnNames);

            DataTable table = CollectionsConverter.convertArrayToDataTable(results, columnNames);

            if (table.Rows.Count > 0)
            {
                samples = (from p in table.AsEnumerable()
                           select new Sample(int.Parse(p.Field <String>("patient_id")), int.Parse(p.Field <String>("doctor_id")), MySqlDatesParser.parseDate(p.Field <String>("creation_date")), p.Field <String>("result"))
                {
                    sampleID = int.Parse(p.Field <String>("sample_id")),
                    tested = Convert.ToBoolean(Convert.ToInt32(p.Field <String>("tested")))
                }
                           ).ToList();
            }

            return(samples);
        }
Exemplo n.º 4
0
        public List <Case> createListOfCasesObjects(String query)
        {
            List <Case> cases = new List <Case>();

            List <String> columnNames = DatabaseModel.ColumnNames.getCasesColumnNames();

            String[,] results = _database.selectQuery(query, columnNames);

            DataTable table = CollectionsConverter.convertArrayToDataTable(results, columnNames);

            if (table.Rows.Count > 0)
            {
                cases = (from p in table.AsEnumerable()
                         select new Case(int.Parse(p.Field <String>("patientID")), MySqlDatesParser.parseDate(p.Field <String>("start_date")), p.Field <String>("description"))
                {
                    caseID = int.Parse(p.Field <String>("case_id")),
                    endDate = MySqlDatesParser.parseNullableDate(p.Field <String>("end_date"))
                }
                         ).ToList();
            }

            return(cases);
        }
Exemplo n.º 5
0
        public List <Patient> createListofPatientObjects()
        {
            List <Patient> patients = new List <Patient>();

            List <String> columnNames = DatabaseModel.ColumnNames.getPatientColumnNames();
            String        query       = "SELECT * FROM Patients";

            String[,] results = _database.selectQuery(query, columnNames);

            DataTable table = CollectionsConverter.convertArrayToDataTable(results, columnNames);

            if (table.Rows.Count > 0)
            {
                patients = (from p in table.AsEnumerable()
                            select new Patient(p.Field <String>("name"), p.Field <String>("surname"), p.Field <String>("gender"), MySqlDatesParser.parseDate(p.Field <String>("dateOfBirth")), int.Parse(p.Field <String>("mobileNumber")), p.Field <String>("email"), MySqlDatesParser.parseDate(p.Field <String>("dateOfRegistration")), int.Parse(p.Field <String>("patientID")), int.Parse(p.Field <String>("medicalCardID")), Convert.ToBoolean(int.Parse(p.Field <String>("underTreatment"))))
                {
                }

                            ).ToList();
            }

            return(patients);
        }