private void NopsCalcForm_Load(object sender, EventArgs e) { // Set window size based on saved values if (Properties.Settings.Default.NopsCalcForm_Location.X > 0 && Properties.Settings.Default.NopsCalcForm_Location.Y > 0) { this.Location = Properties.Settings.Default.NopsCalcForm_Location; } // Loads data into the 'waterskiDataSet.ListAgeDivisions' table. AgeGroupDropdownList myAgeGroupList = null; String curSanctionNum = Properties.Settings.Default.AppSanctionNum; DataTable curTourDataTable = getTourData(curSanctionNum); if (curTourDataTable.Rows.Count > 0) { DataRow curTourRow = curTourDataTable.Rows[0]; myAgeGroupList = new AgeGroupDropdownList(curTourRow); } else { myAgeGroupList = new AgeGroupDropdownList(null); } listAgeDivisionsComboBox.DataSource = myAgeGroupList.DropdownList; // Loads data into the 'waterskiDataSet.NopsData' table. myFilterCommand = "AgeGroup = '" + listAgeDivisionsComboBox.SelectedValue + "'"; }
private void loadEventGroupListFromData() { AgeGroupDropdownList curAgeGroupDropdownList = new AgeGroupDropdownList(myTourRow); ArrayList curDropdownList = new ArrayList(); ArrayList curAgeGroupList = curAgeGroupDropdownList.DropdownList; curDropdownList.Add("All"); for (int idx = 0; idx < curAgeGroupList.Count; idx++) { curDropdownList.Add(curAgeGroupList[idx]); } EventGroupList.DataSource = curDropdownList; }
public ExportScorebookPublishFmt() { // Retrieve data from database mySanctionNum = Properties.Settings.Default.AppSanctionNum; if (mySanctionNum == null) { MessageBox.Show("An active tournament must be selected from the Administration menu Tournament List option"); } else { if (mySanctionNum.Length < 6) { MessageBox.Show("An active tournament must be selected from the Administration menu Tournament List option"); } else { CalcScoreSummary curCalcSummary = new CalcScoreSummary(); DataTable curTourDataTable = getTourData(mySanctionNum); if (curTourDataTable.Rows.Count > 0) { myTourRow = curTourDataTable.Rows[0]; myTourRules = (String)myTourRow["Rules"]; myTourClass = myTourRow["Class"].ToString().Trim(); int curSlalomRounds = 0, curTrickRounds = 0, curJumpRounds = 0; try { curSlalomRounds = Convert.ToInt16(myTourRow["SlalomRounds"].ToString()); } catch { curSlalomRounds = 0; } try { curTrickRounds = Convert.ToInt16(myTourRow["TrickRounds"].ToString()); } catch { curTrickRounds = 0; } try { curJumpRounds = Convert.ToInt16(myTourRow["JumpRounds"].ToString()); } catch { curJumpRounds = 0; } if (curSlalomRounds > myTourRounds) { myTourRounds = curSlalomRounds; } if (curTrickRounds > myTourRounds) { myTourRounds = curTrickRounds; } if (curJumpRounds > myTourRounds) { myTourRounds = curJumpRounds; } AgeGroupDropdownList curAgeGroupDropdownList = new AgeGroupDropdownList(myTourRow); myAgeDivDataTable = curAgeGroupDropdownList.AgeDivDataTable; } } } }
private void LoadDataButton_Click(object sender, EventArgs e) { bool curLoadActive = true; String curMethodName = "Tournament:TourDivOrder:LoadDataButton"; AgeGroupDropdownList curAgeGroupDropdownList = new AgeGroupDropdownList(myTourRow); String curMsg = ""; bool curReturn = true; int rowsProc = 0; String curEvent = "Slalom"; if (slalomButton.Checked) { curEvent = "Slalom"; } else if (trickButton.Checked) { curEvent = "Trick"; } else if (jumpButton.Checked) { curEvent = "Jump"; } try { if (myTourDivDataTable.Rows.Count > 0) { String dialogMsg = "You have existing division order data!" + "\n Do you want to reset the data?"; DialogResult msgResp = MessageBox.Show(dialogMsg, "Change Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if (msgResp == DialogResult.OK) { curLoadActive = true; } else { curLoadActive = false; } } if (curLoadActive) { try { StringBuilder curSqlStmt = new StringBuilder("Delete DivOrder WHERE SanctionId = '" + mySanctionNum + "' AND Event = '" + curEvent + "'"); rowsProc = DataAccess.ExecuteCommand(curSqlStmt.ToString()); Log.WriteFile(curMethodName + ":Rows=" + rowsProc.ToString() + " " + curSqlStmt.ToString()); int curInsertCount = 0; String curSqlStmtInsert = "Insert Into DivOrder ( " + "SanctionId, Event, AgeGroup, RunOrder, LastUpdateDate " + ") Values ( '" + mySanctionNum + "', '" + curEvent + "'"; foreach (DataRow curRow in curAgeGroupDropdownList.AgeDivDataTable.Rows) { if (!(((String)curRow["Division"]).Equals("OF"))) { curSqlStmt = new StringBuilder(curSqlStmtInsert + ", '" + (String)curRow["Division"] + "'" + ", " + (((int)curRow["SortSeq"]) * 10).ToString() + ", getDate() )"); rowsProc = DataAccess.ExecuteCommand(curSqlStmt.ToString()); curInsertCount += rowsProc; } } Log.WriteFile(curMethodName + ":Rows=" + curInsertCount.ToString() + " " + curSqlStmtInsert); MessageBox.Show("Added rows=" + curInsertCount.ToString() + " to division order"); } catch (Exception excp) { curReturn = false; curMsg = "Error attempting to load division data \n" + excp.Message; MessageBox.Show(curMsg); Log.WriteFile(curMethodName + curMsg); } finally { navRefresh_Click(null, null); } } } catch (Exception excp) { curMsg = "Error attempting to load division data \n" + excp.Message; MessageBox.Show(curMsg); Log.WriteFile(curMethodName + curMsg); } }