Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
        // Create Doctor from login username
        public static DoctorsTable getDoctor(string username)
        {
            DoctorsTable myDoctor = null;

            username = username.Trim();
            foreach (DoctorsTable doctor in dbcon.DoctorsTables)
            {
                if (doctor.UserLoginName.ToString().Trim() == username) // if input is equal to a username in database, create copy
                {
                    myDoctor               = new DoctorsTable();
                    myDoctor.DoctorID      = doctor.DoctorID;
                    myDoctor.FirstName     = doctor.FirstName;
                    myDoctor.LastName      = doctor.LastName;
                    myDoctor.Location      = doctor.Location;
                    myDoctor.Department    = doctor.Department;
                    myDoctor.Email         = doctor.Email;
                    myDoctor.UserLoginName = doctor.UserLoginName;
                    break;
                }
            }
            return(myDoctor);
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            ListBox1.Items.Clear();

            DoctorsTable         myDoctor           = UtilitiesClass.getDoctor(Session["LoginName"].ToString());
            List <PatientsTable> patientList        = dbcon.PatientsTables.ToList(); // All Patients
            List <PatientsTable> doctorsPatientList = new List <PatientsTable>();    // Contains only patients of myDoctor

            // Populates doctor's patient list
            foreach (PatientsTable patient in patientList)
            {
                if (patient.DoctorID == myDoctor.DoctorID)
                {
                    doctorsPatientList.Add(patient);
                }
            }

            // Search by PatientID
            if (RadioButtonList1.SelectedIndex == 0)
            {
                foreach (PatientsTable patient in doctorsPatientList)
                {
                    if (patient.PatientID.ToString().Equals(TextBox1.Text))
                    {
                        foreach (string s in Regex.Split(PatientSearch.patientToString(patient, dbcon), "\n"))  // Used to newline on ListBox
                        {
                            ListBox1.Items.Add(s);
                        }
                    }
                }
                if (ListBox1.Items.Count == 0)
                {
                    ListBox1.Items.Add("No Patient Found.");
                }
            }
            // Search by First Name
            else if (RadioButtonList1.SelectedIndex == 1)
            {
                foreach (PatientsTable patient in doctorsPatientList)
                {
                    if (patient.FirstName.Trim().Equals(TextBox1.Text.Trim()))
                    {
                        foreach (string s in Regex.Split(PatientSearch.patientToString(patient, dbcon), "\n"))
                        {
                            ListBox1.Items.Add(s);
                        }
                    }
                }
                if (ListBox1.Items.Count == 0)
                {
                    ListBox1.Items.Add("No Patient Found.");
                }
            }
            // Search by Last Name
            else if (RadioButtonList1.SelectedIndex == 2)
            {
                foreach (PatientsTable patient in doctorsPatientList)
                {
                    if (patient.LastName.Trim().Equals(TextBox1.Text.Trim()))
                    {
                        foreach (string s in Regex.Split(PatientSearch.patientToString(patient, dbcon), "\n"))
                        {
                            ListBox1.Items.Add(s);
                        }
                    }
                }
                if (ListBox1.Items.Count == 0)
                {
                    ListBox1.Items.Add("No Patient Found.");
                }
            }
            else
            {
                ListBox1.Items.Add("Please select an option.");
            }

            ListBox1.Visible = true;
        }