protected void Page_Load(object sender, EventArgs e) { if (((SiteMaster)this.Master).LeagueName != null) { this.leagueID = leagueID = (int)((SiteMaster)this.Master).LeagueID; } else { //error? Response.Redirect("NoLeague.aspx"); } currentSeasonID = DatabaseFunctions.GetCurrentSeasonID(leagueID.ToString()); eventsAndGolfers = DatabaseFunctions.GetEventsAndPlayers(leagueID, currentSeasonID); //Dictionary<int, string> courses = DatabaseFunctions.GetAllCourses(); //Dictionary<int, string> teams = DatabaseFunctions.GetTeamNames(leagueID, currentSeasonID); if (!Page.IsPostBack) { ListItem initialItem = new ListItem("Select Event to Continue", "0"); Dropdown_LeagueEvent.Items.Add(initialItem); //TODO only add events in current season? foreach (KeyValuePair <int, EventInfo> eventPair in eventsAndGolfers.events.OrderBy(x => x.Value.EventID)) { int eventID = eventPair.Key; ListItem eventItem = new ListItem(eventsAndGolfers.events[eventID].EventName, eventID.ToString()); Dropdown_LeagueEvent.Items.Add(eventItem); } Dropdown_LeagueEvent.SelectedIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { currentUserID = ((SiteMaster)this.Master).currentUserID; leagueID = (int)((SiteMaster)this.Master).LeagueID; if (!Page.IsPostBack) { EventsAndGolfers ev = DatabaseFunctions.GetEventsAndPlayers(leagueID); foreach (int eventID in ev.events.Keys) { ListItem itemToAdd = new ListItem(ev.events[eventID].EventName, eventID.ToString()); Dropdown_Events.Items.Add(itemToAdd); } } }
protected void Page_Load(object sender, EventArgs e) { Player1ScoreTextBoxes = new List <TextBox>() { TextBox_P1_Hole1, TextBox_P1_Hole2, TextBox_P1_Hole3, TextBox_P1_Hole4, TextBox_P1_Hole5, TextBox_P1_Hole6, TextBox_P1_Hole7, TextBox_P1_Hole8, TextBox_P1_Hole9 }; Player2ScoreTextBoxes = new List <TextBox>() { TextBox_P2_Hole1, TextBox_P2_Hole2, TextBox_P2_Hole3, TextBox_P2_Hole4, TextBox_P2_Hole5, TextBox_P2_Hole6, TextBox_P2_Hole7, TextBox_P2_Hole8, TextBox_P2_Hole9 }; Player3ScoreTextBoxes = new List <TextBox>() { TextBox_P3_Hole1, TextBox_P3_Hole2, TextBox_P3_Hole3, TextBox_P3_Hole4, TextBox_P3_Hole5, TextBox_P3_Hole6, TextBox_P3_Hole7, TextBox_P3_Hole8, TextBox_P3_Hole9 }; Player4ScoreTextBoxes = new List <TextBox>() { TextBox_P4_Hole1, TextBox_P4_Hole2, TextBox_P4_Hole3, TextBox_P4_Hole4, TextBox_P4_Hole5, TextBox_P4_Hole6, TextBox_P4_Hole7, TextBox_P4_Hole8, TextBox_P4_Hole9 }; if (((SiteMaster)this.Master).LeagueName != null) { this.leagueID = leagueID = (int)((SiteMaster)this.Master).LeagueID; } else { //error? Response.Redirect("NoLeague.aspx"); } currentSeasonID = DatabaseFunctions.GetCurrentSeasonID(leagueID.ToString()); EventsAndGolfers eventsAndGolfers = DatabaseFunctions.GetEventsAndPlayers(leagueID, currentSeasonID); Dictionary <int, string> courses = DatabaseFunctions.GetAllCourses(); Dictionary <int, string> teams = DatabaseFunctions.GetTeamNames(leagueID); if (!Page.IsPostBack) { ListItem initialItem = new ListItem("Select Event to Continue", "0"); Dropdown_LeagueEvent.Items.Add(initialItem); //TODO only add events in current season? foreach (int eventID in eventsAndGolfers.events.Keys) { ListItem eventItem = new ListItem(eventsAndGolfers.events[eventID].EventName, eventID.ToString()); Dropdown_LeagueEvent.Items.Add(eventItem); } Dropdown_LeagueEvent.SelectedIndex = 0; ListItem itemToAdd = new ListItem("Select Course", "0"); DropDownCourseSelect.Items.Add(itemToAdd); foreach (int courseID in courses.Keys) { ListItem newItem = new ListItem(courses[courseID], courseID.ToString()); DropDownCourseSelect.Items.Add(newItem); } //Add All Players in League to the Sub Selection Box } }
protected void Page_Load(object sender, EventArgs e) { leagueID = (int)((SiteMaster)this.Master).LeagueID; if (Panel_Teams.Controls.Count == 0) { eventsAndGolfers = DatabaseFunctions.GetEventsAndPlayers((int)leagueID); int currentSeasonID = DatabaseFunctions.GetCurrentSeasonID(leagueID.ToString()); Dictionary <int, string> teams = DatabaseFunctions.GetTeamNames((int)leagueID); Table teamTable = new Table(); teamTable.Width = 800; TableRow titleRow1 = new TableRow(); teamTable.Rows.Add(titleRow1); TableCell cell3 = new TableCell(); cell3.Text = "Edit Current Teams"; cell3.Font.Bold = true; cell3.ForeColor = Color.Black; cell3.Font.Size = 20; cell3.HorizontalAlign = HorizontalAlign.Center; cell3.ColumnSpan = 4; cell3.BorderStyle = BorderStyle.Solid; titleRow1.Cells.Add(cell3); TableRow titleRow2 = new TableRow(); AddCell(titleRow2, "Hide for future Events", true, 1); AddCell(titleRow2, "Team Name", true, 1); AddCell(titleRow2, "Golfer 1", true, 1); AddCell(titleRow2, "Golfer 2", true, 1); teamTable.Rows.Add(titleRow2); foreach (int teamID in teams.Keys) { TableRow teamRow = new TableRow(); CheckBox cBox = new CheckBox(); //cBox.Width = 80; //cBox.Height = 80; //cBox.Checked = DatabaseFunctions.isTeamActiveInSeason(teamID, currentSeasonID); cBox.CheckedChanged += SetTeamActive; cBox.AutoPostBack = true; cBox.ID = "TeamActive_" + teamID.ToString(); TableCell cell = new TableCell(); cell.HorizontalAlign = HorizontalAlign.Center; cell.Controls.Add(cBox); teamRow.Cells.Add(cell); TableCell cell2 = new TableCell(); TextBox teamName = new TextBox(); teamName.Width = 300; teamName.Text = teams[teamID]; cell2.Controls.Add(teamName); Button editButton = new Button(); editButton.ID = "Team_" + teamID.ToString(); editButton.Text = "Save"; editButton.Command += SaveTeamName; cell2.Controls.Add(editButton); teamRow.Cells.Add(cell2); Dictionary <int, string> golferNames = DatabaseFunctions.GetGolfers(teamID); AddCell(teamRow, golferNames.Values.ToList()[0], true, 1); AddCell(teamRow, golferNames.Values.ToList()[1], true, 1); teamTable.Rows.Add(teamRow); selectedTeams.Add(teamID, cBox); } Panel_Teams.Controls.Add(teamTable); } //Panel_Teams.Controls.Add(new LiteralControl("<br/>")); if (!Page.IsPostBack) { //Dropdown_Player1Select.Items.Clear(); //Dropdown_Player2Select.Items.Clear(); ListItem player1 = new ListItem("Select First Player", "0"); ListItem player2 = new ListItem("Select Second Player", "0"); Dropdown_Player1Select.Items.Add(player1); Dropdown_Player2Select.Items.Add(player2); foreach (int golferID in eventsAndGolfers.golfers.Keys) { ListItem temp = new ListItem(eventsAndGolfers.golfers[golferID], golferID.ToString()); Dropdown_Player1Select.Items.Add(temp); Dropdown_Player2Select.Items.Add(temp); } } }
protected void Page_Load(object sender, EventArgs e) { leagueID = (int)((SiteMaster)this.Master).LeagueID; currentSeasonID = DatabaseFunctions.GetCurrentSeasonID(leagueID.ToString()); EventsAndGolfers eventsAndGolfers = DatabaseFunctions.GetEventsAndPlayers(leagueID, currentSeasonID); Dictionary <int, string> teamNames = DatabaseFunctions.GetTeamNames(leagueID); //Table topLevelTable = new Table(); //Table table = new Table(); TableSchedule.Width = 900; TableSchedule.HorizontalAlign = HorizontalAlign.Center; //TableSchedule.BorderStyle = BorderStyle.Solid; //TableSchedule.BorderWidth = 5; //TableSchedule.BorderColor = Color.Black; //TableSchedule.CellPadding = 5; TableSchedule.CellSpacing = 5; //List<int> eventIDs = eventsAndGolfers.events.Keys.ToList(); //eventIDs.Sort(); SortedDictionary <int, int> sortedEvents = new SortedDictionary <int, int>(); foreach (int EventID in eventsAndGolfers.events.Keys) { sortedEvents.Add(EventID, EventID); } foreach (int EventID in sortedEvents.Values) { TableRow titlerow = new TableRow(); titlerow.Style.Add(HtmlTextWriterStyle.BorderStyle, "solid"); titlerow.Style.Add(HtmlTextWriterStyle.BorderWidth, "3px"); TableCell titleCell = new TableCell(); titleCell.Width = 300; Label eventNameLabel = new Label(); eventNameLabel.ForeColor = Color.Black; eventNameLabel.Font.Bold = true; eventNameLabel.Font.Size = 16; eventNameLabel.Text = eventsAndGolfers.events[EventID].EventName; titleCell.Controls.Add(eventNameLabel); //titleCell.BorderStyle = BorderStyle.Solid; titleCell.BorderColor = Color.Black; titleCell.HorizontalAlign = HorizontalAlign.Center; titlerow.Cells.Add(titleCell); TableCell dateCell = new TableCell(); dateCell.Text = eventsAndGolfers.events[EventID].Date; dateCell.Font.Bold = true; dateCell.HorizontalAlign = HorizontalAlign.Center; // dateCell.BorderStyle = BorderStyle.Solid; dateCell.BorderColor = Color.Black; titlerow.Cells.Add(dateCell); TableCell courseCell = new TableCell(); courseCell.Text = eventsAndGolfers.events[EventID].CourseName; courseCell.Font.Bold = true; //courseCell.BorderStyle = BorderStyle.Solid; courseCell.HorizontalAlign = HorizontalAlign.Center; courseCell.BorderColor = Color.Black; titlerow.Cells.Add(courseCell); TableSchedule.Rows.Add(titlerow); Dictionary <int, int> matchups = DatabaseFunctions.GetMatchups(EventID); bool toggle = true; foreach (int team1ID in matchups.Keys) { TableRow matchupRow = new TableRow(); TableCell matchupCell = new TableCell(); matchupCell.ColumnSpan = 3; matchupCell.HorizontalAlign = HorizontalAlign.Center; Label matchupLabel = new Label(); int team2ID = matchups[team1ID]; matchupLabel.Text = teamNames[team1ID] + " vs. " + teamNames[team2ID]; matchupCell.Controls.Add(matchupLabel); matchupRow.Cells.Add(matchupCell); if (toggle) { matchupRow.BackColor = Color.WhiteSmoke; } toggle = !toggle; TableSchedule.Rows.Add(matchupRow); } } }