protected void btnGetCounts_Click(object sender, EventArgs e) { UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelChk.FindControl("study1"); string studies = p.GetChecked_as_CSV(); SQL_utils sql = new SQL_utils("backend"); List <SqlParameter> ps = new List <SqlParameter>(); ps.Add(sql.CreateParam("datebeg", txtD1.Text, "date")); ps.Add(sql.CreateParam("dateend", txtD2.Text, "date")); ps.Add(sql.CreateParam("studies", studies, "text")); DataTable dt = sql.DataTable_from_ProcName("spTracking_Sessions_Counts", ps); gv.DataSource = dt; gv.DataBind(); if (studies.Contains("1076") | studies.Contains("1077")) { List <SqlParameter> psTadpole = new List <SqlParameter>(); psTadpole.Add(sql.CreateParam("datebeg", txtD1.Text, "date")); psTadpole.Add(sql.CreateParam("dateend", txtD2.Text, "date")); DataTable dtTadpole = sql.DataTable_from_ProcName("spTracking_Sessions_Counts_TadpoleTX_hrs", psTadpole); gvTadpole.DataSource = dtTadpole; gvTadpole.DataBind(); } }
protected void btnGetAddresses_Click(object sender, EventArgs e) { UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelChk.FindControl("study1"); string studies = p.GetChecked_as_CSV(); SQL_utils sql = new SQL_utils("backend"); List <SqlParameter> ps = new List <SqlParameter>(); ps.Add(sql.CreateParam("studies", studies, "text")); DataTable dt = sql.DataTable_from_ProcName("spTracking_Subj_AddressList", ps); dt.TableName = "Subject Addresses"; string datenow = DateTime.Now.Year.ToString() + ((DateTime.Now.Month < 10) ? "0" : "") + DateTime.Now.Month.ToString() + ((DateTime.Now.Day < 10) ? "0" : "") + DateTime.Now.Day.ToString(); string hrminnow = ((DateTime.Now.Hour < 10) ? "0" : "") + DateTime.Now.Hour.ToString() + ((DateTime.Now.Minute < 10) ? "0" : "") + DateTime.Now.Minute.ToString(); string filename = "UWAC_Subject_Addresses_" + datenow + "_" + hrminnow; //TODO SpreadsheetGearUtils.SaveDataTableToExcel(dt, filename, "xlsx"); }
protected void Process_Button_Command(object sender, CommandEventArgs e) { if (e.CommandName == "LoadData") { int DatStructureInfo_isOK = LoadDataStructureInfo(shortName); if (DatStructureInfo_isOK == 0) { // UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelStudymeas.FindControlRecursive("smID"); try { UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelStudymeas.FindControlRecursive("studymeasID"); string studymeasIDs = p.GetChecked_as_CSV(); if (studymeasIDs == "") { //string message = "alert('Please choose which study measures to include.');"; //ScriptManager.RegisterClientScriptBlock(sender as Control, this.GetType(), "alert", message, true); lblPleaseSelect.Visible = true; } else { lblPleaseSelect.Visible = false; LoadNDARview(shortName, studymeasIDs); btnSaveNDARCSV.Visible = true; if (chkShowSQLsyntax.Checked) { string sqlout = NDAR.GetSQL_for_NDAR_view(shortName, Master.Master_studyID, studymeasIDs); lblSQLsyntax.Text = "<b><u>SQL syntax for creating NDAR data for '" + shortName + "':</u></b><br/><br/>" + sqlout; } } } catch (Exception) { } } } }
protected void btnSaveNDARCSV_Click(object sender, EventArgs e) { UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelStudymeas.FindControlRecursive("studymeasID"); string studymeasIDs = p.GetChecked_as_CSV(); string shortName = Request.QueryString["shortName"]; int studyID = sql.GetUserStudyID(); string studyname = sql.GetUserStudyName(); string IDexclude = txtIDexclude.Text; DataTable dt = NDAR.GetNDAR_view(shortName, studyID, 0, false, IDexclude, studymeasIDs); dt.TableName = shortName; string now = DateTime.Now.ToString("yyyyMMdd__HH_mm"); string filename = studyname + "_" + shortName + "_" + now; SpreadsheetGearUtils.SaveDataTableToFile(dt, filename, "csv", true); }