public ExportScoreBook()
        {
            // 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();

                    mySkierClassList = new ListSkierClass();
                    mySkierClassList.ListSkierClassLoad();

                    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; }
                        if ( myTourRounds == 1 ) { myTourRounds = 2; }
                    }
                }
            }
        }
        //Constructor
        public TourEventReg()
        {
            getTourInfo();

            mySkierClassList = new ListSkierClass();
            mySkierClassList.ListSkierClassLoad();

            myMatchCommand = "";
            myMatchCommandPrev = "";
            myMatchDialog = new ImportMatchDialogForm();

            if ( myTourRow == null ) {
                myAgeDivList = new AgeGroupDropdownList();
            } else {
                String curRules = (String)myTourRow["Rules"];
                myAgeDivList = new AgeGroupDropdownList( myTourRow );
            }
        }
        public Boolean exportBoatTimes( String inSanctionId )
        {
            String curMethodName = "exportBoatTimes";
            Boolean returnStatus = false;
            Int16 curRowCountSlalom = 0, curRowCountJump = 0;
            StreamWriter outBuffer = null;

            try {
                DataTable curTourDataTable = getTourData( inSanctionId );
                if ( curTourDataTable != null ) {
                    if ( curTourDataTable.Rows.Count > 0 ) {
                        myTourRow = curTourDataTable.Rows[0];
                        String curFilename = inSanctionId.Trim() + "BT.prn";
                        outBuffer = getExportFile( curFilename );
                    }
                    returnStatus = true;
                }
                if ( outBuffer != null ) {
                    mySkierClassList = new ListSkierClass();
                    mySkierClassList.ListSkierClassLoad();
                    myTourClass = myTourRow["Class"].ToString().ToUpper();
                    myClassCRow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'C'")[0];
                    myClassERow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'E'")[0];

                    curRowCountJump = exportBoatTimesJump( inSanctionId, outBuffer );

                    StringBuilder outLine = new StringBuilder( Environment.NewLine );
                    outBuffer.WriteLine( outLine.ToString() );

                    curRowCountSlalom = exportBoatTimesSlalom( inSanctionId, outBuffer );

                    outBuffer.Close();
                    MessageBox.Show( curRowCountJump + " jump rows found and written"
                        + "\n" + curRowCountSlalom + " slalom rows found and written" );
                }
            } catch ( Exception ex ) {
                MessageBox.Show( "Error: " + curMethodName
                    + "\n\nException: " + ex.Message
                );
            }

            return returnStatus;
        }
        private void ScoreEntry_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.SlalomEntry_Width > 0) {
                this.Width = Properties.Settings.Default.SlalomEntry_Width;
            }
            if (Properties.Settings.Default.SlalomEntry_Height > 0) {
                this.Height = Properties.Settings.Default.SlalomEntry_Height;
            }
            if (Properties.Settings.Default.SlalomEntry_Location.X > 0
                && Properties.Settings.Default.SlalomEntry_Location.Y > 0) {
                this.Location = Properties.Settings.Default.SlalomEntry_Location;
            }
            myTourProperties = TourProperties.Instance;
            mySortCommand = myTourProperties.RunningOrderSortSlalom;
            int curDelim = mySortCommand.IndexOf( "AgeGroup" );
            if (curDelim < 0) {
            } else if (curDelim > 0) {
                mySortCommand = mySortCommand.Substring( 0, curDelim ) + "DivOrder" + mySortCommand.Substring( curDelim + "AgeGroup".Length );
                myTourProperties.RunningOrderSortSlalom = mySortCommand;
            } else {
                mySortCommand = "DivOrder" + mySortCommand.Substring( "AgeGroup".Length );
                myTourProperties.RunningOrderSortSlalom = mySortCommand;
            }

            ResizeNarrow.Visible = false;
            ResizeNarrow.Enabled = false;
            ResizeWide.Visible = true;
            ResizeWide.Enabled = true;
            ResizeNarrow.Location = ResizeWide.Location;

            EventDelayReasonTextBox.Visible = false;
            EventDelayReasonLabel.Visible = false;
            StartTimerButton.Visible = false;
            PauseTimerButton.Visible = true;
            StartTimerButton.Location = PauseTimerButton.Location;

            String[] curList = { "SkierName", "Div", "DivOrder", "EventGroup", "RunOrder", "TeamCode", "EventClass", "RankingScore", "RankingRating", "HCapBase", "HCapScore", "Status" };
            sortDialogForm = new SortDialogForm();
            sortDialogForm.ColumnListArray = curList;

            filterDialogForm = new Common.FilterDialogForm();
            filterDialogForm.ColumnListArray = curList;

            rerideReasonDialogForm = new RerideReason();
            skierDoneReasonDialogForm = new SkierDoneReason();
            OptUpDialogForm = new SlalomOptUp();
            myCheckEventRecord = new CheckEventRecord();

            // Retrieve data from database
            mySanctionNum = Properties.Settings.Default.AppSanctionNum;
            Cursor.Current = Cursors.WaitCursor;

            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 {
                    //Retrieve selected tournament attributes
                    DataTable curTourDataTable = getTourData(mySanctionNum);
                    if (curTourDataTable.Rows.Count > 0) {
                        myTourRow = curTourDataTable.Rows[0];
                        myTourRules = (String)myTourRow["Rules"];
                        if ( myTourRules.ToLower().Equals( "ncwsa" ) ) {
                            TeamCode.Visible = true;
                        } else {
                            TeamCode.Visible = false;
                        }
                        if ( (byte)myTourRow["SlalomRounds"] > 0 ) {
                            mySortCommand = myTourProperties.RunningOrderSortSlalom;

                            EventRunInfoLabel.Text = "   Event Start:\n" + "   Event Delay:\n" + "Skiers, Passes:";
                            EventRunInfoData.Text = "";
                            EventRunPerfLabel.Text = "Event Duration:\n" + "Mins Per Skier:\n" + " Mins Per Pass:"******"";

                            //Load round selection list based on number of rounds specified for the tournament
                            roundSelect.SelectList_Load( myTourRow["SlalomRounds"].ToString(), roundSelect_Click );
                            roundActiveSelect.SelectList_LoadHorztl( myTourRow["SlalomRounds"].ToString(), roundActiveSelect_Click );
                            roundActiveSelect.RoundValue = "1";

                            //Load rope length selection list
                            SlalomLineSelect.SelectList_Load( SlalomLineSelect_Change );

                            //Load slalom speed selection list
                            SlalomSpeedSelect.SelectList_Load( SlalomSpeedSelect_Change );

                            mySkierClassList = new ListSkierClass();
                            mySkierClassList.ListSkierClassLoad();
                            scoreEventClass.DataSource = mySkierClassList.DropdownList;
                            scoreEventClass.DisplayMember = "ItemName";
                            scoreEventClass.ValueMember = "ItemValue";
                            myTourClass = myTourRow["Class"].ToString().ToUpper();
                            myClassCRow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'C'")[0];
                            myClassERow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'E'")[0];

                            //Determine required number of judges for event
                            myNumJudges = 5;
                            StringBuilder curSqlStmt = new StringBuilder( "" );
                            curSqlStmt.Append( "Select ListCode, CodeValue, MaxValue, MinValue FROM CodeValueList " );
                            curSqlStmt.Append( "Where ListName = 'SlalomJudgesNum' And ListCode = '" + myTourClass + "' ORDER BY SortSeq" );
                            DataTable curNumJudgesDataTable = getData( curSqlStmt.ToString() );
                            if (curNumJudgesDataTable.Rows.Count > 0) {
                                setShowByNumJudges( Convert.ToInt16( (Decimal)curNumJudgesDataTable.Rows[0]["MaxValue"] ));
                            } else {
                                setShowByNumJudges ( 1 );
                            }
                            if ( myNumJudges > 3 ) {
                                ClassC5JudgeCB.Visible = false;
                                ClassC5JudgeCB.Enabled = false;
                                ClassR3JudgeCB.Visible = true;
                                ClassR3JudgeCB.Enabled = true;
                                ClassR3JudgeCB.Checked = true;
                            } else {
                                ClassC5JudgeCB.Visible = true;
                                ClassC5JudgeCB.Enabled = true;
                                ClassR3JudgeCB.Visible = false;
                                ClassR3JudgeCB.Enabled = false;
                            }

                            //Retrieve and load boat times
                            curSqlStmt = new StringBuilder( "" );
                            curSqlStmt.Append( "SELECT ListCode, ListCodeNum, SortSeq, CodeValue, MinValue, MaxValue, CodeDesc " );
                            curSqlStmt.Append( "FROM CodeValueList WHERE ListName = 'SlalomBoatTime' ORDER BY SortSeq" );
                            myTimesDataTable = getData( curSqlStmt.ToString() );

                            //Retrieve list of approved tournament boats
                            getApprovedTowboats();
                            listApprovedBoatsDataGridView.Visible = false;
                            BoatSelectInfoLabel.Visible = false;

                            //Retrieve and load tournament event entries
                            loadEventGroupList( Convert.ToByte( roundActiveSelect.RoundValue ) );

                            if (ExportLiveWeb.LiveWebLocation.Length > 1) {
                                LiveWebLabel.Visible = true;
                            } else {
                                LiveWebLabel.Visible = false;
                            }

                        } else {
                            MessageBox.Show( "The slalom event is not defined for the active tournament" );
                        }
                    } else {
                        MessageBox.Show( "The active tournament is not properly defined.  You must select from the Administration menu Tournament List option" );
                    }
                }
            }
            Cursor.Current = Cursors.Default;
        }
        private void TourDivOrder_Load( object sender, EventArgs e )
        {
            if ( Properties.Settings.Default.DivOrder_Width > 0 ) {
                this.Width = Properties.Settings.Default.DivOrder_Width;
            }
            if ( Properties.Settings.Default.DivOrder_Height > 0 ) {
                this.Height = Properties.Settings.Default.DivOrder_Height;
            }
            if ( Properties.Settings.Default.DivOrder_Location.X > 0
                && Properties.Settings.Default.DivOrder_Location.Y > 0 ) {
                this.Location = Properties.Settings.Default.DivOrder_Location;
            }

            mySanctionNum = Properties.Settings.Default.AppSanctionNum;

            if ( mySanctionNum == null ) {
                MessageBox.Show( "An active tournament must be selected from the Administration menu Tournament List option" );
                //this.Close();
            } else {
                if ( mySanctionNum.Length < 6 ) {
                    MessageBox.Show( "An active tournament must be selected from the Administration menu Tournament List option" );
                    //this.Close();
                } else {
                    //Retrieve selected tournament attributes
                    DataTable curTourDataTable = getTourData();
                    if ( curTourDataTable.Rows.Count > 0 ) {
                        myTourRow = curTourDataTable.Rows[0];
                        myTourRules = (String)myTourRow["Rules"];
                        mySkierClass = myTourRow["Class"].ToString();
                        mySkierClassList = new ListSkierClass();
                        mySkierClassList.ListSkierClassLoad();

                        if ( myTourRow["SlalomRounds"] == DBNull.Value ) { myTourRow["SlalomRounds"] = 0; }
                        if ( myTourRow["TrickRounds"] == DBNull.Value ) { myTourRow["TrickRounds"] = 0; }
                        if ( myTourRow["JumpRounds"] == DBNull.Value ) { myTourRow["JumpRounds"] = 0; }
                        if ( Convert.ToInt16( myTourRow["SlalomRounds"] ) == 0 ) {
                            slalomButton.Visible = false;
                        }
                        if ( Convert.ToInt16( myTourRow["TrickRounds"] ) == 0 ) {
                            trickButton.Visible = false;
                        }
                        if ( Convert.ToInt16( myTourRow["JumpRounds"] ) == 0 ) {
                            jumpButton.Visible = false;
                        }

                        if ( slalomButton.Visible ) {
                            slalomButton.Checked = true;
                        } else if ( trickButton.Visible ) {
                            trickButton.Checked = true;
                        } else if ( jumpButton.Visible ) {
                            jumpButton.Checked = true;
                        }

                        myTourDivDataTable = getTourDivData();
                        loadDataView();
                    } else {
                        MessageBox.Show( "An active tournament must be selected from the Administration menu Tournament List option" );
                    }
                }
            }
            isDataModified = false;
        }
        private void JumpMeterSetup_Load( object sender, EventArgs e )
        {
            if (Properties.Settings.Default.JumpMeterSetup_Width > 0) {
                this.Width = Properties.Settings.Default.JumpMeterSetup_Width;
            }
            if (Properties.Settings.Default.JumpMeterSetup_Height > 0) {
                this.Height = Properties.Settings.Default.JumpMeterSetup_Height;
            }
            if (Properties.Settings.Default.JumpMeterSetup_Location.X > 0
                && Properties.Settings.Default.JumpMeterSetup_Location.Y > 0) {
                this.Location = Properties.Settings.Default.JumpMeterSetup_Location;
            }
            // Retrieve data from database
            mySanctionNum = Properties.Settings.Default.AppSanctionNum;
            Cursor.Current = Cursors.WaitCursor;

            TriangleZeroMsg.Visible = false;
            Triangle15ETMsg.Visible = false;
            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 {
                    //Retrieve selected tournament attributes
                    DataTable curTourDataTable = getTourData( );

                    if ( curTourDataTable.Rows.Count > 0 ) {
                        myTourRow = curTourDataTable.Rows[0];
                        if ( (byte)myTourRow["JumpRounds"] > 0 ) {
                            myNumJudges = 0;

                            mySkierClassList = new ListSkierClass();
                            mySkierClassList.ListSkierClassLoad();

                            myTourClass = myTourRow["Class"].ToString().ToUpper();
                            myClassCRow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'C'")[0];
                            myClassERow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'E'")[0];

                            jumpDirectionSelectList.SelectList_Load( JumpDirection_Click );
                            StringBuilder curSqlStmt = new StringBuilder( "" );
                            curSqlStmt.Append( "SELECT ListName, ListCode, CodeValue as TriangleFeet FROM CodeValueList " );
                            curSqlStmt.Append( "WHERE ListName in ('JumpMeter6Tol', 'JumpTriangle', 'JumpTriangleZero') " );
                            curSqlStmt.Append( "And ListCode = '" + myTourClass + "' " );
                            curSqlStmt.Append( "ORDER BY SortSeq" );
                            DataTable curTolDataTable = getData( curSqlStmt.ToString() );

                            DataRow myTolRow = curTolDataTable.Select( "ListName = 'JumpTriangle'" )[0];
                            myMeterDistTol = Convert.ToDecimal( (String)myTolRow["TriangleFeet"]);
                            myTolRow = curTolDataTable.Select( "ListName = 'JumpTriangleZero'" )[0];
                            myMeterZeroTol = Convert.ToDecimal( (String)myTolRow["TriangleFeet"]);
                            myTolRow = curTolDataTable.Select( "ListName = 'JumpMeter6Tol'" )[0];
                            myMeter6Tol = Convert.ToDecimal( (String)myTolRow["TriangleFeet"] );

                            navRefresh_Click( null, null );
                        } else {
                            MessageBox.Show( "The jump event is not defined for the active tournament" );
                        }
                    } else {
                        MessageBox.Show( "The active tournament is not properly defined.  You must select from the Administration menu Tournament List option" );
                    }
                }
            }
            Cursor.Current = Cursors.Default;
        }
        public Boolean exportTourPerfData( String inSanctionId )
        {
            Boolean returnStatus = false;
            String curMemberId = "", curReadyToSki = "", curAgeGroup = "";
            StringBuilder outLine = new StringBuilder( "" );
            StreamWriter outBuffer = null;
            String curFilename = "", curRules = "";
            myTourProperties = TourProperties.Instance;

            DataTable curTourDataTable = getTourData( inSanctionId );
            if ( curTourDataTable != null ) {
                if ( curTourDataTable.Rows.Count > 0 ) {
                    myTourRow = curTourDataTable.Rows[0];
                    curRules = (String)myTourRow["Rules"];

                    curFilename = inSanctionId.Trim() + myTourRow["Class"].ToString().Trim() + ".wsp";
                    outBuffer = getExportFile( curFilename );
                    if ( outBuffer != null ) {
                        Log.WriteFile( "Export performance data file begin: " + curFilename );

                        //Build file header line and write to file
                        outLine.Append( writeHeader( inSanctionId ) );
                        outBuffer.WriteLine( outLine.ToString() );

                        //Initialize output buffer
                        outLine = new StringBuilder( "" );
                    }
                }
            }
            if ( outBuffer != null ) {
                myProgressInfo = new ProgressWindow();
                myProgressInfo.setProgessMsg( "Processing Skier Performance Data File" );
                myProgressInfo.Show();
                myProgressInfo.Refresh();
                myProgressInfo.setProgressMax( 10 );

                DataTable curMemberDataTable = getMemberData( inSanctionId );
                if ( curMemberDataTable != null ) {
                    DataRow[] curScoreRows, curScoreSlalomRows, curScoreTrickRows, curScoreJumpRows;
                    String curPlcmtMethod = "score", curPlcmtOverallOrg = "agegroup";
                    String curDataType = myTourProperties.MasterSummaryDataType;
                    //String curDataType = Properties.Settings.Default.MasterSummaryV2DataType;
                    if ( curDataType.ToLower().Equals( "total" )
                        || curDataType.ToLower().Equals( "best" )
                        || curDataType.ToLower().Equals( "final" )
                        || curDataType.ToLower().Equals( "first" ) ) {
                    } else {
                        curDataType = "best";
                    }
                    String curPointsMethod = myTourProperties.MasterSummaryPointsMethod;
                    //String curPointsMethod = Properties.Settings.Default.MasterSummaryV2PointsMethod;
                    if ( curPointsMethod.ToLower().Equals( "nops" )
                        || curPointsMethod.ToLower().Equals( "plcmt" )
                        || curPointsMethod.ToLower().Equals( "kbase" )
                        || curPointsMethod.ToLower().Equals( "ratio" ) ) {
                    } else {
                        curPointsMethod = "nops";
                    }
                    String curPlcmtOrg = myTourProperties.MasterSummaryPlcmtOrg;
                    //String curPlcmtOrg = Properties.Settings.Default.MasterSummaryV2PlcmtOrg;
                    if ( curPlcmtOrg.ToLower().Equals("div") ) {
                        curPlcmtOverallOrg = "agegroup";
                    } else if ( curPlcmtOrg.ToLower().Equals( "divgr" ) ) {
                        curPlcmtOverallOrg = "agegroupgroup";
                    } else {
                        curPlcmtOverallOrg = "agegroup";
                        curPlcmtOrg = "div";
                    }

                    CalcScoreSummary curCalcSummary = new CalcScoreSummary();
                    DataTable mySummaryDataTable = null;

                    DataTable myMemberData = curCalcSummary.getMemberData( inSanctionId );
                    myProgressInfo.setProgressValue( 1 );
                    myProgressInfo.Refresh();

                    if (curRules.ToLower().Equals( "iwwf" ) && curPointsMethod.ToLower().Equals( "kbase" )) {
                        mySummaryDataTable = curCalcSummary.CalcIwwfEventPlcmts( myTourRow, inSanctionId, "Scorebook", curRules, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 5 );
                        myProgressInfo.Refresh();

                        DataTable mySlalomDetail = curCalcSummary.getSlalomScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 6 );
                        myProgressInfo.Refresh();
                        DataTable myTrickDetail = curCalcSummary.getTrickScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 7 );
                        myProgressInfo.Refresh();
                        DataTable myJumpDetail = curCalcSummary.getJumpScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 8 );
                        myProgressInfo.Refresh();
                        DataTable newSummaryDataTable = curCalcSummary.buildTourScorebook( inSanctionId, myTourRow, myMemberData, mySummaryDataTable, mySlalomDetail, myTrickDetail, myJumpDetail );
                        mySummaryDataTable = newSummaryDataTable;
                        myProgressInfo.setProgressValue( 9 );
                        myProgressInfo.Refresh();

                    } else {
                        DataTable mySlalomDataTable = curCalcSummary.getSlalomSummary( myTourRow, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod );
                        myProgressInfo.setProgressValue( 2 );
                        myProgressInfo.Refresh();
                        DataTable myTrickDataTable = curCalcSummary.getTrickSummary( myTourRow, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod );
                        myProgressInfo.setProgressValue( 3 );
                        myProgressInfo.Refresh();
                        DataTable myJumpDataTable = curCalcSummary.getJumpSummary( myTourRow, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod );
                        myProgressInfo.setProgressValue( 4 );
                        myProgressInfo.Refresh();
                        mySummaryDataTable = curCalcSummary.buildOverallSummary( myTourRow, mySlalomDataTable, myTrickDataTable, myJumpDataTable, curDataType, curPlcmtOverallOrg );
                        myProgressInfo.setProgressValue( 5 );
                        myProgressInfo.Refresh();

                        DataTable mySlalomDetail = curCalcSummary.getSlalomScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 6 );
                        myProgressInfo.Refresh();
                        DataTable myTrickDetail = curCalcSummary.getTrickScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 7 );
                        myProgressInfo.Refresh();
                        DataTable myJumpDetail = curCalcSummary.getJumpScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                        myProgressInfo.setProgressValue( 8 );
                        myProgressInfo.Refresh();
                        DataTable newSummaryDataTable = curCalcSummary.buildTourScorebook( inSanctionId, myTourRow, myMemberData, mySummaryDataTable, mySlalomDetail, myTrickDetail, myJumpDetail );
                        mySummaryDataTable = newSummaryDataTable;
                        myProgressInfo.setProgressValue( 9 );
                        myProgressInfo.Refresh();

                    }
                    mySkierClassList = new ListSkierClass();
                    mySkierClassList.ListSkierClassLoad();

                    int curRowCount = 0;
                    myProgressInfo.setProgressMax( curMemberDataTable.Rows.Count );
                    foreach ( DataRow curMemberRow in curMemberDataTable.Rows ) {
                        curRowCount++;
                        myProgressInfo.setProgressValue( curRowCount );
                        myProgressInfo.Refresh();

                        curMemberId = curMemberRow["MemberId"].ToString();
                        curAgeGroup = curMemberRow["AgeGroup"].ToString();
                        curReadyToSki = curMemberRow["ReadyToSki"].ToString();
                        curScoreRows = mySummaryDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );
                        //curScoreSlalomRows = mySlalomDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );
                        //curScoreTrickRows = myTrickDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );
                        //curScoreJumpRows = myJumpDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );

                        if ( curReadyToSki.Equals( "Y" ) ) {
                            if ( curScoreRows.Length > 0 ) {
                                //Write skier identification information
                                outLine.Append( writeSkierInfo( curMemberRow, inSanctionId, curRules, curAgeGroup ) );

                                //Write skier performance summary information
                                //outLine.Append( writeSkierPerfSmry( curMemberId, curAgeGroup, curDataType, curMemberRow, curScoreRows, curScoreSlalomRows, curScoreTrickRows, curScoreJumpRows ) );
                                outLine.Append( writeSkierPerfSmry( curMemberId, curAgeGroup, curDataType, curMemberRow, curScoreRows, curScoreRows, curScoreRows, curScoreRows ) );

                                //Write skier performance summary information
                                outLine.Append( writeSkierPerfData( curMemberId, curAgeGroup, curRules, curMemberRow, curScoreRows ) );

                                //Write output line to file
                                outBuffer.WriteLine( outLine.ToString() );
                            }
                        }

                        //Initialize output buffer
                        outLine = new StringBuilder( "" );
                    }
                    returnStatus = true;
                    outBuffer.Close();

                    myProgressInfo.Close();
                    if ( curMemberDataTable.Rows.Count > 0 ) {
                        MessageBox.Show( curMemberDataTable.Rows.Count + " rows found and written" );
                    } else {
                        MessageBox.Show( "No rows found" );
                    }
                    Log.WriteFile( "Export performance data file complete: " + curFilename );
                }
            }

            return returnStatus;
        }
        public Boolean exportScoreBookData()
        {
            String curMethodName = "exportScoreBookHtml";
            Boolean returnStatus = false;
            StringBuilder outLine = new StringBuilder( "" );
            String curMsg = "", curMemberId = "", curAgeGroup = "", prevMemberId = "", prevAgeGroup = "", curReadyToSki = "";
            String curFileFilter = "HTML files (*.htm)|*.htm|All files (*.*)|*.*";
            Int16 curRound = 0;
            DataRow prevRow = null;
            DataRow[] curScoreSlalomRows = null, curScoreTrickRows = null, curScoreJumpRows = null;
            myTourProperties = TourProperties.Instance;

            ExportScorebookTypeDialogForm curDialogForm = new ExportScorebookTypeDialogForm();
            curDialogForm.ShowDialog();
            if ( curDialogForm.DialogResult == DialogResult.OK ) {
                String curReportFormat = curDialogForm.ReportFormat;
                if ( curReportFormat.Equals( "Magazine" ) ) {
                    Tools.ExportScorebookPublishFmt myExportDataReport = new ExportScorebookPublishFmt();
                    myExportDataReport.ExportScorebookPublishFmtData();
                    returnStatus = true;
                } else {
                    try {
                        curMsg = "Exporting Scorebook Html";
                        Log.WriteFile( curMethodName + ":begin: " + curMsg );

                        mySkierClassList = new ListSkierClass();
                        mySkierClassList.ListSkierClassLoad();

                        String curFilename = mySanctionNum.Trim() + "CS.HTM";
                        StreamWriter outBuffer = getExportFile( curFileFilter, curFilename );

                        if ( outBuffer == null ) {
                            curMsg = "Output file not available";
                        } else {
                            String curPlcmtMethod = "score", curPlcmtOverallOrg = "agegroup";
                            String curDataType = myTourProperties.MasterSummaryDataType;
                            //String curDataType = Properties.Settings.Default.MasterSummaryV2DataType;
                            if ( curDataType.ToLower().Equals( "total" )
                                || curDataType.ToLower().Equals( "best" )
                                || curDataType.ToLower().Equals( "final" )
                                || curDataType.ToLower().Equals( "first" ) ) {
                            } else {
                                curDataType = "best";
                            }
                            String curPointsMethod = myTourProperties.MasterSummaryPointsMethod;
                            //String curPointsMethod = Properties.Settings.Default.MasterSummaryV2PointsMethod;
                            if (curPointsMethod.ToLower().Equals( "nops" )
                                || curPointsMethod.ToLower().Equals( "plcmt" )
                                || curPointsMethod.ToLower().Equals( "kbase" )
                                || curPointsMethod.ToLower().Equals( "ratio" )) {
                            } else {
                                curPointsMethod = "nops";
                            }

                            String curPlcmtOrg = myTourProperties.MasterSummaryPlcmtOrg;
                            //String curPlcmtOrg = Properties.Settings.Default.MasterSummaryV2PlcmtOrg;
                            if ( curPlcmtOrg.ToLower().Equals( "div" ) ) {
                                curPlcmtOverallOrg = "agegroup";
                            } else if ( curPlcmtOrg.ToLower().Equals( "divgr" ) ) {
                                curPlcmtOverallOrg = "agegroupgroup";
                            } else {
                                curPlcmtOverallOrg = "agegroup";
                                curPlcmtOrg = "div";
                            }

                            myProgressInfo = new ProgressWindow();
                            myProgressInfo.setProgessMsg( "Processing Scorebook HTML" );
                            myProgressInfo.Show();
                            myProgressInfo.Refresh();
                            myProgressInfo.setProgressMax( 10 );
                            CalcScoreSummary curCalcSummary = new CalcScoreSummary();

                            DataTable mySlalomDataTable = curCalcSummary.getSlalomSummary( myTourRow, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod );
                            myProgressInfo.setProgressValue( 1 );
                            myProgressInfo.Refresh();
                            DataTable myTrickDataTable = curCalcSummary.getTrickSummary( myTourRow, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod );
                            myProgressInfo.setProgressValue( 2 );
                            myProgressInfo.Refresh();
                            DataTable myJumpDataTable = curCalcSummary.getJumpSummary( myTourRow, curDataType, curPlcmtMethod, curPlcmtOrg, curPointsMethod );
                            myProgressInfo.setProgressValue( 3 );
                            myProgressInfo.Refresh();
                            DataTable myOverallDataTable = curCalcSummary.buildOverallSummary( myTourRow, mySlalomDataTable, myTrickDataTable, myJumpDataTable, curDataType, curPlcmtOverallOrg );
                            myProgressInfo.setProgressValue( 4 );
                            myProgressInfo.Refresh();

                            DataTable myMemberData = curCalcSummary.getMemberData( mySanctionNum );
                            myProgressInfo.setProgressValue( 5 );
                            myProgressInfo.Refresh();

                            DataTable mySlalomDetail = curCalcSummary.getSlalomScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                            myProgressInfo.setProgressValue( 6 );
                            myProgressInfo.Refresh();
                            DataTable myTrickDetail = curCalcSummary.getTrickScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                            myProgressInfo.setProgressValue( 7 );
                            myProgressInfo.Refresh();
                            DataTable myJumpDetail = curCalcSummary.getJumpScoreDetail( myTourRow, curPlcmtMethod, curPlcmtOrg, curPointsMethod, null, null );
                            myProgressInfo.setProgressValue( 8 );
                            myProgressInfo.Refresh();

                            DataTable mySummaryDataTable = curCalcSummary.buildTourScorebook( mySanctionNum, myTourRow, myMemberData, myOverallDataTable, mySlalomDetail, myTrickDetail, myJumpDetail );
                            myProgressInfo.setProgressValue( 9 );
                            myProgressInfo.Refresh();

                            myProgressInfo.setProgressMax( mySummaryDataTable.Rows.Count );
                            myProgressInfo.Refresh();

                            //Build file header line and write to file
                            writeHeader( outBuffer, curPlcmtOrg );

                            if ( curReportFormat.Equals( "Index" ) ) {
                                //Build index header
                                writeIndexHeader( outBuffer, curPlcmtOrg, mySlalomDataTable, myTrickDataTable, myJumpDataTable, myOverallDataTable );
                            }
                            //Build master summary header
                            writeMasterSummaryHeader( outBuffer, curPlcmtOrg );
                            int curRowCount = 0;
                            foreach ( DataRow curRow in mySummaryDataTable.Rows ) {
                                curRowCount++;
                                myProgressInfo.setProgressValue( curRowCount );
                                myProgressInfo.Refresh();

                                curMemberId = curRow["MemberId"].ToString();
                                curAgeGroup = curRow["AgeGroup"].ToString();
                                curReadyToSki = curRow["ReadyToSki"].ToString();
                                if ( curMemberId != prevMemberId || curAgeGroup != prevAgeGroup ) {
                                    curScoreSlalomRows = mySlalomDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );
                                    curScoreTrickRows = myTrickDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );
                                    curScoreJumpRows = myJumpDataTable.Select( "MemberId = '" + curMemberId + "' AND AgeGroup = '" + curAgeGroup + "'" );
                                }

                                //Initialize control fields
                                prevMemberId = curMemberId;
                                prevAgeGroup = curAgeGroup;
                                curRound = (Int16)curRow["Round"];

                                //Initialize output buffer
                                outLine = new StringBuilder( "<tr>" );

                                //Write skier identification information
                                writeSkierInfo( curRow, curRound, outBuffer );

                                //Write skier performance summary information
                                writeSkierSlalomScore( curRow, curScoreSlalomRows, curPlcmtOrg, outBuffer );

                                writeSkierTrickScore( curRow, curScoreTrickRows, curPlcmtOrg, outBuffer );

                                writeSkierJumpScore( curRow, curScoreJumpRows, curPlcmtOrg, outBuffer );

                                writeSkierOverallScore( curRow, outBuffer );

                                //Write output line to file
                                outLine = new StringBuilder( "</tr>" );
                                outBuffer.WriteLine( outLine.ToString() );
                            }
                            outLine = new StringBuilder( "</table>" );
                            outBuffer.WriteLine( outLine.ToString() );

                            if ( curReportFormat.Equals( "Index" ) ) {
                                outLine = new StringBuilder( "<br/><br/><a href=#PageTop>Return to Index</a><br/></div>" );
                                outBuffer.WriteLine( outLine.ToString() );

                                writeIndexSlalomResults( curPlcmtOrg, mySlalomDataTable, outBuffer );
                                writeIndexTrickResults( curPlcmtOrg, myTrickDataTable, outBuffer );
                                writeIndexJumpResults( curPlcmtOrg, myJumpDataTable, outBuffer );
                                writeIndexOverallResults( curPlcmtOrg, myOverallDataTable, outBuffer );

                                Boolean curTeamsAvailble = isTeamAvailable();
                                //if ( this.myTourClass.Equals("B") || this.myTourClass.Equals("A") ) {
                                //    curTeamsAvailble = false;
                                //}

                                if ( curTeamsAvailble ) {
                                    Int16 myNumPerTeam = Convert.ToInt16( myTourProperties.TeamSummary_NumPerTeam);
                                    String curTeamPlcmtOrg = myTourProperties.TeamSummaryPlcmtOrg;
                                    //String curTeamPlcmtOrg = Properties.Settings.Default.TeamSummaryPlcmtOrg;
                                    if (curTeamPlcmtOrg.ToLower().Equals( "tour" )
                                        || curTeamPlcmtOrg.ToLower().Equals( "div" )) {
                                    } else {
                                        curTeamPlcmtOrg = "tour";
                                    }
                                    String curTeamPlcmtMethod = "points";
                                    String curTeamDataType = myTourProperties.TeamSummaryDataType;
                                    //String curTeamDataType = Properties.Settings.Default.TeamSummaryDataType;
                                    if (curTeamDataType.ToLower().Equals( "total" )
                                        || curTeamDataType.ToLower().Equals( "best" )
                                        || curTeamDataType.ToLower().Equals( "final" )
                                        || curTeamDataType.ToLower().Equals( "first" )) {
                                    } else {
                                        curTeamDataType = "best";
                                    }
                                    String curTeamPointsMethod = myTourProperties.TeamSummaryPointsMethod;
                                    //String curTeamPointsMethod = Properties.Settings.Default.MasterSummaryV2PointsMethod;
                                    if (curTeamPointsMethod.ToLower().Equals( "nops" )
                                        || curTeamPointsMethod.ToLower().Equals( "plcmt" )
                                        || curTeamPointsMethod.ToLower().Equals( "kbase" )
                                        || curTeamPointsMethod.ToLower().Equals( "ratio" )) {
                                    } else {
                                        curTeamPointsMethod = "nops";
                                    }

                                    if ( this.myTourClass.Equals("B") || this.myTourClass.Equals("A") ) {
                                        curTeamPointsMethod = "nops";
                                        curTeamDataType = "best";
                                        curTeamPlcmtOrg = "awsa";
                                        curTeamPlcmtMethod = "points";
                                        myNumPerTeam = 4;
                                    }

                                    String curGroupValue = "all";
                                    mySlalomDataTable = curCalcSummary.getSlalomSummary(myTourRow, curTeamDataType, curTeamPlcmtMethod, curTeamPlcmtOrg, curTeamPointsMethod, "Team", curGroupValue);
                                    myTrickDataTable = curCalcSummary.getTrickSummary(myTourRow, curTeamDataType, curTeamPlcmtMethod, curTeamPlcmtOrg, curTeamPointsMethod, "Team", curGroupValue);
                                    myJumpDataTable = curCalcSummary.getJumpSummary(myTourRow, curTeamDataType, curTeamPlcmtMethod, curTeamPlcmtOrg, curTeamPointsMethod, "Team", curGroupValue);

                                    DataTable myTeamDataTable = null;
                                    myTeamDataTable = curCalcSummary.getSlalomSummaryTeam(mySlalomDataTable, myTourRow, myNumPerTeam, curTeamDataType, curTeamPlcmtMethod, curTeamPlcmtOrg, curTeamPointsMethod);
                                    myTeamDataTable = curCalcSummary.getTrickSummaryTeam(myTeamDataTable, myTrickDataTable, myTourRow, myNumPerTeam, curTeamDataType, curTeamPlcmtMethod, curTeamPlcmtOrg, curTeamPointsMethod);
                                    myTeamDataTable = curCalcSummary.getJumpSummaryTeam(myTeamDataTable, myJumpDataTable, myTourRow, myNumPerTeam, curTeamDataType, curTeamPlcmtMethod, curTeamPlcmtOrg, curTeamPointsMethod);
                                    if ( curTeamPlcmtOrg.ToLower().Equals("tour") ) {
                                        myTeamDataTable = curCalcSummary.CalcTeamCombinedSummary(myTourRow, mySlalomDataTable, myTrickDataTable, myJumpDataTable, myNumPerTeam);
                                    }

                                    if ( myTourClass.Equals("B") || myTourClass.Equals("A") ) {
                                        mySlalomDataTable = curCalcSummary.CalcTeamAwsaEventPoints(mySlalomDataTable, "Slalom");
                                        myTrickDataTable = curCalcSummary.CalcTeamAwsaEventPoints(myTrickDataTable, "Trick");
                                        myJumpDataTable = curCalcSummary.CalcTeamAwsaEventPoints(myJumpDataTable, "Jump");
                                        myTeamDataTable = curCalcSummary.CalcTeamAwsaCombinedSummary(myTourRow, mySlalomDataTable, myTrickDataTable, myJumpDataTable, myNumPerTeam);
                                        writeIndexTeamResults(myTeamDataTable, myNumPerTeam, curTeamPlcmtOrg, outBuffer);
                                        writeIndexTeamDetailResults(mySlalomDataTable, myTrickDataTable, myJumpDataTable, myNumPerTeam, curTeamPlcmtOrg, outBuffer);
                                    } else {
                                        writeIndexTeamResults(myTeamDataTable, myNumPerTeam, curTeamPlcmtOrg, outBuffer);
                                    }
                                }
                            } else {
                                outLine = new StringBuilder( "</div>" );
                                outBuffer.WriteLine( outLine.ToString() );
                            }

                            //Build file footer and write to file
                            writeFooter( outBuffer );
                            outLine = new StringBuilder( "" );
                            outBuffer.WriteLine( outLine.ToString() );

                            returnStatus = true;
                            outBuffer.Close();

                            myProgressInfo.Close();
                            if ( mySummaryDataTable.Rows.Count > 0 ) {
                                curMsg = mySummaryDataTable.Rows.Count + " skiers found and written";
                            } else {
                                curMsg = "No rows found";
                            }
                        }
                        MessageBox.Show( curMsg );
                        Log.WriteFile( curMethodName + ":conplete: " + curMsg );
                    } catch ( Exception ex ) {
                        MessageBox.Show( "Error:" + curMethodName + " Error writing scorebook html file\n\nError: " + ex.Message );
                        curMsg = curMethodName + ":Exception=" + ex.Message;
                        Log.WriteFile( curMsg );
                        returnStatus = false;
                    }
                }
            } else {
                returnStatus = false;
            }

            return returnStatus;
        }
        public Boolean exportBoatTimes( String inSanctionId )
        {
            Boolean returnStatus = false;
            Int16 curSanctionYear = 0;
            char DoubleQuote = '"';
            String curMemberId = "", curTourClass = "", curEventDateOut = "", curRunTime = "";
            StringBuilder outLine = new StringBuilder( "" );
            StreamWriter outBuffer = null;
            myProgressInfo = new ProgressWindow();

            DataTable curTourDataTable = getTourData( inSanctionId );
            if ( curTourDataTable != null ) {
                if ( curTourDataTable.Rows.Count > 0 ) {
                    curSanctionYear = Convert.ToInt16( inSanctionId.Substring( 0, 2 ) );
                    myTourRow = curTourDataTable.Rows[0];
                    curTourClass = myTourRow["Class"].ToString().Trim();
                    String curFilename = inSanctionId.Trim() + "JT.csv";
                    outBuffer = getExportFile( curFilename );

                    curEventDateOut = myTourRow["EventDates"].ToString();
                    if ( curEventDateOut.Length > 7 ) {
                        try {
                            DateTime curEventDate = Convert.ToDateTime( curEventDateOut );
                            curEventDateOut = curEventDate.ToString( "yyyyMMdd" );
                        } catch {
                            curEventDateOut = "";
                        }
                    } else {
                        curEventDateOut = "";
                    }
                    mySkierClassList = new ListSkierClass();
                    mySkierClassList.ListSkierClassLoad();
                    myTourClass = myTourRow["Class"].ToString().ToUpper();
                    myClassCRow = mySkierClassList.SkierClassDataTable.Select( "ListCode = 'C'" )[0];
                    myClassERow = mySkierClassList.SkierClassDataTable.Select( "ListCode = 'E'" )[0];
                }
            }
            Decimal curSplitTime30M, curSplitTime52M, curSplitTime82M, curBoatEndTime, curScoreMeters, curScoreFeet;
            Decimal curActualSeg52m, curActualSeg30m, curActualSeg41m, curActualSeg82m;
            String curResults, curTimeClass;
            if ( outBuffer != null ) {
                outLine.Append( "Sanction" );
                outLine.Append( ", Skier Class" );
                outLine.Append( ", Boat" );
                outLine.Append( ", EventDate" );
                outLine.Append( ", Time" );
                outLine.Append( ", SkierName" );
                outLine.Append( ", Div" );
                outLine.Append( ", Pass" );
                outLine.Append( ", Speed" );
                outLine.Append( ", Meters" );
                outLine.Append( ", Feet" );
                outLine.Append( ", Time30M" );
                outLine.Append( ", Time52M" );
                outLine.Append( ", Time82M" );
                outLine.Append( ", Time41M" );
                outLine.Append( ", Actual30M" );
                outLine.Append( ", Actual52M" );
                outLine.Append( ", Actual82M" );
                outLine.Append( ", Actual41M" );

                //Write output line to file
                outBuffer.WriteLine( outLine.ToString() );
                outLine = new StringBuilder( "" );

                myProgressInfo.setProgessMsg( "Export jump boat times " );
                myProgressInfo.Show();
                myProgressInfo.Refresh();
                int curRowCount = 0;

                DataTable curBoatTimeResults = getBoatTimeResults( inSanctionId );
                myProgressInfo.setProgressMax( curBoatTimeResults.Rows.Count );
                if (curBoatTimeResults != null) {
                    foreach ( DataRow curRow in curBoatTimeResults.Rows ) {
                        curRowCount++;
                        myProgressInfo.setProgressValue( curRowCount );
                        myProgressInfo.Refresh();

                        curTimeClass = getTimeClass( (String)curRow["EventClass"] );
                        curResults = (String)curRow["Results"];
                        try {
                            curSplitTime52M = (Decimal)curRow["BoatSplitTime"];
                        } catch {
                            curSplitTime52M = 0;
                        }
                        try {
                            curSplitTime82M = (Decimal)curRow["BoatSplitTime2"];
                        } catch {
                            curSplitTime82M = 0;
                        }
                        try {
                            curSplitTime30M = curSplitTime82M - curSplitTime52M;
                        } catch {
                            curSplitTime30M = 0;
                        }
                        try {
                            curBoatEndTime = ((Decimal)curRow["BoatEndTime"]);
                        } catch {
                            curBoatEndTime = 0;
                        }
                        try {
                            curScoreMeters= ((Decimal)curRow["ScoreMeters"]);
                        } catch {
                            curScoreMeters = 0;
                        }
                        try {
                            curScoreFeet = ((Decimal)curRow["ScoreFeet"]);
                        } catch {
                            curScoreFeet = 0;
                        }
                        if (curTimeClass.Equals( "R" )) {
                            try {
                                curActualSeg52m = Convert.ToDecimal( (String)curRow["ActualTime52mSeg"] );
                            } catch {
                                curActualSeg52m = 0;
                            }
                            try {
                                curActualSeg41m = Convert.ToDecimal( (String)curRow["ActualTime41mSeg"] );
                            } catch {
                                curActualSeg41m = 0;
                            }
                            try {
                                curActualSeg82m = Convert.ToDecimal( (String)curRow["ActualTime82mSeg"] );
                            } catch {
                                curActualSeg82m = 0;
                            }
                        } else {
                            try {
                                curActualSeg52m = Convert.ToDecimal( (String)curRow["ActualTime52mSegR"] );
                            } catch {
                                curActualSeg52m = 0;
                            }
                            try {
                                curActualSeg41m = Convert.ToDecimal( (String)curRow["ActualTime41mSegR"] );
                            } catch {
                                curActualSeg41m = 0;
                            }
                            try {
                                curActualSeg82m = Convert.ToDecimal( (String)curRow["ActualTime82mSegR"] );
                            } catch {
                                curActualSeg82m = 0;
                            }
                        }
                        try {
                            curActualSeg30m = curActualSeg82m - curActualSeg52m;
                        } catch {
                            curActualSeg30m = 0;
                        }
                        try {
                            curRunTime = ((DateTime)curRow["LastUpdateDate"]).ToString( "hhmm" );
                        } catch {
                            curRunTime = "0000";
                        }

                        outLine.Append( DoubleQuote.ToString() + inSanctionId + curTourClass + DoubleQuote.ToString() ); // 1. (7) SanctionId with class
                        outLine.Append( "," + DoubleQuote.ToString() + curRow["EventClass"].ToString() + DoubleQuote.ToString() ); // 2. (1) Skier Class
                        outLine.Append( "," + DoubleQuote.ToString() + curRow["Boat"].ToString().PadRight( 11, ' ' ) + DoubleQuote.ToString() ); // 3. (11) Boat
                        outLine.Append( "," + DoubleQuote.ToString() + curEventDateOut + DoubleQuote.ToString() ); // 4. (8) Date YYYYMMDD
                        outLine.Append( "," + DoubleQuote.ToString() + curRunTime + DoubleQuote.ToString() ); // 5. (4) Time HHMM
                        outLine.Append( "," + DoubleQuote.ToString() + curRow["SkierName"].ToString().PadRight( 22, ' ') + DoubleQuote.ToString() ); // 6. (22) Skier Name
                        outLine.Append( "," + DoubleQuote.ToString() + curRow["AgeGroup"].ToString() + DoubleQuote.ToString() ); // 7. (2) Age Division
                        outLine.Append( "," + DoubleQuote.ToString() + ((byte)curRow["PassNum"]).ToString("#0").PadLeft(2, ' ') + DoubleQuote.ToString() ); // 8. (2) Pass Number
                        outLine.Append( "," + DoubleQuote.ToString() + ((byte)curRow["BoatSpeed"]).ToString( "00" ) + DoubleQuote.ToString() ); // 9. (2) Boat Speed KM
                        if ( curResults.ToUpper().Equals( "JUMP" ) ) {
                            outLine.Append( "," + DoubleQuote.ToString() + curScoreMeters.ToString( "#0.0" ).PadLeft( 4, ' ' ) + DoubleQuote.ToString() ); //10. (4) Distance in Meters
                            outLine.Append( "," + DoubleQuote.ToString() + curScoreFeet.ToString( "#00" ).PadLeft( 3, ' ' ) + DoubleQuote.ToString() ); //11. (3) Distance in Feet
                        } else {
                            outLine.Append( "," + DoubleQuote.ToString() + curResults.ToUpper() + DoubleQuote.ToString() ); //10. (4) Distance in Meters
                            outLine.Append( "," + DoubleQuote.ToString() + "   " + DoubleQuote.ToString() ); //11. (3) Distance in Feet
                        }
                        outLine.Append( ", " + curSplitTime30M.ToString( "0.00" ) ); //12. (4 Num) 1st segment 30M Time
                        outLine.Append( ", " + curSplitTime52M.ToString( "0.00" ) ); //13. (4 Num) 2nd segment 52M Time
                        outLine.Append( ", " + curSplitTime82M.ToString( "0.00" ) ); //14. (4 Num) 1st & 2nd segment 82M Time
                        outLine.Append( ", " + curBoatEndTime.ToString( "0.00" ) ); //15. (4 Num) 3rd segment 41M Time

                        outLine.Append( ", " + curActualSeg52m.ToString( "0.00" ) ); //16. (4 Num) 1st segment 30M Actual
                        outLine.Append( ", " + curActualSeg30m.ToString( "0.00" ) ); //17. (4 Num) 2nd segment 52M Actual
                        outLine.Append( ", " + curActualSeg82m.ToString( "0.00" ) ); //18. (4 Num) 1st & 2nd segment 82M Actual
                        outLine.Append( ", " + curActualSeg41m.ToString( "0.00" ) ); //19. (4 Num) 3rd segment 41M Actual

                        //Write output line to file
                        outBuffer.WriteLine( outLine.ToString() );

                        //Initialize output buffer
                        outLine = new StringBuilder( "" );
                    }
                    myProgressInfo.Close();
                }

                returnStatus = true;
                outBuffer.Close();

                if ( curBoatTimeResults.Rows.Count > 0 ) {
                    MessageBox.Show( curBoatTimeResults.Rows.Count + " rows found and written" );
                } else {
                    MessageBox.Show( "No rows found" );
                }
            }

            return returnStatus;
        }
        public void showClassChangeWindow(DataRow inTourRow, String inEvent)
        {
            String curListCode = "";
            String curListValue = "";
            RadioButtonWithValue curRadioButton;
            int curItemLoc = 15;
            int curItemSize = 0;
            myTourRules = (String)inTourRow["Rules"];
            myTourClass = (String)inTourRow["Class"];
            mySanctionNum = (String)inTourRow["SanctionId"];
            myCopyFromClass = myTourClass;
            myCopyToClass = myTourClass;

            mySkierClassList = new ListSkierClass();
            mySkierClassList.ListSkierClassLoad();

            curRadioButton = new RadioButtonWithValue();
            curRadioButton.Parent = FromClassGroupBox;
            curRadioButton.AutoSize = true;
            curRadioButton.Location = new System.Drawing.Point( 15, curItemLoc );
            curRadioButton.Name = "All";
            curRadioButton.Size = new System.Drawing.Size( curItemSize, 15 );
            curRadioButton.TabIndex = 0;
            curRadioButton.TabStop = true;
            curRadioButton.Text = "All";
            curRadioButton.UseVisualStyleBackColor = true;
            curRadioButton.Value = "All";
            curItemLoc += 17;
            curRadioButton.Click += new System.EventHandler( radioButtonFrom_Click );
            FromClassGroupBox.Controls.Add( curRadioButton );

            foreach (ListItem curEntry in mySkierClassList.DropdownList) {
                curListCode = (String)curEntry.ItemName;
                curListValue = (String)curEntry.ItemValue;
                curItemSize = curListValue.Length * 8;

                curRadioButton = new RadioButtonWithValue();
                curRadioButton.Parent = FromClassGroupBox;
                curRadioButton.AutoSize = true;
                curRadioButton.Location = new System.Drawing.Point( 15, curItemLoc );
                curRadioButton.Name = curListValue;
                curRadioButton.Size = new System.Drawing.Size( curItemSize, 15 );
                curRadioButton.TabIndex = 0;
                curRadioButton.TabStop = true;
                curRadioButton.Text = curListCode;
                curRadioButton.UseVisualStyleBackColor = true;
                curRadioButton.Value = curListValue;
                if (curListValue.ToLower().Equals( myTourClass.ToLower() )) {
                    curRadioButton.Checked = true;
                }
                curItemLoc += 17;
                curRadioButton.Click += new System.EventHandler( radioButtonFrom_Click );
                FromClassGroupBox.Controls.Add( curRadioButton );
            }

            curItemLoc = 15;
            foreach (ListItem curEntry in mySkierClassList.DropdownList) {
                curListCode = (String)curEntry.ItemName;
                curListValue = (String)curEntry.ItemValue;
                curItemSize = curListValue.Length * 8;

                curRadioButton = new RadioButtonWithValue();
                curRadioButton.Parent = ToClassGroupBox;
                curRadioButton.AutoSize = true;
                curRadioButton.Location = new System.Drawing.Point( 15, curItemLoc );
                curRadioButton.Name = curListValue;
                curRadioButton.Size = new System.Drawing.Size( curItemSize, 15 );
                curRadioButton.TabIndex = 0;
                curRadioButton.TabStop = true;
                curRadioButton.Text = curListCode;
                curRadioButton.UseVisualStyleBackColor = true;
                curRadioButton.Value = curListValue;
                if (curListValue.ToLower().Equals( myTourClass.ToLower() )) {
                    curRadioButton.Checked = true;
                }
                curItemLoc += 17;
                curRadioButton.Click += new System.EventHandler( radioButtonTo_Click );
                ToClassGroupBox.Controls.Add( curRadioButton );

                loadEventGroupList();
            }
        }
        public Boolean exportBoatTimes( String inSanctionId )
        {
            Boolean returnStatus = false, curActiveTour = false;
            char DoubleQuote = '"';
            String curMemberId = "", curEventDateOut = "";
            StringBuilder outLine = new StringBuilder( "" );
            StreamWriter outBuffer = null;
            myProgressInfo = new ProgressWindow();

            DataTable curTourDataTable = getTourData( inSanctionId );
            if ( curTourDataTable != null ) {
                if ( curTourDataTable.Rows.Count > 0 ) {
                    curActiveTour = true;
                    myTourRow = curTourDataTable.Rows[0];
                    myTourClass = myTourRow["Class"].ToString().ToUpper();
                    String curFilename = inSanctionId.Trim() + "ST.csv";
                    outBuffer = getExportFile( curFilename );

                    curEventDateOut = myTourRow["EventDates"].ToString();
                    if ( curEventDateOut.Length > 7 ) {
                        try {
                            DateTime curEventDate = Convert.ToDateTime( curEventDateOut );
                            curEventDateOut = curEventDate.ToString( "yyyyMMdd" );
                        } catch {
                            curEventDateOut = "";
                        }
                    } else {
                        curEventDateOut = "";
                    }
                }
            }

            if ( curActiveTour ) {
                StringBuilder curSqlStmt = new StringBuilder( "" );
                curSqlStmt.Append( "SELECT ListCode, ListCodeNum, SortSeq, CodeValue, MinValue, MaxValue, CodeDesc ");
                curSqlStmt.Append( "FROM CodeValueList WHERE ListName = 'SlalomBoatTime' ORDER BY SortSeq" );
                myTimesDataTable = getData( curSqlStmt.ToString() );

                mySkierClassList = new ListSkierClass();
                mySkierClassList.ListSkierClassLoad();
                myClassCRow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'C'")[0];
                myClassERow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'E'")[0];

                DataTable curSpeedByPassDataTable;
                Int16 curMaxSpeed, curPassNum, curRound;
                Decimal curBoatTime, curScore, curSpeed, curActualTime;
                String curSpeedDesc, curTimeKey, curTimeKeyScore, curEventClass, curRunTime;
                DataRow[] curTimeRowsFound;
                if ( outBuffer != null ) {
                    outLine.Append( "Sanction" );
                    outLine.Append( ", Skier Class" );
                    outLine.Append( ", Boat" );
                    outLine.Append( ", EventDate" );
                    outLine.Append( ", Time" );
                    outLine.Append( ", SkierName" );
                    outLine.Append( ", Div" );
                    outLine.Append( ", MaxSpeed" );
                    outLine.Append( ", Round" );
                    outLine.Append( ", PassNum" );
                    outLine.Append( ", PassDesc" );
                    outLine.Append( ", PassScore" );
                    outLine.Append( ", BoatTime" );
                    outLine.Append( ", ActualTime" );

                    //Write output line to file
                    outBuffer.WriteLine( outLine.ToString() );
                    outLine = new StringBuilder( "" );

                    myProgressInfo.setProgessMsg( "Export slalom boat times " );
                    myProgressInfo.Show();
                    myProgressInfo.Refresh();
                    int curRowCount = 0;

                    DataTable curBoatTimeResults = getBoatTimeResults( inSanctionId );
                    if ( curBoatTimeResults != null ) {
                        myProgressInfo.setProgressMax( curBoatTimeResults.Rows.Count );
                        foreach (DataRow curRow in curBoatTimeResults.Rows) {
                            curRowCount++;
                            myProgressInfo.setProgressValue( curRowCount );
                            myProgressInfo.Refresh();

                            try {
                                curBoatTime = (Decimal)curRow["BoatTime"];
                            } catch {
                                curBoatTime = 0;
                            }
                            try {
                                curScore = ( (Decimal)curRow["PassScore"] );
                            } catch {
                                curScore = 0;
                            }
                            try {
                                curRound = ( (Byte)curRow["Round"] );
                            } catch {
                                curRound = 0;
                            }
                            try {
                                curPassNum = ( (Byte)curRow["PassNum"] );
                            } catch {
                                curPassNum = 0;
                            }
                            try {
                                curEventClass = ( (String)curRow["EventClass"] );
                            } catch {
                                curEventClass = "";
                            }
                            try {
                                curRunTime = ( (DateTime)curRow["LastUpdateDate"] ).ToString( "hhmm" );
                            } catch {
                                curRunTime = "0000";
                            }
                            try {
                                curMaxSpeed = ( (Byte)curRow["MaxSpeed"] );
                                curSpeedByPassDataTable = getSpeedByPass( curMaxSpeed, curPassNum );
                                if ( curSpeedByPassDataTable.Rows.Count > 0 ) {
                                    curSpeedDesc = (String)curSpeedByPassDataTable.Rows[0]["CodeValue"];
                                    curSpeed = (Decimal)curSpeedByPassDataTable.Rows[0]["MaxValue"];
                                    curTimeKeyScore = curScore.ToString( "0.00" );
                                    curTimeKey = curSpeed.ToString( "00" ) + "-" + getTimeClass( curEventClass ) + "-" + curTimeKeyScore.Substring( 0, 1 );
                                    curTimeRowsFound = myTimesDataTable.Select( "ListCode = '" + curTimeKey + "'" );
                                    if ( curTimeRowsFound.Length > 0 ) {
                                        myTimeRow = curTimeRowsFound[0];
                                    } else {
                                        myTimeRow = null;
                                    }
                                    curActualTime = Convert.ToDecimal( (String)myTimeRow["CodeValue"] );
                                } else {
                                    curSpeed = 0;
                                    curActualTime = 0;
                                    curSpeedDesc = "";
                                    myTimeRow = null;
                                }

                            } catch {
                                curActualTime = 0;
                                curSpeed = 0;
                                curMaxSpeed = 0;
                                curSpeedDesc = "";
                                myTimeRow = null;
                            }

                            outLine.Append( DoubleQuote.ToString() + inSanctionId + myTourClass + DoubleQuote.ToString() ); // 1. (7) SanctionId with class
                            outLine.Append( "," + DoubleQuote.ToString() + curRow["EventClass"].ToString() + DoubleQuote.ToString() ); // 2. (1) Skier Class
                            outLine.Append( "," + DoubleQuote.ToString() + curRow["Boat"].ToString().PadRight( 11, ' ' ) + DoubleQuote.ToString() ); // 3. (11) Boat
                            outLine.Append( "," + DoubleQuote.ToString() + curEventDateOut + DoubleQuote.ToString() ); // 4. (8) Date YYYYMMDD
                            outLine.Append( "," + DoubleQuote.ToString() + curRunTime + DoubleQuote.ToString() ); // 5. (4) Time HHMM
                            outLine.Append( "," + DoubleQuote.ToString() + curRow["SkierName"].ToString().PadRight( 22, ' ' ) + DoubleQuote.ToString() ); // 6. (22) Skier Name
                            outLine.Append( "," + DoubleQuote.ToString() + curRow["AgeGroup"].ToString() + DoubleQuote.ToString() ); // 7. (2) Age Division
                            outLine.Append( "," + DoubleQuote.ToString() + curMaxSpeed.ToString( "#0" ).PadLeft( 2, ' ' ) + DoubleQuote.ToString() ); // 8. (2) Max Speed for division
                            outLine.Append( "," + DoubleQuote.ToString() + curRound.ToString( "#0" ).PadLeft( 2, ' ' ) + DoubleQuote.ToString() ); // 9. (2) Round
                            outLine.Append( "," + DoubleQuote.ToString() + curPassNum.ToString( "#0" ).PadLeft( 2, ' ' ) + DoubleQuote.ToString() ); // 10. (2) Pass Number
                            outLine.Append( "," + DoubleQuote.ToString() + curSpeedDesc.PadRight( 28, ' ' ) + DoubleQuote.ToString() ); // 11. (28) Boat Speed Desc
                            outLine.Append( "," + DoubleQuote.ToString() + curScore.ToString( "#.00" ).PadLeft( 4, ' ' ) + DoubleQuote.ToString() ); //10. (4) Score for Pass
                            outLine.Append( "," + curBoatTime.ToString( "##.00" ) ); //12. (5 Num) Boat Time
                            outLine.Append( "," + curActualTime.ToString( "##.00" ) ); //13. (5 Num) Actual Time

                            //Write output line to file
                            outBuffer.WriteLine( outLine.ToString() );

                            //Initialize output buffer
                            outLine = new StringBuilder( "" );
                        }
                        myProgressInfo.Close();
                    }

                    returnStatus = true;
                    outBuffer.Close();

                    if ( curBoatTimeResults.Rows.Count > 0 ) {
                        MessageBox.Show( curBoatTimeResults.Rows.Count + " rows found and written" );
                    } else {
                        MessageBox.Show( "No rows found" );
                    }
                }
            }

            return returnStatus;
        }
        private void ScoreEntry_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.JumpEntry_Width > 0) {
                this.Width = Properties.Settings.Default.JumpEntry_Width;
            }
            if (Properties.Settings.Default.JumpEntry_Height > 0) {
                this.Height = Properties.Settings.Default.JumpEntry_Height;
            }
            if (Properties.Settings.Default.JumpEntry_Location.X > 0
                && Properties.Settings.Default.JumpEntry_Location.Y > 0) {
                this.Location = Properties.Settings.Default.JumpEntry_Location;
            }
            myTourProperties = TourProperties.Instance;
            mySortCommand = myTourProperties.RunningOrderSortJump;
            int curDelim = mySortCommand.IndexOf( "AgeGroup" );
            if (curDelim < 0) {
            } else if (curDelim > 0) {
                mySortCommand = mySortCommand.Substring( 0, curDelim ) + "DivOrder" + mySortCommand.Substring( curDelim + "AgeGroup".Length );
                myTourProperties.RunningOrderSortJump = mySortCommand;
            } else {
                mySortCommand = "DivOrder" + mySortCommand.Substring( "AgeGroup".Length );
                myTourProperties.RunningOrderSortJump = mySortCommand;
            }

            ResizeNarrow.Visible = false;
            ResizeNarrow.Enabled = false;
            ResizeWide.Visible = true;
            ResizeWide.Enabled = true;
            ResizeNarrow.Location = ResizeWide.Location;

            EventRunInfoLabel.Text = "   Event Start:\n" + "   Event Delay:\n" + "Skiers, Passes:";
            EventRunInfoData.Text = "";
            EventRunPerfLabel.Text = "Event Duration:\n" + "Mins Per Skier:\n" + " Mins Per Pass:"******"";
            EventDelayReasonTextBox.Visible = false;
            EventDelayReasonLabel.Visible = false;
            StartTimerButton.Visible = false;
            PauseTimerButton.Visible = true;
            StartTimerButton.Location = PauseTimerButton.Location;

            String[] curList = { "SkierName", "Div", "DivOrder", "EventGroup", "RunOrder", "TeamCode", "EventClass", "RankingScore", "RankingRating", "HCapBase", "HCapScore", "Status" };
            sortDialogForm = new SortDialogForm();
            sortDialogForm.ColumnListArray = curList;

            filterDialogForm = new Common.FilterDialogForm();
            filterDialogForm.ColumnListArray = curList;

            eventGroupSelect = new EventGroupSelect();
            rerideReasonDialogForm = new RerideReason();
            skierDoneReasonDialogForm = new SkierDoneReason();

            // Retrieve data from database
            mySanctionNum = Properties.Settings.Default.AppSanctionNum;
            Cursor.Current = Cursors.WaitCursor;

            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 {
                    //Retrieve selected tournament attributes
                    DataTable curTourDataTable = getTourData(mySanctionNum);
                    if (curTourDataTable.Rows.Count > 0) {
                        myTourRow = curTourDataTable.Rows[0];
                        myTourRules = (String)myTourRow["Rules"];
                        if ( myTourRules.ToLower().Equals( "ncwsa" ) ) {
                            TeamCode.Visible = true;
                        } else {
                            TeamCode.Visible = false;
                        }

                        if ( (byte)myTourRow["JumpRounds"] > 0 ) {
                            mySanctionYear = Convert.ToInt16( mySanctionNum.Substring( 0, 2 ) );

                            //Load round selection list based on number of rounds specified for the tournament
                            roundSelect.SelectList_Load( myTourRow["JumpRounds"].ToString(), roundSelect_Click );
                            roundActiveSelect.SelectList_LoadHorztl( myTourRow["JumpRounds"].ToString(), roundActiveSelect_Click );
                            roundActiveSelect.RoundValue = "1";
                            roundSelect.RoundValue = "1";

                            //Load jump speed selection list
                            JumpSpeedSelect.SelectList_Load( JumpSpeedSelect_Change );

                            //Load ramp height selection list
                            RampHeightSelect.SelectList_Load( RampHeightSelect_Change );

                            mySkierClassList = new ListSkierClass();
                            mySkierClassList.ListSkierClassLoad();
                            scoreEventClass.DataSource = mySkierClassList.DropdownList;
                            scoreEventClass.DisplayMember = "ItemName";
                            scoreEventClass.ValueMember = "ItemValue";

                            myRuleType = ((String)myTourRow["Rules"]).ToUpper();
                            myTourClass = myTourRow["Class"].ToString().ToUpper();
                            myClassCRow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'C'")[0];
                            myClassERow = mySkierClassList.SkierClassDataTable.Select("ListCode = 'E'")[0];
                            myAgeDivList = new AgeGroupDropdownList( myTourRow );

                            //Setup for meter input if using meters to calculate distances
                            NumJudges = Convert.ToInt16( myTourProperties.JumpEntryNumJudges);
                            if ( NumJudges > 0 ) {
                                JumpCalcMetersCB.Checked = true;
                                JumpCalcVideoCB.Checked = false;
                            } else {
                                JumpCalcMetersCB.Checked = false;
                                JumpCalcVideoCB.Checked = true;
                            }

                            //Retrieve boat times
                            StringBuilder curSqlStmt = new StringBuilder( "" );
                            curSqlStmt.Append( "SELECT ListCode, CodeValue, MinValue, MaxValue, CodeDesc FROM CodeValueList WHERE ListName = 'JumpBoatTime3Seg' ORDER BY SortSeq" );
                            myTimesDataTable = getData( curSqlStmt.ToString() );

                            //Retrieve maximum speeds by age group
                            getMaxSpeedData();

                            //Retrieve minimum speeds by class
                            getMinSpeedData();

                            //Retrieve maximum ramp heights by age group
                            getMaxRampData();

                            //Retrieve list of divisions and scores that require 3 segment validation for L and R tournaments
                            try {
                                DataTable curTourClassDataTable = mySkierClassList.getTourClassList();
                                myClassRow = curTourClassDataTable.Select( "ListCode = '" + myTourClass + "'" )[0];
                                if ((Decimal)myClassRow["ListCodeNum"] > (Decimal)myClassERow["ListCodeNum"]) {
                                    getJump3TimesDivData();
                                } else {
                                    myJump3TimesDivDataTable = null;
                                }
                            } catch {
                                myJump3TimesDivDataTable = null;
                            }

                            //Get list of approved tow boats
                            getApprovedTowboats();
                            BoatSelectInfoLabel.Visible = false;
                            listApprovedBoatsDataGridView.Visible = false;

                            //Retrieve and load tournament event entries
                            loadEventGroupList( Convert.ToByte( roundActiveSelect.RoundValue ) );

                            if (ExportLiveWeb.LiveWebLocation.Length > 1) {
                                LiveWebLabel.Visible = true;
                            } else {
                                LiveWebLabel.Visible = false;
                            }
                        } else {
                            MessageBox.Show( "The jump event is not defined for the active tournament" );
                        }
                    } else {
                        MessageBox.Show( "The active tournament is not properly defined.  You must select from the Administration menu Tournament List option" );
                    }
                }
            }
            Cursor.Current = Cursors.Default;
        }
        private void RunningOrderTour_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.RunningOrder_Width > 0) {
                this.Width = Properties.Settings.Default.RunningOrder_Width;
            }
            if (Properties.Settings.Default.RunningOrder_Height > 0) {
                this.Height = Properties.Settings.Default.RunningOrder_Height;
            }
            if (Properties.Settings.Default.RunningOrder_Location.X > 0
                && Properties.Settings.Default.RunningOrder_Location.Y > 0) {
                this.Location = Properties.Settings.Default.RunningOrder_Location;
            }
            isLoadInProg = true;
            myTourProperties = TourProperties.Instance;

            String[] curList = { "SkierName", "EventGroup", "Div", "DivOrder", "RunOrder", "TeamCode", "EventClass", "RankingScore", "RankingRating", "JumpHeight", "HCapBase", "HCapScore" };
            sortDialogForm = new SortDialogForm();
            sortDialogForm.ColumnListArray = curList;

            filterDialogForm = new Common.FilterDialogForm();
            filterDialogForm.ColumnListArray = curList;

            // 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");
                //this.Close();
            } else {
                if (mySanctionNum.Length < 6) {
                    MessageBox.Show("An active tournament must be selected from the Administration menu Tournament List option");
                    //this.Close();
                } else {
                    //Retrieve selected tournament attributes
                    DataTable curTourDataTable = getTourData( mySanctionNum );
                    if ( curTourDataTable.Rows.Count > 0 ) {
                        myTourRow = curTourDataTable.Rows[0];
                        myTourRules = (String)myTourRow["Rules"];
                        myTourEventClass = (String)myTourRow["EventClass"];
                        myTourClass = (String)myTourRow["Class"];

                        mySkierClassList = new ListSkierClass();
                        mySkierClassList.ListSkierClassLoad();
                        EventClass.DataSource = mySkierClassList.DropdownList;
                        EventClass.DisplayMember = "ItemName";
                        EventClass.ValueMember = "ItemValue";

                        if ( myTourRow["SlalomRounds"] == DBNull.Value ) { myTourRow["SlalomRounds"] = 0; }
                        if ( myTourRow["TrickRounds"] == DBNull.Value ) { myTourRow["TrickRounds"] = 0; }
                        if ( myTourRow["JumpRounds"] == DBNull.Value ) { myTourRow["JumpRounds"] = 0; }
                        if ( Convert.ToInt16( myTourRow["SlalomRounds"] ) == 0 ) {
                            slalomButton.Visible = false;
                        }
                        if ( Convert.ToInt16( myTourRow["TrickRounds"] ) == 0 ) {
                            trickButton.Visible = false;
                        }
                        if ( Convert.ToInt16( myTourRow["JumpRounds"] ) == 0 ) {
                            jumpButton.Visible = false;
                        }

                        myFilterCmd = "";
                        if (slalomButton.Checked) {
                            mySortCmd = myTourProperties.RunningOrderSortSlalom;
                        } else if (trickButton.Checked) {
                            mySortCmd = myTourProperties.RunningOrderSortTrick;
                        } else if (jumpButton.Checked) {
                            mySortCmd = myTourProperties.RunningOrderSortJump;
                        }

                        if (ExportLiveWeb.LiveWebLocation.Length > 1) {
                            LiveWebLabel.Visible = true;
                        } else {
                            LiveWebLabel.Visible = false;
                        }
                    } else {
                        MessageBox.Show( "An active tournament must be selected from the Administration menu Tournament List option" );
                    }
                }
            }
            isDataModified = false;
            isLoadInProg = false;
        }