예제 #1
0
        protected void Bind_GridViewRecords()
        {
            List <Record> records = recordBLL.GetRecords();

            ViewState["GridViewRecords"] = records;
            GridViewRecords.DataSource   = records;
            GridViewRecords.DataBind();
            UpdatePanelRecords.Update();
        }
        protected void GridViewPatientAnonymised_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("ViewRecords"))
            {
                try
                {
                    string recordIDsString = e.CommandArgument.ToString();

                    List <long>   recordIDs = recordIDsString.Split(',').Select(long.Parse).ToList();
                    List <Record> records   = dataBLL.GetRecords(recordIDs);

                    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
                {
                    string patientId = e.CommandArgument.ToString();

                    List <PatientDiagnosis> patientDiagnoses = dataBLL.GetPatientDiagnoses(patientId);

                    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);
                }
            }
        }
        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();
        }