protected void tblHoursSelected_Load(object sender, EventArgs e) { blocks_reserved = 0; SqlConnection dbConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["AWS_SQL"].ConnectionString); dbConnection.Open(); string advCheck = "select oh.officeHoursId, (o.buildingId + ' ' + o.roomId + o.suiteId) as office, oh.startTime " + "from OfficeHours oh " + "join Advisor a on oh.advisorId = a.advisorId " + "join Office o on oh.officeId = o.officeId " + "where oh.studentId = '" + (int)Session["id"] + "' " + "and a.studentId = '" + (int)Session["id"] + "'"; SqlCommand advCommand = new SqlCommand(advCheck, dbConnection); SqlDataReader advReader = advCommand.ExecuteReader(); while (advReader.Read()) { DisplayRow dr = new DisplayRow((int)advReader["officeHoursId"], (DateTime)advReader["startTime"], (string)advReader["office"]); tblHoursSelected.Rows.Add(dr); blocks_reserved += 1; } advReader.Close(); dbConnection.Close(); }
protected void btnRemoveSelected_Click(object sender, EventArgs e) { string strOfficeHoursSelected = ""; TableRow[] trRows = new TableRow[tblHoursSelected.Rows.Count]; tblHoursSelected.Rows.CopyTo(trRows, 0); foreach (TableRow tr in trRows) { if (tr is DisplayRow) { DisplayRow dr = (DisplayRow)tr; if (dr.isSelected()) { strOfficeHoursSelected += ",'" + dr.getId() + "'"; } } } if (strOfficeHoursSelected.Length > 0) { SqlConnection dbConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["AWS_SQL"].ConnectionString); dbConnection.Open(); string advCheck = "update officehours " + "set studentId = NULL, " + "note = NULL " + "where officehoursid in (" + strOfficeHoursSelected.Substring(1) + ")"; SqlCommand updateHours = new SqlCommand(advCheck, dbConnection); updateHours.ExecuteNonQuery(); dbConnection.Close(); Response.Redirect("appointment.aspx"); } }
internal GroupResult(ResultsPerGroupForm form, DisplayRow displayRow, GroupKey groupKey, ResultData resultData) { _form = form; _displayRow = displayRow; _groupKey = groupKey; _resultData = resultData; }
protected void btnSelectAll_Click(object sender, EventArgs e) { bool blnChanged = false; foreach (TableRow tr in tblHours.Rows) { if (tr is DisplayRow) { DisplayRow dr = (DisplayRow)tr; if (!dr.isSelected()) { dr.select(true); blnChanged = true; } } } if (!blnChanged) { foreach (TableRow tr in tblHours.Rows) { if (tr is DisplayRow) { DisplayRow dr = (DisplayRow)tr; dr.select(false); } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { string strOfficeHoursSelected = ""; TableRow[] trRows = new TableRow[tblHours.Rows.Count]; tblHours.Rows.CopyTo(trRows, 0); int counter = 0; string office = ""; ArrayList lstDT = new ArrayList(); foreach (TableRow tr in trRows) { litAlert.Text += 1; litAlert.Text += "Rows: " + tblHours.Rows.Count; if (tr is DisplayRow) { litAlert.Text += 2; DisplayRow dr = (DisplayRow)tr; if (dr.isSelected()) { counter += 1; lstDT.Add(dr.getDate()); office = dr.office; strOfficeHoursSelected += ",'" + dr.getId().ToString() + "'"; } } } if (strOfficeHoursSelected.Length > 0 && blocks_reserved + counter < 3) { SqlConnection dbConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["AWS_SQL"].ConnectionString); dbConnection.Open(); string advCheck = "update officehours " + "set studentId = '" + (int)Session["id"] + "', " + "note = '" + txtNote.Text + "' " + "where officehoursid in (" + strOfficeHoursSelected.Substring(1) + ")"; SqlCommand updateHours = new SqlCommand(advCheck, dbConnection); updateHours.ExecuteNonQuery(); dbConnection.Close(); litAlert.Text = advCheck; email((string)Session["email"], "You have reserved an advising apointment!", office, lstDT.ToArray()); Response.Redirect("appointment.aspx"); } else { litAlert.Text = "Please select up to two time slots for advising. You have " + (2 - blocks_reserved).ToString() + " left. "; if (blocks_reserved > 0) { litAlert.Text += "If you want to reserve a different time slot from what you've already selected, please remove those times from the first table. "; } } }
protected void btnDeleteSelected_Click(object sender, EventArgs e) { SqlConnection dbConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["AWS_SQL"].ConnectionString); dbConnection.Open(); foreach (TableRow tr in tblHours.Rows) { if (tr is DisplayRow) { DisplayRow dr = (DisplayRow)tr; if (dr.isSelected()) { string delete = "DELETE officeHours WHERE officeHoursId = '" + dr.getId() + "'"; SqlCommand deleteHours = new SqlCommand(delete, dbConnection); deleteHours.ExecuteNonQuery(); } } } dbConnection.Close(); Response.Redirect("hours.aspx"); }
internal GroupResult(ResultsPerGroupForm form, DisplayRow displayRow, GroupKey groupKey, ResultData resultData) { _form = form; _displayRow = displayRow; _groupKey = groupKey; _resultData = resultData; }
private void btnRequery_Click(object sender, EventArgs e) { var halfLifeCalculator = new HalfLifeCalculator(Workspace, HalfLifeSettings) { ByFile = cbxGroupByFile.Checked, }; using (var longWaitDialog = new LongWaitDialog(TopLevelControl, "Calculating Half Lives")) { var longOperationBroker = new LongOperationBroker(halfLifeCalculator.Run, longWaitDialog); if (!longOperationBroker.LaunchJob()) { return; } } bool byCohort = cbxGroupByCohort.Checked; bool byTimePoint = cbxGroupByTimePoint.Checked; bool bySample = cbxGroupBySample.Checked; bool byFile = cbxGroupByFile.Checked; var displayRows = new List<DisplayRow>(); foreach (var resultRow in halfLifeCalculator.ResultRows) { var displayRow = new DisplayRow(halfLifeCalculator, resultRow); var rowDatasByCohort = new Dictionary<GroupKey, List<HalfLifeCalculator.ProcessedRowData>>(); foreach (var halfLife in resultRow.HalfLives) { if (resultRow.HalfLives.Count > 1 && string.IsNullOrEmpty(halfLife.Key) != byCohort) { continue; } foreach (var rowData in halfLife.Value.FilteredRowDatas) { GroupKey cohortKey = new GroupKey( byCohort ? rowData.RawRowData.MsDataFile.Cohort : null, byTimePoint ? rowData.RawRowData.MsDataFile.TimePoint : null, bySample ? rowData.RawRowData.MsDataFile.Sample : null, byFile ? rowData.RawRowData.MsDataFile.Name : null); List<HalfLifeCalculator.ProcessedRowData> list; if (!rowDatasByCohort.TryGetValue(cohortKey, out list)) { list = new List<HalfLifeCalculator.ProcessedRowData>(); rowDatasByCohort.Add(cohortKey, list); } list.Add(rowData); } } foreach (var cohortRowDatas in rowDatasByCohort) { displayRow.Results.Add(cohortRowDatas.Key, new GroupResult(this, displayRow, cohortRowDatas.Key, new ResultData(cohortRowDatas.Value))); } displayRows.Add(displayRow); } var viewInfo = bindingSource1.ViewInfo; var dataSchema = new TopographDataSchema(Workspace); if (viewInfo == null || "default" == viewInfo.Name) { viewInfo= new ViewInfo(ColumnDescriptor.RootColumn(dataSchema, typeof(DisplayRow)), GetDefaultViewSpec(halfLifeCalculator.ByProtein)); } var viewContext = new TopographViewContext(Workspace, typeof (DisplayRow), displayRows, GetDefaultViewSpec(halfLifeCalculator.ByProtein)); bindingSource1.SetViewContext(viewContext, viewInfo); bindingSource1.RowSource = displayRows; dataGridViewSummary.Rows.Clear(); SetSummary("Tracer %", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values .Select(cohortResult=>cohortResult.GetResultData().TracerPercentByArea))); SetSummary("Precursor Enrichment", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values .Select(cohortResult=>cohortResult.GetResultData().IndPrecursorEnrichment))); SetSummary("Turnover", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values .Select(cohortResult=>cohortResult.GetResultData().IndTurnover))); SetSummary("Area Under Curve", displayRows.Select(dr=>dr.Results).SelectMany(r=>r.Values .Select(cohortResult=>cohortResult.GetResultData().AreaUnderCurve))); }
private void btnRequery_Click(object sender, EventArgs e) { var halfLifeCalculator = new HalfLifeCalculator(Workspace, HalfLifeSettings) { ByFile = cbxGroupByFile.Checked, }; using (var longWaitDialog = new LongWaitDialog(TopLevelControl, "Calculating Half Lives")) { var longOperationBroker = new LongOperationBroker(halfLifeCalculator.Run, longWaitDialog); if (!longOperationBroker.LaunchJob()) { return; } } bool byCohort = cbxGroupByCohort.Checked; bool byTimePoint = cbxGroupByTimePoint.Checked; bool bySample = cbxGroupBySample.Checked; bool byFile = cbxGroupByFile.Checked; var displayRows = new List <DisplayRow>(); foreach (var resultRow in halfLifeCalculator.ResultRows) { var displayRow = new DisplayRow(halfLifeCalculator, resultRow); var rowDatasByCohort = new Dictionary <GroupKey, List <HalfLifeCalculator.ProcessedRowData> >(); foreach (var halfLife in resultRow.HalfLives) { if (resultRow.HalfLives.Count > 1 && string.IsNullOrEmpty(halfLife.Key) != byCohort) { continue; } foreach (var rowData in halfLife.Value.FilteredRowDatas) { GroupKey cohortKey = new GroupKey( byCohort ? rowData.RawRowData.MsDataFile.Cohort : null, byTimePoint ? rowData.RawRowData.MsDataFile.TimePoint : null, bySample ? rowData.RawRowData.MsDataFile.Sample : null, byFile ? rowData.RawRowData.MsDataFile.Name : null); List <HalfLifeCalculator.ProcessedRowData> list; if (!rowDatasByCohort.TryGetValue(cohortKey, out list)) { list = new List <HalfLifeCalculator.ProcessedRowData>(); rowDatasByCohort.Add(cohortKey, list); } list.Add(rowData); } } foreach (var cohortRowDatas in rowDatasByCohort) { displayRow.Results.Add(cohortRowDatas.Key, new GroupResult(this, displayRow, cohortRowDatas.Key, new ResultData(cohortRowDatas.Value))); } displayRows.Add(displayRow); } var viewInfo = bindingSource1.ViewInfo; var dataSchema = new TopographDataSchema(Workspace); if (viewInfo == null || "default" == viewInfo.Name) { viewInfo = new ViewInfo(ColumnDescriptor.RootColumn(dataSchema, typeof(DisplayRow)), GetDefaultViewSpec(halfLifeCalculator.ByProtein)); } var viewContext = new TopographViewContext(Workspace, typeof(DisplayRow), displayRows, GetDefaultViewSpec(halfLifeCalculator.ByProtein)); bindingSource1.SetViewContext(viewContext, viewInfo); bindingSource1.RowSource = displayRows; dataGridViewSummary.Rows.Clear(); SetSummary("Tracer %", displayRows.Select(dr => dr.Results).SelectMany(r => r.Values .Select(cohortResult => cohortResult.GetResultData().TracerPercentByArea))); SetSummary("Precursor Enrichment", displayRows.Select(dr => dr.Results).SelectMany(r => r.Values .Select(cohortResult => cohortResult.GetResultData().IndPrecursorEnrichment))); SetSummary("Turnover", displayRows.Select(dr => dr.Results).SelectMany(r => r.Values .Select(cohortResult => cohortResult.GetResultData().IndTurnover))); SetSummary("Area Under Curve", displayRows.Select(dr => dr.Results).SelectMany(r => r.Values .Select(cohortResult => cohortResult.GetResultData().AreaUnderCurve))); }