protected void Bind_GridViewRecordDiagnoses() { long recordID = Convert.ToInt64(ViewState["GridViewRecordsSelectedRecord"]); Record record = recordBLL.GetRecord(recordID); labelRecordNameDiagnosis.Text = record.title; List <RecordDiagnosis> recordDiagnoses = recordBLL.GetRecordDiagnoses(recordID); ViewState["GridViewRecordDiagnoses"] = recordDiagnoses; GridViewRecordDiagnoses.DataSource = recordDiagnoses; GridViewRecordDiagnoses.DataBind(); UpdatePanelRecordDiagnosisView.Update(); }
protected void Bind_GridViewRecordDiagnoses() { long recordID = Convert.ToInt64(ViewState["GridViewRecordsSelectedRecord"]); Record record = recordBLL.GetRecord(recordID); labelRecordNameDiagnosis.Text = record.title; List <RecordDiagnosis> recordDiagnoses = recordBLL.GetRecordDiagnoses(recordID); ViewState["GridViewRecordDiagnoses"] = recordDiagnoses; GridViewRecordDiagnoses.DataSource = recordDiagnoses; GridViewRecordDiagnoses.DataBind(); string term = TextboxSearchDiagnosisForRecord.Text.Trim().ToLower(); string patientNRIC = ViewState["GridViewPatientSelectedNRIC"].ToString(); List <Diagnosis> diagnoses = therapistBLL.GetDiagnoses(term, patientNRIC, recordDiagnoses); ViewState["GridViewRecordDiagnosesAdd"] = diagnoses; GridViewRecordDiagnosesAdd.DataSource = diagnoses; GridViewRecordDiagnosesAdd.DataBind(); UpdatePanelRecordDiagnosisView.Update(); }
protected void GridViewRecords_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("FileView")) { try { long recordID = Convert.ToInt64(e.CommandArgument); Record record = dataBLL.GetRecord(recordID); modalFileViewImage.Visible = false; modalFileViewVideo.Visible = false; modalFileViewPanelText.Visible = false; labelRecordName.Text = record.title; modalFileViewLabelFileName.Text = record.fileName + record.fileExtension; modalFileViewLabelFileSize.Text = record.fileSizeMegabytes; FileDownloadLinkviaModal.HRef = "~/Researcher/Download.ashx?record=" + record.id.ToString(); if (record.fileIsImage) { modalFileViewImage.Visible = true; modalFileViewImage.ImageUrl = "~/Researcher/Download.ashx?record=" + record.id; ScriptManager.RegisterStartupScript(this, GetType(), "Open View File Modal", "$('#modalRecords').modal('hide'); $('#modalFileView').modal('show');", true); } else if (record.fileIsText) { modalFileViewPanelText.Visible = true; if (record.IsFileSafe()) { string js = string.Empty; try { js = record.type.GetTextPlotJS(File.ReadAllText(record.fullpath)); ScriptManager.RegisterStartupScript(this, GetType(), "Open View File Modal", "$('#modalRecords').modal('hide'); $('#modalFileView').on('shown.bs.modal', function (e) { " + js + "}); $('#modalFileView').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View File Modal", "toastr['error']('Text file is not formatted incorrectly to be plotted. To view file, please download it.');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View File Modal", "toastr['error']('Error Occured in retrieving text file and opening File Modal.');", true); } } else if (record.fileIsVideo) { modalFileViewVideo.Visible = true; modalFileViewVideoSource.Attributes.Add("src", "~/Researcher/Download.ashx?record=" + record.id); ScriptManager.RegisterStartupScript(this, GetType(), "Open View File Modal", "$('#modalRecords').modal('hide'); $('#modalFileView').modal('show');", true); } UpdatePanelFileView.Update(); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View File Modal", "toastr['error']('Error Opening File Modal.');", true); } } else if (e.CommandName.Equals("RecordDiagnosisView")) { try { long recordID = Convert.ToInt64(e.CommandArgument); Record record = dataBLL.GetRecord(recordID); labelRecordNameDiagnosis.Text = record.title; List <RecordDiagnosis> recordDiagnoses = dataBLL.GetRecordDiagnoses(recordID); ViewState["GridViewRecordDiagnoses"] = recordDiagnoses; GridViewRecordDiagnoses.DataSource = recordDiagnoses; GridViewRecordDiagnoses.DataBind(); UpdatePanelRecordDiagnosisView.Update(); ScriptManager.RegisterStartupScript(this, GetType(), "Open View Record Diagnosis Modal", "$('#modalRecords').modal('hide'); $('#modalRecordDiagnosisView').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View Record Diagnosis Modal", "toastr['error']('Error Opening Record Diagnosis Modal.');", true); } } }
protected void GridViewRecords_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("FileView")) { try { long id = Convert.ToInt64(e.CommandArgument); Record record = recordBLL.GetRecord(id); modalFileViewImage.Visible = false; modalFileViewVideo.Visible = false; modalFileViewPanelText.Visible = false; labelRecordName.Text = record.title; modalFileViewLabelFileName.Text = record.fileName + record.fileExtension; modalFileViewLabelFileSize.Text = record.fileSizeMegabytes; if (record.fileIsImage) { modalFileViewImage.Visible = true; modalFileViewImage.ImageUrl = "~/Therapist/Download.ashx?record=" + record.id; ScriptManager.RegisterStartupScript(this, GetType(), "Open View File Modal", "$('#modalFileView').modal('show');", true); } else if (record.fileIsText) { modalFileViewPanelText.Visible = true; if (record.IsFileSafe()) { string js = string.Empty; try { js = record.type.GetTextPlotJS(File.ReadAllText(record.fullpath)); ScriptManager.RegisterStartupScript(this, GetType(), "Open View File Modal", "$('#modalFileView').on('shown.bs.modal', function (e) { " + js + "}); $('#modalFileView').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View File Modal", "toastr['error']('Text file is not formatted incorrectly to be plotted. To view file, please download it.');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View File Modal", "toastr['error']('Error Occured in retrieving text file and opening File Modal.');", true); } } else if (record.fileIsVideo) { modalFileViewVideo.Visible = true; modalFileViewVideoSource.Attributes.Add("src", "~/Therapist/Download.ashx?record=" + record.id); ScriptManager.RegisterStartupScript(this, GetType(), "Open View File Modal", "$('#modalFileView').modal('show');", true); } UpdatePanelFileView.Update(); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View File Modal", "toastr['error']('Error Opening File Modal.');", true); } } else if (e.CommandName.Equals("RecordDiagnosisView")) { try { long id = Convert.ToInt64(e.CommandArgument); ViewState["GridViewRecordsSelectedRecord"] = id; Bind_GridViewRecordDiagnoses(); UpdatePanelRecordDiagnosisView.Update(); ScriptManager.RegisterStartupScript(this, GetType(), "Open View Record Diagnosis Modal", "$('#modalRecords').modal('hide'); $('#modalRecordDiagnosisView').modal('show');", true); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "Error Opening View Record Diagnosis Modal", "toastr['error']('Error Opening Record Diagnosis Modal.');", true); } } else if (e.CommandName.Equals("SelectRecord")) { try { long id = Convert.ToInt64(e.CommandArgument); if (ViewState["GridViewRecordSelectedIDs"] != null) { HashSet <long> recordSelectedIDs = (HashSet <long>)ViewState["GridViewRecordSelectedIDs"]; recordSelectedIDs.Add(id); ViewState["GridViewRecordSelectedIDs"] = recordSelectedIDs; } else { HashSet <long> recordSelectedIDs = new HashSet <long>(); recordSelectedIDs.Add(id); ViewState["GridViewRecordSelectedIDs"] = recordSelectedIDs; } Bind_GridViewPatientAndRecord(); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error Selecting Record.');", true); } } else if (e.CommandName.Equals("DeselectRecord")) { try { long id = Convert.ToInt64(e.CommandArgument); if (ViewState["GridViewRecordSelectedIDs"] != null) { HashSet <long> recordSelectedIDs = (HashSet <long>)ViewState["GridViewRecordSelectedIDs"]; recordSelectedIDs.Remove(id); ViewState["GridViewRecordSelectedIDs"] = recordSelectedIDs; } else { ViewState["GridViewRecordSelectedIDs"] = new HashSet <long>(); } Bind_GridViewPatientAndRecord(); } catch { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "toastr['error']('Error De-Selecting Record.');", true); } } }