public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.CITIES);

            query.Add(Database.Tables.Cities.Name, Name);
            query.Add(Database.Tables.Cities.StateId, State);
            DoSave(query);
            AddressManager.Add(this);
        }
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.STATES);

            query.Add(Database.Tables.States.Name, Name);
            query.Add(Database.Tables.States.CountryId, Country);
            DoSave(query);
            AddressManager.Add(this);
        }
Exemple #3
0
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.MEDICATIONS);

            query.Add(Database.Tables.Medications.Code, Code);
            query.Add(Database.Tables.Medications.Name, Name);
            DoSave(query);
            PatientsManager.Add(this);
        }
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.POSTAL_CODES);

            query.Add(Database.Tables.PostalCodes.Code, Postcode);
            query.Add(Database.Tables.PostalCodes.CityId, City);
            DoSave(query);
            AddressManager.Add(this);
        }
        public override void Save()
        {
            base.Save();
            DatabaseQuery query = new DatabaseQuery(Database.Tables.MEDICAL_STAFFS);

            query.Add(Database.Tables.MedicalStaffs.StaffId, Id);
            query.Add(Database.Tables.MedicalStaffs.LicenseNo, LicenseNo);
            DoSave(query);
        }
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.IDENTIFICATIONS);

            query.Add(Database.Tables.Identifications.Value, Value);
            query.Add(Database.Tables.Identifications.DetailsId, Owner);
            DoSave(query);
            DetailsManager.Add(this);
        }
Exemple #7
0
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.CONTACT_NUMBERS);

            query.Add(Database.Tables.ContactNumbers.Number, Number);
            query.Add(Database.Tables.ContactNumbers.DetailsId, Owner);
            DoSave(query);
            DetailsManager.Add(this);
        }
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.LEAVE_DATES);

            query.Add(Database.Tables.LeaveDates.Date, QueryElement.DateOf(Date));
            query.Add(Database.Tables.LeaveDates.StaffId, Owner);
            DoSave(query);
            StaffsManager.Add(this);
        }
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.PRESCRIPTION_MEDICATIONS);

            query.Add(Database.Tables.PrescriptionMedications.PrescriptionId, Prescription);
            query.Add(Database.Tables.PrescriptionMedications.MedicationId, Base);
            DoSave(query);
            PatientsManager.Add(this);
        }
Exemple #10
0
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.STAFFS);

            query.Add(Database.Tables.Staffs.Password, Password);
            query.Add(Database.Tables.Staffs.DateJoined, DateJoined);
            query.Add(Database.Tables.Staffs.DetailsId, Details);
            query.Add(Database.Tables.Staffs.Active, Active ? 1 : 0);
            DoSave(query);
        }
Exemple #11
0
        public override void Save()
        {
            base.Save();
            DatabaseQuery query = new DatabaseQuery(Database.Tables.RECEPTIONISTS);

            query.Comparator = Identifier;
            query.Add(Database.Tables.Receptionists.StaffId, Id);
            query.Add(Database.Tables.Receptionists.Admin, Admin ? 1 : 0);
            DoSave(query);
        }
Exemple #12
0
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.APPOINTMENTS);

            query.Add(Database.Tables.Appointments.MedicalStaffId, MedicalStaff);
            query.Add(Database.Tables.Appointments.PatientId, Patient);
            query.Add(Database.Tables.Appointments.Cancelled, Cancelled ? 1 : 0);
            query.Add(Database.Tables.Appointments.DateAppointed, DateAppointed);
            DoSave(query);
            PatientsManager.Add(this);
        }
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.WORKING_DAYS);

            query.Add(Database.Tables.WorkingDays.StaffId);
            query.Add(Database.Tables.WorkingDays.Sunday);
            query.Add(Database.Tables.WorkingDays.Monday);
            query.Add(Database.Tables.WorkingDays.Tuesday);
            query.Add(Database.Tables.WorkingDays.Wednesday);
            query.Add(Database.Tables.WorkingDays.Thursday);
            query.Add(Database.Tables.WorkingDays.Friday);
            query.Add(Database.Tables.WorkingDays.Saturday);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Owner     = StaffsManager.GetMedicalStaff(reader.GetInt32(0));
                Sunday    = reader.GetByte(1) > 0 ? true : false;
                Monday    = reader.GetByte(2) > 0 ? true : false;
                Tuesday   = reader.GetByte(3) > 0 ? true : false;
                Wednesday = reader.GetByte(4) > 0 ? true : false;
                Thursday  = reader.GetByte(5) > 0 ? true : false;
                Friday    = reader.GetByte(6) > 0 ? true : false;
                Saturday  = reader.GetByte(7) > 0 ? true : false;
                StaffsManager.Add(this);
            }

            reader.Close();
        }
        public static List <Prescription> GetPrescriptionsByMedicationName(string name)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.PRESCRIPTION_MEDICATIONS)
            {
                Comparator = ManagerHelper.GetInLikeComparator
                             (
                    Database.Tables.PrescriptionMedications.MedicationId,
                    Database.Tables.MEDICATIONS,
                    Database.Tables.Medications.Name,
                    name
                             )
            };

            nestedQuery.Add(Database.Tables.PrescriptionMedications.PrescriptionId);

            return(PrescriptionManager.Merge
                   (
                       Database.Tables.PRESCRIPTIONS,
                       ManagerHelper.GetInComparator
                       (
                           Database.Tables.Generic.ID,
                           nestedQuery
                       )
                   ));
        }
        public static List <Patient> GetPatientsByPostcode(string code)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.PERSONAL_DETAILS)
            {
                Comparator = new QueryComparator()
                {
                    Source  = new QueryElement(Database.Tables.PersonalDetails.PostcodeId),
                    Operand = new QueryElement
                              (
                        ManagerHelper.GetInEqualQuery
                        (
                            Database.Tables.POSTAL_CODES,
                            Database.Tables.PostalCodes.Code,
                            code
                        )
                              )
                }
            };

            nestedQuery.Add(Database.Tables.Generic.ID);

            return(PatientManager.Merge
                   (
                       Database.Tables.PATIENTS,
                       ManagerHelper.GetInComparator
                       (
                           Database.Tables.Patients.DetailsId,
                           nestedQuery
                       )
                   ));
        }
Exemple #16
0
        public static DatabaseQuery GetInEqualQuery(string tableName, string columnName, object value)
        {
            DatabaseQuery subquery = new DatabaseQuery(tableName);

            subquery.Comparator = ManagerHelper.GetEqualComparator(columnName, value);
            subquery.Add(Database.Tables.Generic.ID);
            return(subquery);
        }
Exemple #17
0
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.PATIENTS);

            query.Add(Database.Tables.Patients.DetailsId, Details);
            DoSave(query);
            PatientsManager.Add(this);
        }
Exemple #18
0
        public override void Save()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.COUNTRIES);

            query.Add(Database.Tables.Countries.Name, Name);
            DoSave(query);
            AddressManager.Add(this);
        }
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.LEAVE_DATES);

            query.Add(Database.Tables.LeaveDates.Date);
            query.Add(Database.Tables.LeaveDates.StaffId);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Date  = reader.GetDateTime(0);
                Owner = StaffsManager.GetMedicalStaff(reader.GetInt32(1));
                StaffsManager.Add(this);
            }

            reader.Close();
        }
Exemple #20
0
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.CONTACT_NUMBERS);

            query.Add(Database.Tables.ContactNumbers.Number);
            query.Add(Database.Tables.ContactNumbers.DetailsId);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Number = reader.GetString(0);
                Owner  = DetailsManager.GetPersonalDetail(reader.GetInt32(1));
                DetailsManager.Add(this);
            }

            reader.Close();
        }
Exemple #21
0
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.MEDICATIONS);

            query.Add(Database.Tables.Medications.Code);
            query.Add(Database.Tables.Medications.Name);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Code = reader.GetString(0);
                Name = reader.GetString(1);
                PatientsManager.Add(this);
            }

            reader.Close();
        }
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.IDENTIFICATIONS);

            query.Add(Database.Tables.Identifications.Value);
            query.Add(Database.Tables.Identifications.DetailsId);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Value = reader.GetString(0);
                Owner = DetailsManager.GetPersonalDetail(reader.GetInt32(1));
                DetailsManager.Add(this);
            }

            reader.Close();
        }
Exemple #23
0
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.POSTAL_CODES);

            query.Add(Database.Tables.PostalCodes.Code);
            query.Add(Database.Tables.PostalCodes.CityId);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Postcode = reader.GetString(0);
                City     = AddressManager.GetCity(reader.GetInt32(1));
                AddressManager.Add(this);
            }

            reader.Close();
        }
Exemple #24
0
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.STATES);

            query.Add(Database.Tables.States.Name);
            query.Add(Database.Tables.States.CountryId);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Name    = reader.GetString(0);
                Country = AddressManager.GetCountry(reader.GetInt32(1));
                AddressManager.Add(this);
            }

            reader.Close();
            AddressManager.Add(this);
        }
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.PRESCRIPTION_MEDICATIONS);

            query.Add(Database.Tables.PrescriptionMedications.PrescriptionId);
            query.Add(Database.Tables.PrescriptionMedications.MedicationId);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Prescription = PatientsManager.GetPrescription(reader.GetInt32(0));
                Base         = PatientsManager.GetMedication(reader.GetInt32(1));
                Code         = Base.Code;
                Name         = Base.Name;
                PatientsManager.Add(this);
            }

            reader.Close();
        }
Exemple #26
0
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.STAFFS);

            query.Add(Database.Tables.Staffs.Password);
            query.Add(Database.Tables.Staffs.DateJoined);
            query.Add(Database.Tables.Staffs.DetailsId);
            query.Add(Database.Tables.Staffs.Active);

            MySqlDataReader reader = DoLoad(query);

            Details    = new PersonalDetails();
            Password   = reader.GetString(0);
            Details.Id = reader.GetInt32(1);
            DateJoined = reader.GetDateTime(0);
            Active     = reader.GetByte(0) > 0 ? true : false;

            reader.Close();
            Details.Load();
        }
Exemple #27
0
        // Getting leave dates within a set range through the staff ID.
        public static List <MedicalStaff> GetMedicalStaffLeavesFrom(DateTime start, DateTime end, bool not)
        {
            DatabaseQuery nestedQuery = new DatabaseQuery(Database.Tables.LEAVE_DATES);

            if (start.Date.Equals(end.Date))
            {
                nestedQuery.Comparator = new QueryComparator
                {
                    Source  = new QueryElement(Database.Tables.LeaveDates.Date),
                    Operand = new QueryElement(null, QueryElement.DateOf(start))
                };
            }
            else
            {
                nestedQuery.Comparator = new QueryComparator
                {
                    Source = new QueryComparator()
                    {
                        Source  = new QueryElement(Database.Tables.LeaveDates.Date),
                        Operand = new QueryElement(null, QueryElement.DateOf(start)),
                        Equal   = !not,
                        More    = !not,
                        Less    = not
                    },

                    Operand = new QueryComparator()
                    {
                        Source  = new QueryElement(Database.Tables.LeaveDates.Date),
                        Operand = new QueryElement(null, QueryElement.DateOf(end)),
                        Equal   = !not,
                        Less    = !not,
                        More    = not
                    },

                    And = !not,
                    Or  = not
                };
            }

            nestedQuery.Add(Database.Tables.LeaveDates.StaffId);

            return(ManagerHelper.FilterType <MedicalStaff>
                   (
                       StaffManager.Merge
                       (
                           Database.Tables.STAFFS,
                           ManagerHelper.GetInComparator
                           (
                               Database.Tables.Generic.ID,
                               nestedQuery
                           )
                       )
                   ));
        }
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.PERSONAL_DETAILS);

            query.Add(Database.Tables.PersonalDetails.FirstName);
            query.Add(Database.Tables.PersonalDetails.LastName);
            query.Add(Database.Tables.PersonalDetails.Address);
            query.Add(Database.Tables.PersonalDetails.PostcodeId);
            query.Add(Database.Tables.PersonalDetails.DateOfBirth);
            query.Add(Database.Tables.PersonalDetails.Sex);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                FirstName   = reader.GetString(0);
                LastName    = reader.GetString(1);
                Address     = reader.GetString(2);
                Postcode    = AddressManager.GetPostcode(reader.GetInt32(3));
                DateOfBirth = reader.GetDateTime(4);
                Sex         = reader.GetChar(5);
                DetailsManager.Add(this);
            }

            reader.Close();

            Identifications = DetailsManager.GetIdentificationsWithOwner(this);
            ContactNumbers  = DetailsManager.GetContactNumbersWithOwner(this);
        }
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.TEST_RESULTS);

            query.Add(Database.Tables.TestResults.PatientId);
            query.Add(Database.Tables.TestResults.MedicalLicenseNo);
            query.Add(Database.Tables.TestResults.Name);
            query.Add(Database.Tables.TestResults.Description);
            query.Add(Database.Tables.TestResults.Result);
            query.Add(Database.Tables.TestResults.Remark);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Patient          = PatientsManager.GetPatient(reader.GetInt32(0));
                MedicalLicenseNo = reader.GetString(1);
                Name             = reader.GetString(2);
                Description      = reader.GetString(3);
                Result           = reader.GetString(4);
                Remark           = reader.GetString(5);
                PatientsManager.Add(this);
            }

            reader.Close();
        }
Exemple #30
0
        public override void Load()
        {
            DatabaseQuery query = new DatabaseQuery(Database.Tables.PRESCRIPTIONS);

            query.Add(Database.Tables.Prescriptions.PrescriberId);
            query.Add(Database.Tables.Prescriptions.PatientId);
            query.Add(Database.Tables.Prescriptions.Name);
            query.Add(Database.Tables.Prescriptions.Remark);
            query.Add(Database.Tables.Prescriptions.StartDate);
            query.Add(Database.Tables.Prescriptions.EndDate);

            MySqlDataReader reader = DoLoad(query);

            if (Loaded)
            {
                Prescriber = StaffsManager.GetMedicalStaff(reader.GetInt32(0));
                Patient    = PatientsManager.GetPatient(reader.GetInt32(1));
                Name       = reader.GetString(2);
                Remark     = reader.GetString(3);
                StartDate  = reader.GetDateTime(4);
                EndDate    = reader.GetDateTime(5);
                PatientsManager.Add(this);
            }

            reader.Close();
            // TODO: Implement fetching prescription's medications.
        }