protected override void Page_Load(object sender, EventArgs e) { // only Admin Users if (base.UserType != ProtocolMgmtUsers.ProtocolAdmin) { Response.End(); } ErrorText.Text = ""; if (!string.IsNullOrEmpty(ExportMode)) { if (ExportMode == "export") { ExportPanel.Visible = true; } else if (ExportMode == "import") { ImportPanel.Visible = true; // build protocol selection if (!Page.IsPostBack) { // build protocol list var emptyProtocol = new { Title = "--- Create New Protocol ---", Value = "" }; var protocols = from row in Caisis.DataAccess.ProtocolMgmtDa.GetAllProtocols().AsEnumerable() let id = row[Protocol.ProtocolId].ToString() let num = row[Protocol.ProtocolNum].ToString() let title = row[Protocol.ProtocolTitle].ToString() let description = string.Format("{0} - {1}", num, title) select new { Title = PageUtil.GetTrimmedDescription(description, 40), Value = id }; var protocolsList = protocols.ToList(); protocolsList.Insert(0, emptyProtocol); ProtocolSelection.DataSource = protocolsList; ProtocolSelection.DataBind(); } } else if (IsPreviewMode) { ExportPreviewPanel.Visible = true; ExportProtocolPreviewPanel.Visible = IsExportProtocolMode; } } if (!Page.IsPostBack) { // validate protocol id if (!string.IsNullOrEmpty(QueryProtocolId)) { int protocolId = int.Parse(QueryProtocolId); if (IsExportProtocolMode) { if (IsPreviewMode) { // build info BuildProtocolExportInfo(); PreviewExportProtocol(protocolId); } else { ExportProtocol(protocolId); } return; } else if (IsExportPatientsMode) { // set export state if (CanExportPatients()) { ExportProtocolPatientsBtn.Enabled = true; ExportProtocolPatientsBtn.Text = "Export Protocol Patients"; } else { ExportProtocolPatientsBtn.Enabled = false; ExportProtocolPatientsBtn.Text = "Export Not Enabled for this Trial"; } if (IsPreviewMode) { // build info BuildPatientExportInfo(); BuildExportTableFilters(); PreviewExportProtocolPatients(protocolId); } else { bool unmasked = UnmaskedCheck.Checked; ExportProtocolPatients(protocolId, false, unmasked); } return; } } BuildProtocols(); } }