Exemplo n.º 1
0
        protected void showUserInformation()
        {
            connect.Open();
            SqlCommand cmd = connect.CreateCommand();

            //Check if the ID exists in the database:
            cmd.CommandText = "select count(*) from registrations where registerId = '" + registerId.Replace("'", "''") + "' ";
            int countUser = Convert.ToInt32(cmd.ExecuteScalar());

            if (countUser > 0)//if ID exists, countUser = 1
            {
                //Get first name:
                cmd.CommandText = "select register_firstname from [Registrations] where [registerId] = '" + registerId + "' ";
                string firstName = cmd.ExecuteScalar().ToString();
                //Get last name and add it to the first name:
                cmd.CommandText = "select register_lastname from [Registrations] where [registerId] = '" + registerId + "' ";
                string lastName = cmd.ExecuteScalar().ToString();
                //Get email:
                cmd.CommandText = "select register_email from [Registrations] where [registerId] = '" + registerId + "' ";
                string email = cmd.ExecuteScalar().ToString();
                //Get city:
                cmd.CommandText = "select register_city from [Registrations] where [registerId] = '" + registerId + "' ";
                string city = cmd.ExecuteScalar().ToString();
                //Get state:
                cmd.CommandText = "select register_state from [Registrations] where [registerId] = '" + registerId + "' ";
                string state = cmd.ExecuteScalar().ToString();
                //Get zip code:
                cmd.CommandText = "select register_zip from [Registrations] where [registerId] = '" + registerId + "' ";
                string zip = cmd.ExecuteScalar().ToString();
                //Get address:
                cmd.CommandText = "select register_address from [Registrations] where [registerId] = '" + registerId + "' ";
                string address = cmd.ExecuteScalar().ToString();
                //Get role ID as int:
                cmd.CommandText = "select register_roleId from [Registrations] where [registerId] = '" + registerId + "' ";
                int    int_roleId           = Convert.ToInt32(cmd.ExecuteScalar());
                string patientOrPhysicianId = "";
                //Convert role ID to string:
                string role = "";
                if (int_roleId == 1)
                {
                    role = "Admin";
                }
                else if (int_roleId == 2)
                {
                    role = "Physician";
                    //Get Physician ID:
                    cmd.CommandText      = "select register_physicianId from [Registrations] where [registerId] = '" + registerId + "' ";
                    patientOrPhysicianId = cmd.ExecuteScalar().ToString();
                }
                else if (int_roleId == 3)
                {
                    role = "Patient";
                    //Get patient ID:
                    cmd.CommandText      = "select register_patientId from [Registrations] where [registerId] = '" + registerId + "' ";
                    patientOrPhysicianId = cmd.ExecuteScalar().ToString();
                }
                //Get phone:
                cmd.CommandText = "select register_phone from [Registrations] where [registerId] = '" + registerId + "' ";
                string phone = cmd.ExecuteScalar().ToString();
                //Get Country:
                cmd.CommandText = "select register_country from [Registrations] where [registerId] = '" + registerId + "' ";
                string country = cmd.ExecuteScalar().ToString();


                string phoneFormat = "";
                if (country.Equals("United States"))
                {
                    phoneFormat = Layouts.phoneFormat(phone);
                }
                else
                {
                    phoneFormat = phone;
                }
                //Create an informative message containing all information for the selected user:
                lblUserInformation.Text =
                    "<table>" +
                    "<tr><td>Name: </td><td>" + firstName + " " + lastName + "</td></tr>" +
                    "<tr><td>Email: </td><td>" + email + "</td></tr>" +
                    "<tr><td>Address: </td><td>" + address + "</td></tr>" +
                    "<tr><td>City: </td><td>" + city + "</td></tr>" +
                    "<tr><td>State: </td><td>" + state + "</td></tr>" +
                    "<tr><td>Zip code: </td><td>" + zip + "</td></tr>" +
                    "<tr><td>Phone#: </td><td>" + phoneFormat + "</td></tr>" +
                    "<tr><td>Role: </td><td>" + role + "</td></tr>";
                if (!string.IsNullOrWhiteSpace(patientOrPhysicianId))
                {
                    if (int_roleId == 3)
                    {
                        lblUserInformation.Text += "<tr><td>Patient ID: </td><td>" + patientOrPhysicianId + "</td></tr>";
                    }
                    else if (int_roleId == 2)
                    {
                        lblUserInformation.Text += "<tr><td>Physician ID: </td><td>" + patientOrPhysicianId + "</td></tr>";
                    }
                }
                lblUserInformation.Text   += "</table>";
                lblUserInformation.Visible = true;
                //Copy values to globals:
                g_firstName = firstName; g_lastName = lastName; g_email = email; g_city = city; g_state = state;
                g_zip       = zip; g_address = address; g_phone = phone; g_roleId = int_roleId; g_patientOrPhysicianId = patientOrPhysicianId; g_country = country;
            }
            else
            {
                goBack();
            }
            connect.Close();
        }
Exemplo n.º 2
0
        protected void getCompleteProfileInformation()
        {
            string newLine = "<br/>";
            string col_start = "<td>", col_end = "</td>", row_start = "<tr>", row_end = "</tr>";

            connect.Open();
            SqlCommand cmd = connect.CreateCommand();

            cmd.CommandText = "select userId from Users where loginId = '" + loginId + "' ";
            string          userId            = cmd.ExecuteScalar().ToString();
            CompleteProfile completeProfile   = new CompleteProfile(userId, userId);
            string          completeProfileId = completeProfile.Id;
            string          onDialysis        = completeProfile.OnDialysis;
            string          kidneyDisease     = completeProfile.KidneyDisease;
            string          issueDate         = completeProfile.IssueStartDate;
            string          bloodType         = completeProfile.BloodType;
            string          address           = completeProfile.Address + newLine + "  " + completeProfile.City + ", " + completeProfile.State + " " + completeProfile.Zip +
                                                "<br/>" + completeProfile.Country;
            int    counter = 0;
            string row     = "";

            row += row_start + col_start + col_end + col_start + col_end + row_end;
            row += row_start + col_start + col_end + col_start + col_end + row_end;
            row += row_start + col_start + "Complete Profile Information: " + col_end + row_end;
            if (!string.IsNullOrWhiteSpace(onDialysis))
            {
                row += row_start + col_start + "On dialysis: " + col_end + col_start + onDialysis + col_end + row_end;
            }
            if (!string.IsNullOrWhiteSpace(kidneyDisease))
            {
                row += row_start + col_start + "Kidney disease stage: " + col_end + col_start + kidneyDisease + col_end + row_end;
            }
            if (!string.IsNullOrWhiteSpace(issueDate))
            {
                row += row_start + col_start + "Health issue started on: " + col_end + col_start + issueDate + col_end + row_end;
            }
            if (!string.IsNullOrWhiteSpace(bloodType))
            {
                row += row_start + col_start + "Blood type: " + col_end + col_start + bloodType + col_end + row_end;
            }
            row += row_start + col_start + "Address: " + col_end + col_start + address + col_end + row_end;
            List <Insurance> insurances = completeProfile.Insurances;

            if (insurances.Count > 0)
            {
                row += row_start + col_start + "Insurances: " + col_end + col_start + col_end + row_end;
            }
            foreach (Insurance ins in insurances)
            {
                row += row_start + col_start + "Insurance #:" + col_end + col_start + ++counter + col_end + row_end;
                row += row_start + col_start + "Member ID:" + col_end + col_start + ins.MemberId + col_end + row_end;
                row += row_start + col_start + "Group ID:" + col_end + col_start + ins.GroupId + col_end + row_end;
                row += row_start + col_start + "Insurance name: " + col_end + col_start + ins.CompanyName + col_end + row_end;
                row += row_start + col_start + "Insurance phone1 : " + col_end + col_start + Layouts.phoneFormat(ins.Phone1) + col_end + row_end;
                row += row_start + col_start + "Insurance phone2 : " + col_end + col_start + Layouts.phoneFormat(ins.Phone2) + col_end + row_end;
                row += row_start + col_start + "Insurance email: " + col_end + col_start + ins.Email + col_end + row_end;
                row += row_start + col_start + "Insurance address: " + col_end + col_start +
                       ins.Address + newLine + ins.City + ", " + ins.State + " " + ins.Zip + newLine + ins.Country +
                       col_end + row_end;
            }
            ArrayList allergies = completeProfile.Allergies;

            if (allergies.Count > 0)
            {
                row += row_start + col_start + "Allergies: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            foreach (var a in allergies)
            {
                row += row_start + col_start + col_end + col_start + ++counter + ". " + a.ToString() + col_end + row_end;
            }
            ArrayList majorDiagnoses = completeProfile.MajorDiagnoses;

            if (majorDiagnoses.Count > 0)
            {
                row += row_start + col_start + "Major diagnoses: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            foreach (var a in majorDiagnoses)
            {
                row += row_start + col_start + col_end + col_start + ++counter + ". " + a.ToString() + col_end + row_end;
            }
            ArrayList pastHealthConditions = completeProfile.PastHealthConditions;

            if (pastHealthConditions.Count > 0)
            {
                row += row_start + col_start + "Past health conditions: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            foreach (var a in pastHealthConditions)
            {
                row += row_start + col_start + "" + col_end + col_start + ++counter + ". " + a.ToString() + col_end + row_end;
            }
            List <EmailObject> emails = completeProfile.Emails;

            if (emails.Count > 0)
            {
                row += row_start + col_start + "Emails: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            foreach (EmailObject e in emails)
            {
                row += row_start + col_start + "" + col_end + col_start + ++counter + ". Email Address: " + e.EmailAddress;
                if (e.IsDefault == 1)
                {
                    row += " (default)" + col_end + row_end;
                }
                else
                {
                    row += col_end + row_end;
                }
            }
            List <Phone> phones = completeProfile.Phones;

            if (phones.Count > 0)
            {
                row += row_start + col_start + "Phone numbers: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            foreach (Phone e in phones)
            {
                row += row_start + col_start + "" + col_end + col_start + ++counter + ". Phone number: " + Layouts.phoneFormat(e.PhoneNumber);
                if (e.IsDefault == 1)
                {
                    row += " (default)" + col_end + row_end;
                }
                else
                {
                    row += col_end + row_end;
                }
            }
            List <EmergencyContact> emergnecyContacts = completeProfile.EmergencyContacts;

            if (emergnecyContacts.Count > 0)
            {
                row += row_start + col_start + "Emergency contacts: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            foreach (EmergencyContact e in emergnecyContacts)
            {
                row += row_start + col_start + "Contact #:" + col_end + col_start + ++counter + col_end + row_end;
                row += row_start + col_start + "Name: " + col_end + col_start + e.Firstname + " " + e.Lastname + col_end + row_end;
                row += row_start + col_start + "Phone 1: " + col_end + col_start + Layouts.phoneFormat(e.Phone1) + col_end + row_end;
                row += row_start + col_start + "Phone 2: " + col_end + col_start + Layouts.phoneFormat(e.Phone2) + col_end + row_end;
                row += row_start + col_start + "Phone 3: " + col_end + col_start + Layouts.phoneFormat(e.Phone3) + col_end + row_end;
                row += row_start + col_start + "Email: " + col_end + col_start + e.Email + col_end + row_end;
                row += row_start + col_start + "Address: " + col_end + col_start +
                       e.Address + newLine + e.City + ", " + e.State + " " + e.Zip + newLine + e.Country +
                       col_end + row_end;
            }
            List <PastPatientID> pastPatientIds = completeProfile.PastPatientIds;

            if (pastPatientIds.Count > 0)
            {
                row += row_start + col_start + "Past patient IDs: " + col_end + col_start + col_end + row_end;
            }
            counter = 0;
            int treatment_count = 0;

            foreach (PastPatientID p in pastPatientIds)
            {
                //row += row_start + col_start + "" + col_end + col_start + "" + col_end + row_end;
                row += row_start + col_start + "Medical Record Number: " + col_end + col_start + p.MRN + col_end + row_end;
                List <Treatment> treatments     = completeProfile.Treatments;
                string           str_treatments = "";
                if (treatments.Count > 0)
                {
                    str_treatments = "Treatments: " + newLine;
                }
                foreach (Treatment t in treatments)
                {
                    if (t.PastPatientId.Equals(p.ID))
                    {
                        row += row_start + col_start + "Treatment #: " + col_end + col_start + ++treatment_count + col_end + row_end;
                        row += row_start + col_start + "Physician name: " + col_end + col_start + t.PhysicianFirstName + " " + t.PhysicianLastName + col_end + row_end;
                        row += row_start + col_start + "Treatment started on: " + col_end + col_start + t.StartDate + col_end + row_end;
                        row += row_start + col_start + "Hospital name: " + col_end + col_start + t.HospitalName + col_end + row_end;
                        row += row_start + col_start + "Hospital address: " + col_end + col_start +
                               t.HospitalAddress + newLine +
                               t.HospitalCity + ", " + t.HospitalState + " " + t.HospitalZip + newLine +
                               t.HospitalCountry +
                               col_end + row_end;
                    }
                }
            }
            lblRow.Text += row;
            connect.Close();
        }