// Method used to populate ListBox
        public static string patientToString(PatientsTable patient, HospitalDBEntities dbcon)
        {
            List <TestsTable>          tests        = dbcon.TestsTables.ToList();
            List <MedicationListTable> meds         = dbcon.MedicationListTables.ToList();
            List <AppointmentsTable>   appointments = dbcon.AppointmentsTables.ToList();

            String final = "Name: " + patient.FirstName + " " + patient.LastName + "\nEmail: " + patient.Email + "\nTests:";

            foreach (TestsTable test in tests)
            {
                if (patient.TestID == test.TestID)
                {
                    final += "  " + test.TestResults + "  " + test.TestDate;
                }
            }
            final += "\nMedications:";
            foreach (MedicationListTable med in meds)
            {
                if (patient.MedicationID == med.MedicationID)
                {
                    final += "  " + med.Description;
                }
            }
            final += "\nAppointments:";
            foreach (AppointmentsTable app in appointments)
            {
                if (patient.PatientID == app.PatientID)
                {
                    final += "  " + app.VisitSummary + "  " + app.Date + "\n";
                }
            }
            return(final);
        }
Beispiel #2
0
        // Creates Patient from login username
        public static PatientsTable getPatient(string username)
        {
            PatientsTable myPatient = null;

            username = username.Trim();
            foreach (PatientsTable patient in dbcon.PatientsTables)
            {
                if (patient.UserLoginName.ToString().Trim() == username) // if input is equal to a username in database, create copy
                {
                    myPatient               = new PatientsTable();
                    myPatient.PatientID     = patient.PatientID;
                    myPatient.DoctorID      = patient.DoctorID;
                    myPatient.FirstName     = patient.FirstName;
                    myPatient.LastName      = patient.LastName;
                    myPatient.Address       = patient.Address;
                    myPatient.Phone         = patient.Phone;
                    myPatient.Email         = patient.Email;
                    myPatient.UserLoginName = patient.UserLoginName;
                    myPatient.MedicationID  = patient.MedicationID;
                    myPatient.TestID        = patient.TestID;
                    break;
                }
            }
            return(myPatient);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     myPatient = UtilitiesClass.getPatient(Session["LoginName"].ToString());
     if (!IsPostBack)
     {
         ShowSelectedDateLabel.Visible = false;
     }
 }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Session["IsDoctor"]) == 0)
            {
                PatientsTable myPatient = UtilitiesClass.getPatient(Session["LoginName"].ToString());
                DoctorsTable  myDoctor  = UtilitiesClass.getPatientsDoctor(myPatient);

                HyperLink4.Text        = "Medications/Tests";
                HyperLink4.NavigateUrl = "~/MedAndTestsList.aspx";
                Label1.Text            = "Current Session: " + myPatient.FirstName.Trim() + " " + myPatient.LastName.Trim() + " - Your Doctor: " + myDoctor.FirstName + " " + myDoctor.LastName;
            }
            else if (Convert.ToInt32(Session["IsDoctor"]) == 1)
            {
                DoctorsTable myDoctor = UtilitiesClass.getDoctor(Session["LoginName"].ToString());

                HyperLink4.Text        = "Search for Patient";
                HyperLink4.NavigateUrl = "~/PatientSearch.aspx";
                Label1.Text            = "Current Session: " + myDoctor.FirstName + " " + myDoctor.LastName;
            }
        }
Beispiel #5
0
        // Creates Doctor from loged in patient
        public static DoctorsTable getPatientsDoctor(PatientsTable patient)
        {
            DoctorsTable doctor = null;

            foreach (DoctorsTable doc in dbcon.DoctorsTables)
            {
                if (doc.DoctorID == patient.DoctorID) // if patient's DoctorID equals DoctorID in doctor table, create copy of doctor
                {
                    doctor               = new DoctorsTable();
                    doctor.FirstName     = doc.FirstName;
                    doctor.LastName      = doc.LastName;
                    doctor.UserLoginName = doc.UserLoginName;
                    doctor.Email         = doc.Email;
                    doctor.DoctorID      = doc.DoctorID;
                    doctor.Location      = doc.Location;
                    doctor.Department    = doc.Department;
                    break;
                }
            }
            return(doctor);
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Checks if user is patient or doctor, and creates object
            if (Convert.ToInt32(Session["IsDoctor"]) == 0)
            {
                myPatient            = UtilitiesClass.getPatient(Session["LoginName"].ToString());
                Session["PatientID"] = myPatient.PatientID;

                Label1.Text       = myPatient.FirstName + " " + myPatient.LastName;
                myDoctor          = UtilitiesClass.getPatientsDoctor(myPatient);
                GridView2.Visible = false;
            }
            else
            {
                myDoctor            = UtilitiesClass.getDoctor(Session["LoginName"].ToString());
                Session["DoctorID"] = myDoctor.DoctorID;

                Label1.Text       = myDoctor.FirstName + " " + myDoctor.LastName;
                GridView1.Visible = false;
            }
        }