private void RefreshResearcherModal(string nric) { Classes.Entity.Account account = accountBLL.GetResearcherInformation(nric); labelResearcherNRIC.Text = nric; inputResearcherJobTitle.Value = account.researcherJobTitle; inputResearcherDepartment.Value = account.researcherDepartment; UpdatePanelResearcher.Update(); }
private void RefreshTherapistModal(string nric) { Classes.Entity.Account account = accountBLL.GetTherapistInformation(nric); labelTherapistNRIC.Text = nric; inputTherapistJobTitle.Value = account.therapistJobTitle; inputTherapistDepartment.Value = account.therapistDepartment; UpdatePanelTherapist.Update(); }
private void RefreshStatusModal(string nric) { Classes.Entity.Account account = accountBLL.GetStatusInformation(nric); labelStatusNRIC.Text = nric; inputStatusCreateTime.Value = account.createTime.ToString(); inputStatusLastLogin.Value = account.lastFullLogin.ToString(); if (account.status == 0) { LinkButtonStatusDisable.CssClass = ("btn disabled"); LinkButtonStatusEnable.CssClass = ("btn btn-success"); //TODO: For Dev Only //LinkButtonStatusEnableWoMFA.CssClass = ("btn btn-warning"); } else if (account.status == 1) { LinkButtonStatusDisable.CssClass = ("btn btn-danger"); LinkButtonStatusEnable.CssClass = ("btn disabled"); //TODO: For Dev Only //LinkButtonStatusEnableWoMFA.CssClass = ("btn btn-warning"); } //else if (account.status == 2) //{ // LinkButtonStatusDisable.CssClass = ("btn btn-danger"); // LinkButtonStatusEnable.CssClass = ("btn btn-success"); // //TODO: For Dev Only // LinkButtonStatusEnableWoMFA.CssClass = ("btn disabled"); //} LabelMFATokenStatus.Text = account.MFATokenStatus; LabelMFADeviceStatus.Text = account.MFADeviceStatus; TextboxMFATokenIDUpdate.Text = string.Empty; TextboxMFADeviceIDUpdate.Text = string.Empty; if (account.patientStatus == 0) { LabelRolePatient.Text = "Disabled"; LinkButtonRolePatientDisable.CssClass = "btn btn-sm btn-danger float-right disabled"; LinkButtonRolePatientEnable.CssClass = "btn btn-sm btn-success float-right mr-2"; } else if (account.patientStatus == 1) { LabelRolePatient.Text = "Enabled"; LinkButtonRolePatientDisable.CssClass = "btn btn-sm btn-danger float-right"; LinkButtonRolePatientEnable.CssClass = "btn btn-sm btn-success float-right disabled mr-2"; } if (account.therapistStatus == 0) { LabelRoleTherapist.Text = "Disabled"; LinkButtonRoleTherapistDisable.CssClass = "btn btn-sm btn-danger float-right disabled"; LinkButtonRoleTherapistEnable.CssClass = "btn btn-sm btn-success float-right mr-2"; } else if (account.therapistStatus == 1) { LabelRoleTherapist.Text = "Enabled"; LinkButtonRoleTherapistDisable.CssClass = "btn btn-sm btn-danger float-right"; LinkButtonRoleTherapistEnable.CssClass = "btn btn-sm btn-success float-right disabled mr-2"; } if (account.researcherStatus == 0) { LabelRoleResearcher.Text = "Disabled"; LinkButtonRoleResearcherDisable.CssClass = "btn btn-sm btn-danger float-right disabled"; LinkButtonRoleResearcherEnable.CssClass = "btn btn-sm btn-success float-right mr-2"; } else if (account.researcherStatus == 1) { LabelRoleResearcher.Text = "Enabled"; LinkButtonRoleResearcherDisable.CssClass = "btn btn-sm btn-danger float-right"; LinkButtonRoleResearcherEnable.CssClass = "btn btn-sm btn-success float-right disabled mr-2"; } if (account.adminStatus == 0) { LabelRoleAdmin.Text = "Disabled"; LinkButtonRoleAdminDisable.CssClass = "btn btn-sm btn-danger float-right disabled"; LinkButtonRoleAdminEnable.CssClass = "btn btn-sm btn-success float-right mr-2"; } else if (account.adminStatus == 1) { LabelRoleAdmin.Text = "Enabled"; LinkButtonRoleAdminDisable.CssClass = "btn btn-sm btn-danger float-right"; LinkButtonRoleAdminEnable.CssClass = "btn btn-sm btn-success float-right disabled mr-2"; } UpdatePanelStatus.Update(); }
//protected void GridViewAccounts_RowDeleting(object sender, GridViewDeleteEventArgs e) //{ // string nric = GridViewAccounts.DataKeys[e.RowIndex].Values["nric"].ToString(); // try // { // accountBLL.DeleteAccount(nric); // ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['success']('Account, \"" + nric + "\", was Deleted successfully');", true); // } // catch // { // ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error occured when Deleting an Account');", true); // } // GridViewAccounts.EditIndex = -1; // string term = TextboxSearch.Text.Trim().ToLower(); // Bind_GridViewAccounts(term); //} protected void GridViewAccounts_RowCommand(object sender, GridViewCommandEventArgs e) { string nric = e.CommandArgument.ToString(); if (e.CommandName.Equals("ViewPersonal")) { try { Classes.Entity.Account account = accountBLL.GetPersonalInformation(nric); labelPersonalNRIC.Text = nric; inputPersonalNRIC.Value = account.nric; inputPersonalDoB.Value = account.dateOfBirth.ToString("dd/MM/yyyy"); inputPersonalFirstName.Value = account.firstName; inputPersonalLastName.Value = account.lastName; inputPersonalCountryofBirth.Value = account.countryOfBirth; inputPersonalNationality.Value = account.nationality; inputPersonalSex.Value = account.sex; inputPersonalGender.Value = account.gender; inputPersonalMaritalStatus.Value = account.maritalStatus; UpdatePanelPersonal.Update(); ScriptManager.RegisterStartupScript(this, GetType(), "Open Personal Modal", "$('#modalPersonal').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Personal Information of " + nric + ".');", true); } } if (e.CommandName.Equals("ViewContact")) { try { Classes.Entity.Account account = accountBLL.GetContactInformation(nric); labelContactNRIC.Text = nric; inputAddress.Value = account.address; inputPostalCode.Value = account.addressPostalCode; inputEmailAddress.Value = account.email; inputContactNumber.Value = account.contactNumber; UpdatePanelContact.Update(); ScriptManager.RegisterStartupScript(this, GetType(), "Open Contact Modal", "$('#modalContact').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Contact Information of " + nric + ".');", true); } } if (e.CommandName.Equals("ViewPatient")) { try { Classes.Entity.Account account = accountBLL.GetPatientInformation(nric); // Just info labelPatientNRIC.Text = nric; inputPatientNokName.Value = account.nokName; inputPatientNokContact.Value = account.nokContact; //Emergency ViewState["GridViewAccountsSelectedNRIC"] = nric; string therapistTerm = TextboxSearchTherapist.Text.Trim().ToLower(); Bind_GridViewTherapists(nric, therapistTerm); Bind_GridViewTherapists2(nric); UpdatePanelPatient.Update(); ScriptManager.RegisterStartupScript(this, GetType(), "Open Patient Modal", "$('#modalPatient').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Patient Information of " + nric + ".');", true); } } if (e.CommandName.Equals("ViewTherapist")) { try { ViewState["GridViewAccountsSelectedNRIC"] = nric; inputTherapistJobTitle.Attributes.Add("class", "form-control form-control-sm"); inputTherapistDepartment.Attributes.Add("class", "form-control form-control-sm"); spanMessageTherapistDetailsUpdate.Visible = false; RefreshTherapistModal(nric); ScriptManager.RegisterStartupScript(this, GetType(), "Open Therapist Modal", "$('#modalTherapist').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Therapist Information of " + nric + ".');", true); } } if (e.CommandName.Equals("ViewResearcher")) { try { ViewState["GridViewAccountsSelectedNRIC"] = nric; inputResearcherJobTitle.Attributes.Add("class", "form-control form-control-sm"); inputResearcherDepartment.Attributes.Add("class", "form-control form-control-sm"); spanMessageResearcherUpdate.Visible = false; RefreshResearcherModal(nric); ScriptManager.RegisterStartupScript(this, GetType(), "Open Researcher Modal", "$('#modalResearcher').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Researcher Information of " + nric + ".');", true); } } if (e.CommandName.Equals("ViewStatus")) { try { ViewState["GridViewAccountsSelectedNRIC"] = nric; RefreshStatusModal(nric); ScriptManager.RegisterStartupScript(this, GetType(), "Open Status Modal", "$('#modalStatus').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error viewing Status Information of " + nric + ".');", true); } } string term = TextboxSearch.Text.Trim().ToLower(); Bind_GridViewAccounts(term); }