protected void Page_Load(object sender, EventArgs e)
 {
     myPatient = UtilitiesClass.getPatient(Session["LoginName"].ToString());
     if (!IsPostBack)
     {
         ShowSelectedDateLabel.Visible = false;
     }
 }
Пример #2
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;
            }
        }
Пример #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;
            }
        }
        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;
        }