private int lookupEstimatedAtBatForLineup(List <Dictionary <int, int> > results, LineupDataObj lineup)
        {
            int        pitcherArmIndex = lineup.PitcherArm.Equals("L") ? 0 : 1;
            LineupData data            = lineup.getLineupData();
            int        estimatedAtBats = SOMTeamReportFile.calculateAtBatsByLineup(results[pitcherArmIndex], data);

            return(estimatedAtBats);
        }
        private void BTN_DELETE_Click(object sender, EventArgs e)
        {
            LineupDataObj selected = (LineupDataObj)listBox1.SelectedItem;

            if (selected != null)
            {
                listBox1.Items.Remove(selected);
                storedLineups.Lineups.Remove(selected.getLineupData());
                BTN_DELETE.Enabled = listBox1.Items.Count > 0;
                BTN_EDIT.Enabled   = listBox1.Items.Count > 0;
                BTN_SAVE.Enabled   = true;
            }
        }
        private void BTN_ADD_Click(object sender, EventArgs e)
        {
            LineupMgrDlg dlg = new LineupMgrDlg();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                LineupDataObj data = dlg.WorkingLineup;
                storedLineups.Lineups.Add(data.getLineupData());
                listBox1.Items.Add(data);
            }
            if (listBox1.Items.Count > 0)
            {
                BTN_SAVE.Enabled   = true;
                BTN_DELETE.Enabled = true;
            }
        }
        private void updateWorkbook(Team team, List <Player> players)
        {
            if (GRID.ColumnDefinitions.Count > 0)
            {
                GRID.ColumnDefinitions.RemoveRange(0, GRID.ColumnDefinitions.Count);
                GRID.Children.RemoveRange(0, GRID.Children.Count);
            }

            buildWorksheetLabelColumn();

            TeamLineup lineups = engine.StoredLineups[team.Abrv];
            int        index   = 1;
            int        box     = 1;

            foreach (LineupData lineupData in lineups.Lineups)
            {
                LineupDataObj lineup = new LineupDataObj(lineupData);

                int pitcherArmIndex = lineup.PitcherArm.Equals("L") ? 0 : 1;
                lineup.EstimatedAtBats = calculateAtBatsByLineup(engine.BalanceAtBats[pitcherArmIndex], lineup.getLineupData());

                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.CATCHER, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.FIRSTBASE, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.SECONDBASE, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.THIRDBASE, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.SHORTSTOP, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.LEFTFIELD, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.CENTERFIELD, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.RIGHTFIELD, lineup, players, box++));
                GRID.Children.Add(BuildPlayerPostitionBox(index, POSITIONS.DH, lineup, players, box++));

                createColumn(lineup, index, 160);

                index++;
            }

            GRID.UpdateLayout();
        }