protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { hdnEventID.Value = Request.QueryString["eventid"]; using (PortalDataContext pdc = new PortalDataContext()) { txtEvent.Text = (from ev in pdc.Events where ev.EventID == hdnEventID.Value.ToInt() select ev.Name).SingleOrDefault(); } ddlStartMonth.DataSource = clsDateTime.GetMonths(); ddlStartMonth.DataValueField = "pvalue"; ddlStartMonth.DataTextField = "ptext"; ddlStartMonth.DataBind(); ddlStartDay.DataSource = clsDateTime.GetDays(); ddlStartDay.DataValueField = "pvalue"; ddlStartDay.DataTextField = "ptext"; ddlStartDay.DataBind(); ddlStartHour.DataSource = clsDateTime.GetHours(); ddlStartHour.DataValueField = "pvalue"; ddlStartHour.DataTextField = "ptext"; ddlStartHour.DataBind(); ddlStartMinute.DataSource = clsDateTime.GetMinutes(); ddlStartMinute.DataValueField = "pvalue"; ddlStartMinute.DataTextField = "ptext"; ddlStartMinute.DataBind(); ddlStartTimePeriod.DataSource = clsDateTime.GetTimePeriod(); ddlStartTimePeriod.DataValueField = "pvalue"; ddlStartTimePeriod.DataTextField = "ptext"; ddlStartTimePeriod.DataBind(); ddlEndMonth.DataSource = clsDateTime.GetMonths(); ddlEndMonth.DataValueField = "pvalue"; ddlEndMonth.DataTextField = "ptext"; ddlEndMonth.DataBind(); ddlEndDay.DataSource = clsDateTime.GetDays(); ddlEndDay.DataValueField = "pvalue"; ddlEndDay.DataTextField = "ptext"; ddlEndDay.DataBind(); ddlEndHour.DataSource = clsDateTime.GetHours(); ddlEndHour.DataValueField = "pvalue"; ddlEndHour.DataTextField = "ptext"; ddlEndHour.DataBind(); ddlEndMinute.DataSource = clsDateTime.GetMinutes(); ddlEndMinute.DataValueField = "pvalue"; ddlEndMinute.DataTextField = "ptext"; ddlEndMinute.DataBind(); ddlEndTimePeriod.DataSource = clsDateTime.GetTimePeriod(); ddlEndTimePeriod.DataValueField = "pvalue"; ddlEndTimePeriod.DataTextField = "ptext"; ddlEndTimePeriod.DataBind(); ddlGamePhase.DataSource = DALPortal.DSLGamePhase(); ddlGamePhase.DataValueField = "pvalue"; ddlGamePhase.DataTextField = "ptext"; ddlGamePhase.DataBind(); ddlStartMonth.SelectedValue = DateTime.Now.Month.ToString(); ddlStartDay.SelectedValue = DateTime.Now.Day.ToString(); txtStartYear.Text = DateTime.Now.Year.ToString(); ddlEndMonth.SelectedValue = DateTime.Now.Month.ToString(); ddlEndDay.SelectedValue = DateTime.Now.Day.ToString(); txtEndYear.Text = DateTime.Now.Year.ToString(); ddlWinner.DataSource = DALPortal.DSLTeamNA(); ddlWinner.DataValueField = "TeamID"; ddlWinner.DataTextField = "TeamName"; ddlWinner.DataBind(); } }
/////////////////////////////// ///////// Form Events ///////// /////////////////////////////// protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bool blnHasAccess = clsSystemModule.HasAccess(clsSystemModule.ModuleSynergy, Request.Cookies["Speedo"]["Username"]); hdnGameID.Value = Request.QueryString["gameid"]; ddlStartMonth.DataSource = clsDateTime.GetMonths(); ddlStartMonth.DataValueField = "pvalue"; ddlStartMonth.DataTextField = "ptext"; ddlStartMonth.DataBind(); ddlStartDay.DataSource = clsDateTime.GetDays(); ddlStartDay.DataValueField = "pvalue"; ddlStartDay.DataTextField = "ptext"; ddlStartDay.DataBind(); ddlStartHour.DataSource = clsDateTime.GetHours(); ddlStartHour.DataValueField = "pvalue"; ddlStartHour.DataTextField = "ptext"; ddlStartHour.DataBind(); ddlStartMinute.DataSource = clsDateTime.GetMinutes(); ddlStartMinute.DataValueField = "pvalue"; ddlStartMinute.DataTextField = "ptext"; ddlStartMinute.DataBind(); ddlStartTimePeriod.DataSource = clsDateTime.GetTimePeriod(); ddlStartTimePeriod.DataValueField = "pvalue"; ddlStartTimePeriod.DataTextField = "ptext"; ddlStartTimePeriod.DataBind(); ddlEndMonth.DataSource = clsDateTime.GetMonths(); ddlEndMonth.DataValueField = "pvalue"; ddlEndMonth.DataTextField = "ptext"; ddlEndMonth.DataBind(); ddlEndDay.DataSource = clsDateTime.GetDays(); ddlEndDay.DataValueField = "pvalue"; ddlEndDay.DataTextField = "ptext"; ddlEndDay.DataBind(); ddlEndHour.DataSource = clsDateTime.GetHours(); ddlEndHour.DataValueField = "pvalue"; ddlEndHour.DataTextField = "ptext"; ddlEndHour.DataBind(); ddlEndMinute.DataSource = clsDateTime.GetMinutes(); ddlEndMinute.DataValueField = "pvalue"; ddlEndMinute.DataTextField = "ptext"; ddlEndMinute.DataBind(); ddlEndTimePeriod.DataSource = clsDateTime.GetTimePeriod(); ddlEndTimePeriod.DataValueField = "pvalue"; ddlEndTimePeriod.DataTextField = "ptext"; ddlEndTimePeriod.DataBind(); ddlWinner.DataSource = DALPortal.DSLTeamNA(); ddlWinner.DataValueField = "TeamID"; ddlWinner.DataTextField = "TeamName"; ddlWinner.DataBind(); ddlGamePhase.DataSource = DALPortal.DSLGamePhase(); ddlGamePhase.DataValueField = "pvalue"; ddlGamePhase.DataTextField = "ptext"; ddlGamePhase.DataBind(); using (PortalDataContext pdc = new PortalDataContext()) { EventGame eventGame = (from eg in pdc.EventGames where eg.GameID == hdnGameID.Value.ToInt() select eg).SingleOrDefault(); hdnEventID.Value = eventGame.EventID.ToString(); txtEvent.Text = DALPortal.GetEventName(eventGame.EventID); ddlGamePhase.SelectedValue = eventGame.GamePhase.ToString(); txtStartYear.Text = eventGame.StartDate.Year.ToString(); ddlStartMonth.SelectedValue = eventGame.StartDate.Month.ToString(); ddlStartDay.SelectedValue = eventGame.StartDate.Day.ToString(); ddlStartHour.SelectedValue = eventGame.StartDate.ToString("hh"); ddlStartMinute.SelectedValue = eventGame.StartDate.Minute.ToString(); ddlStartTimePeriod.SelectedValue = eventGame.StartDate.ToString("tt"); txtEndYear.Text = eventGame.EndDate.Year.ToString(); ddlEndMonth.SelectedValue = eventGame.EndDate.Month.ToString(); ddlEndDay.SelectedValue = eventGame.EndDate.Day.ToString(); ddlEndHour.SelectedValue = eventGame.EndDate.ToString("hh"); ddlEndMinute.SelectedValue = eventGame.EndDate.Minute.ToString(); ddlEndTimePeriod.SelectedValue = eventGame.EndDate.ToString("tt"); txtLocation.Text = eventGame.Location; ddlWinner.SelectedValue = eventGame.WinnerTeamID.ToString(); chkFinished.Checked = eventGame.IsFinished; } if (blnHasAccess) { trSaveSchedule.Visible = true; } else { trSaveSchedule.Visible = false; ddlGamePhase.Enabled = false; ddlStartMonth.Enabled = false; ddlStartDay.Enabled = false; txtStartYear.Enabled = false; ddlStartHour.Enabled = false; ddlStartMinute.Enabled = false; ddlStartTimePeriod.Enabled = false; ddlEndMonth.Enabled = false; ddlEndDay.Enabled = false; txtEndYear.Enabled = false; ddlEndHour.Enabled = false; ddlEndMinute.Enabled = false; ddlEndTimePeriod.Enabled = false; txtLocation.ReadOnly = true; txtLocation.BackColor = System.Drawing.Color.AliceBlue; ddlWinner.Enabled = false; chkFinished.Enabled = false; } this.LoadOfficials(); this.LoadCompetingTeams(); } }