Exemplo n.º 1
0
        private void ResetPanel(Classes.Entity.Patient patient)
        {
            if (patient.hasHeightMeasurementPermissionsApproved)
            {
                RadioButtonTypeHeightMeasurement.Enabled = true;
            }
            if (patient.hasWeightMeasurementPermissionsApproved)
            {
                RadioButtonTypeWeightMeasurement.Enabled = true;
            }
            if (patient.hasTemperatureReadingPermissionsApproved)
            {
                RadioButtonTypeTemperatureReading.Enabled = true;
            }
            if (patient.hasBloodPressureReadingPermissionsApproved)
            {
                RadioButtonTypeBloodPressureReading.Enabled = true;
            }
            if (patient.hasECGReadingPermissionsApproved)
            {
                RadioButtonTypeECGReading.Enabled = true;
            }
            if (patient.hasMRIPermissionsApproved)
            {
                RadioButtonTypeMRI.Enabled = true;
            }
            if (patient.hasXRayPermissionsApproved)
            {
                RadioButtonTypeXRay.Enabled = true;
            }
            if (patient.hasGaitPermissionsApproved)
            {
                RadioButtonTypeGait.Enabled = true;
            }

            if (patient.hasHeightMeasurementPermissionsApproved)
            {
                RadioButtonTypeHeightMeasurement.Checked = true;
            }
            else if (patient.hasWeightMeasurementPermissionsApproved)
            {
                RadioButtonTypeWeightMeasurement.Checked = true;
            }
            else if (patient.hasTemperatureReadingPermissionsApproved)
            {
                RadioButtonTypeTemperatureReading.Checked = true;
            }
            else if (patient.hasBloodPressureReadingPermissionsApproved)
            {
                RadioButtonTypeBloodPressureReading.Checked = true;
            }
            else if (patient.hasECGReadingPermissionsApproved)
            {
                RadioButtonTypeECGReading.Checked = true;
            }
            else if (patient.hasMRIPermissionsApproved)
            {
                RadioButtonTypeMRI.Checked = true;
            }
            else if (patient.hasXRayPermissionsApproved)
            {
                RadioButtonTypeXRay.Checked = true;
            }
            else if (patient.hasGaitPermissionsApproved)
            {
                RadioButtonTypeGait.Checked = true;
            }

            ScriptManager.RegisterStartupScript(this, GetType(), "Reset Panels", "document.forms[0].reset();", true);
        }
        private void Update_UpdatePanelPermissions(string nric)
        {
            Classes.Entity.Patient patient = therapistBLL.GetPatientPermissions(nric);

            LabelPatientNRIC.Text = patient.nric;

            CheckBoxTypeHeightMeasurementApproved.Checked    = patient.hasHeightMeasurementPermissionsApproved;
            CheckBoxTypeWeightMeasurementApproved.Checked    = patient.hasWeightMeasurementPermissionsApproved;
            CheckBoxTypeTemperatureReadingApproved.Checked   = patient.hasTemperatureReadingPermissionsApproved;
            CheckBoxTypeBloodPressureReadingApproved.Checked = patient.hasBloodPressureReadingPermissionsApproved;
            CheckBoxTypeECGReadingApproved.Checked           = patient.hasECGReadingPermissionsApproved;
            CheckBoxTypeMRIApproved.Checked  = patient.hasMRIPermissionsApproved;
            CheckBoxTypeXRayApproved.Checked = patient.hasXRayPermissionsApproved;
            CheckBoxTypeGaitApproved.Checked = patient.hasGaitPermissionsApproved;

            CheckBoxTypeHeightMeasurement.Checked    = patient.hasHeightMeasurementPermissions;
            CheckBoxTypeWeightMeasurement.Checked    = patient.hasWeightMeasurementPermissions;
            CheckBoxTypeTemperatureReading.Checked   = patient.hasTemperatureReadingPermissions;
            CheckBoxTypeBloodPressureReading.Checked = patient.hasBloodPressureReadingPermissions;
            CheckBoxTypeECGReading.Checked           = patient.hasECGReadingPermissions;
            CheckBoxTypeMRI.Checked  = patient.hasMRIPermissions;
            CheckBoxTypeXRay.Checked = patient.hasXRayPermissions;
            CheckBoxTypeGait.Checked = patient.hasGaitPermissions;

            if (patient.requestTime != null)
            {
                modalPermissionStatus.Text = "Request for Permissions were sent on " + patient.requestTime;
            }
            else
            {
                modalPermissionStatus.Text = "No Request sent to " + patient.nric;
            }

            if (patient.requestTime == null)
            {
                if (patient.approvedTime == null)
                {
                    DivModalPermissionStatus.Attributes.Add("class", "alert alert-secondary my-2 text-center small");
                    modalPermissionStatus.Text = "You have no approved permissions.";
                }
                else
                {
                    DivModalPermissionStatus.Attributes.Add("class", "alert alert-info my-2 text-center small");
                    modalPermissionStatus.Text = "You have been granted permissions and have not submitted any new requests for permissions.";
                }
            }
            else
            {
                if (patient.approvedTime == null)
                {
                    DivModalPermissionStatus.Attributes.Add("class", "alert alert-danger my-2 text-center small");
                    modalPermissionStatus.Text = "You have not been granted permissions and have requested for permissions sent on " + patient.requestTime + ".";
                }
                else
                {
                    DivModalPermissionStatus.Attributes.Add("class", "alert alert-warning my-2 text-center small");
                    modalPermissionStatus.Text = "You have been granted permissions and have requested for permissions sent on " + patient.requestTime + ".";
                }
            }

            UpdatePanelPermissions.Update();
        }
        protected void GridViewPatient_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string nric = e.CommandArgument.ToString();

            ViewState["GridViewPatientSelectedNRIC"] = nric;

            if (e.CommandName.Equals("ViewPermission"))
            {
                try
                {
                    Update_UpdatePanelPermissions(nric);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Select Permission Modal", "$('#modalPermissions').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Opening Permission View.');", true);
                }
            }
            else if (e.CommandName.Equals("ViewInformation"))
            {
                try
                {
                    Classes.Entity.Patient patient = therapistBLL.GetPatientInformation(nric);

                    // Personal Details
                    LabelInformationNRIC.Text = patient.nric;
                    inputNRIC.Value           = patient.nric;
                    DateofBirth.Value         = patient.dateOfBirth.ToString("MM/dd/yyyy");
                    FirstName.Value           = patient.firstName;
                    LastName.Value            = patient.lastName;
                    CountryofBirth.Value      = patient.countryOfBirth;
                    Nationality.Value         = patient.nationality;
                    Sex.Value           = patient.sex;
                    Gender.Value        = patient.gender;
                    MaritalStatus.Value = patient.maritalStatus;

                    // Contact Details
                    Address.Value       = patient.address;
                    PostalCode.Value    = patient.addressPostalCode;
                    EmailAddress.Value  = patient.email;
                    ContactNumber.Value = patient.contactNumber;

                    // Patient NOK Details
                    NOKName.Value    = patient.nokName;
                    NOKContact.Value = patient.nokContact;

                    UpdatePanelInformation.Update();

                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Select Information Modal", "$('#modalInformation').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Opening Information View.');", true);
                }
            }
            else if (e.CommandName.Equals("ViewRecords"))
            {
                try
                {
                    List <Record> records = new RecordBLL().GetRecords(nric);
                    LabelRecordsNRIC.Text = nric;
                    modalRecordsHyperlinkNewRecord.NavigateUrl = "~/Therapist/My-Patients/New-Record?Patient-NRIC=" + nric;

                    ViewState["GridViewRecords"] = records;
                    GridViewRecords.DataSource   = records;
                    GridViewRecords.DataBind();
                    UpdatePanelRecords.Update();

                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Select Records Modal", "$('#modalRecords').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Opening Records Modal.');", true);
                }
            }
            else if (e.CommandName.Equals("ViewDiagnosis"))
            {
                try
                {
                    TextboxSearchDiagnosis.Text = string.Empty;
                    Bind_GridViewPatientDiagnoses(nric);
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Diagnosis Modal", "$('#modalDiagnosisView').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Opening Diagnosis Modal.');", true);
                }
            }

            Bind_GridViewPatient();
        }
        protected void GridViewPatient_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string nric = e.CommandArgument.ToString();

            ViewState["GridViewPatientSelectedNRIC"] = nric;

            if (e.CommandName.Equals("ViewInformation"))
            {
                try
                {
                    Classes.Entity.Patient patient = therapistBLL.GetPatientInformation(nric);

                    // Personal Details
                    LabelInformationNRIC.Text = patient.nric;
                    inputNRIC.Value           = patient.nric;
                    DateofBirth.Value         = patient.dateOfBirth.ToString("MM/dd/yyyy");
                    FirstName.Value           = patient.firstName;
                    LastName.Value            = patient.lastName;
                    CountryofBirth.Value      = patient.countryOfBirth;
                    Nationality.Value         = patient.nationality;
                    Sex.Value           = patient.sex;
                    Gender.Value        = patient.gender;
                    MaritalStatus.Value = patient.maritalStatus;

                    // Contact Details
                    Address.Value       = patient.address;
                    PostalCode.Value    = patient.addressPostalCode;
                    EmailAddress.Value  = patient.email;
                    ContactNumber.Value = patient.contactNumber;

                    // Patient NOK Details
                    NOKName.Value    = patient.nokName;
                    NOKContact.Value = patient.nokContact;

                    UpdatePanelInformation.Update();

                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Select Information Modal", "$('#modalInformation').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Opening Information View.');", true);
                }
            }
            else if (e.CommandName.Equals("SelectPatient"))
            {
                try
                {
                    ViewState["GridViewPatientSelectedPatientNRIC"] = nric;
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Selecting Patient.');", true);
                }
            }
            else if (e.CommandName.Equals("DeselectPatient"))
            {
                try
                {
                    ViewState["GridViewPatientSelectedPatientNRIC"] = null;
                    ViewState["GridViewRecordSelectedIDs"]          = null;
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error De-selecting Patient.');", true);
                }
            }
            else if (e.CommandName.Equals("ViewDiagnosis"))
            {
                try
                {
                    List <PatientDiagnosis> patientDiagnoses = therapistBLL.GetPatientDiagnoses(nric);
                    labelDiagnosisName.Text = nric;

                    ViewState["GridViewPatientDiagnoses"] = patientDiagnoses;
                    GridViewPatientDiagnoses.DataSource   = patientDiagnoses;
                    GridViewPatientDiagnoses.DataBind();

                    UpdatePanelDiagnosisView.Update();
                    ScriptManager.RegisterStartupScript(this, GetType(), "Open Diagnosis Modal", "$('#modalDiagnosisView').modal('show');", true);
                }
                catch
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Opening Diagnosis Modal.');", true);
                }
            }

            Bind_GridViewPatientAndRecord();
        }