protected void LoadLatesActiveEvent() { string strWrite = ""; int intCountEvents = 0; DateTime latestDate = DALPortal.GetLatestGameDate(); if (latestDate != DateTime.MinValue) { DateTime latestDateStart = clsDateTime.ChangeTimeToStart(latestDate); DateTime latestDateEnd = clsDateTime.ChangeTimeToEnd(latestDate); List <EventGame> eventGamesList = new List <EventGame>(); using (PortalDataContext pdc = new PortalDataContext()) { eventGamesList = (from eg in pdc.EventGames where eg.IsActive == true && eg.StartDate >= latestDateStart && eg.IsFinished == false && eg.EventID == GetActiveEvent().ToInt() orderby eg.StartDate select eg).ToList(); } foreach (EventGame eg in eventGamesList) { strWrite += "<table>" + "<tr>" + "<td>" + "<img src='../Support/play16red.png' alt='' />" + "</td>" + "<td style='font-size: 18pt; font-family: Arial; font-weight: bold'>" + eg.StartDate.ToString("MMM dd, yyyy") + "</td>" + "</tr>" + "<tr>" + "<td> </td>" + "<td>" + DALPortal.GetGamePhaseName(eg.GamePhase.ToString()) + "<br/>(" + eg.StartDate.ToString("hh:mm tt") + ", " + eg.Location + ")" + "<br/>" + this.LoadLatestScheduleTeams1(eg.GameID, eg.EventID) + " </td>" + "<tr>" + "</table>"; break; } } litLatestEvent.Text = strWrite; }
protected void LoadLatestSchedule() { string strWrite = ""; int intCountEvents = 0; int intCount = 0; DateTime latestDate = DALPortal.GetLatestGameDate(); if (latestDate != DateTime.MinValue) { DateTime latestDateStart = clsDateTime.ChangeTimeToStart(latestDate); DateTime latestDateEnd = clsDateTime.ChangeTimeToEnd(latestDate); List <EventGame> eventGamesList = new List <EventGame>(); using (PortalDataContext pdc = new PortalDataContext()) { eventGamesList = (from eg in pdc.EventGames where eg.IsActive == true && eg.StartDate >= latestDateStart && eg.IsFinished == false orderby eg.StartDate select eg).ToList(); } intCount = eventGamesList.Count; foreach (EventGame eg in eventGamesList) { if (intCountEvents > 4) { break; } strWrite += "<div class='GridBorder' style='text-align:center;border-color: #FFFFFF; font-size: 11px; line-height:5px'>" + "<table style='width:100%;border-color: #FFFFFF;'>" + "<tr><td style='border-color: #FFFFFF;'><b><a href='" + clsSystemConfigurations.PortalRootURL + "/Synergy/EventDetails.aspx?eventid=" + eg.EventID.ToString() + "'>" + DALPortal.GetEventName(eg.EventID) + "</a></b></td></tr>" + "<tr><td style='border-color: #FFFFFF;'>" + DALPortal.GetGamePhaseName(eg.GamePhase.ToString()) + "</td></tr>" + this.LoadLatestScheduleTeams(eg.GameID, eg.EventID) + "<tr><td style='color:Black;border-color: #FFFFFF;'>" + eg.StartDate.ToString("hh:mm tt ddd, MMM dd") + "</td></tr>" + "<tr><td style='color:Black;border-color: #FFFFFF;'>@ " + eg.Location + "</td></tr>" + "</table><hr/>" + "</div>"; intCountEvents++; } } if (intCount > 0) { masterlitLatestSchedule.Text = "<div class='' ><div class='' style='font-weight:bold'>Game Schedule</div><div class='masterpanelspace'></div>" + strWrite + "</div>"; } }
private void LoadUpcomingSchedules() { using (PortalDataContext pdc = new PortalDataContext()) { var q = (from eg in pdc.EventGames join e in pdc.Events on eg.EventID equals e.EventID into eeg from eegx in eeg.DefaultIfEmpty() where eg.IsActive == true && eg.StartDate >= DateTime.Now.Date orderby eg.StartDate select new { EventID = eg.EventID, EventName = eegx.Name, GameID = eg.GameID, StartDate = eg.StartDate, GamePhase = eg.GamePhase, Location = eg.Location, WinnerTeamID = eg.WinnerTeamID }); dgSchedule.DataSource = q.ToList(); dgSchedule.DataBind(); foreach (DataGridItem ditm in dgSchedule.Items) { HiddenField phdnGameID = (HiddenField)ditm.FindControl("hdnGameID"); Literal plitTeams = (Literal)ditm.FindControl("litTeams"); HiddenField phdnWinner = (HiddenField)ditm.FindControl("hdnWinner"); Image pimgWinner = (Image)ditm.FindControl("imgWinner"); HiddenField phdnGamePhase = (HiddenField)ditm.FindControl("hdnGamePhase"); Label plblGamePhase = (Label)ditm.FindControl("lblGamePhase"); List <EventGameTeam> egtList = new List <EventGameTeam>(); egtList = (from egt in pdc.EventGameTeams where egt.GameID == phdnGameID.Value.ToInt() orderby egt.TeamID select egt).ToList(); foreach (EventGameTeam egt in egtList) { string teamLogo = (from t in pdc.Teams where t.TeamID == egt.TeamID select t.TeamLogo).SingleOrDefault(); if (teamLogo.Length > 0) { plitTeams.Text += "<td><img src='" + teamLogo + "'></td>"; } } if (plitTeams.Text.Trim().Length > 0) { plitTeams.Text = "<table cellpadding='5'><tr>" + plitTeams.Text + "</tr></table>"; } if (phdnWinner.Value == "" || phdnWinner.Value == "0") { pimgWinner.Visible = false; } else { pimgWinner.ImageUrl = (from t in pdc.Teams where t.TeamID == phdnWinner.Value.ToInt() select t.TeamLogo).SingleOrDefault(); } plblGamePhase.Text = DALPortal.GetGamePhaseName(phdnGamePhase.Value); } } }
private void LoadEventScheduleList() { bool blnHasAccess = clsSystemModule.HasAccess(clsSystemModule.ModuleSynergy, Request.Cookies["Speedo"]["Username"]); List <EventGame> eventGameList = new List <EventGame>(); using (PortalDataContext pdc = new PortalDataContext()) { eventGameList = (from eg in pdc.EventGames where eg.IsActive == true && eg.EventID == hdnEventID.Value.ToInt() orderby eg.StartDate select eg).ToList(); dgSchedule.DataSource = eventGameList; dgSchedule.DataBind(); dgSchedule.Columns[1].Visible = blnHasAccess; if (dgSchedule.Items.Count > 0) { divSchedule.Visible = true; lblNoSchedule.Visible = false; foreach (DataGridItem ditm in dgSchedule.Items) { HiddenField phdnGameID = (HiddenField)ditm.FindControl("hdnGameID"); Literal plitTeams = (Literal)ditm.FindControl("litTeams"); HiddenField phdnWinner = (HiddenField)ditm.FindControl("hdnWinner"); Image pimgWinner = (Image)ditm.FindControl("imgWinner"); HiddenField phdnFinished = (HiddenField)ditm.FindControl("hdnFinished"); Image pimgFinished = (Image)ditm.FindControl("imgFinished"); HiddenField phdnGamePhase = (HiddenField)ditm.FindControl("hdnGamePhase"); Label plblGamePhase = (Label)ditm.FindControl("lblGamePhase"); List <EventGameTeam> egtList = new List <EventGameTeam>(); egtList = (from egt in pdc.EventGameTeams where egt.GameID == phdnGameID.Value.ToInt() orderby egt.TeamID select egt).ToList(); foreach (EventGameTeam egt in egtList) { string teamLogo = (from t in pdc.Teams where t.TeamID == egt.TeamID select t.TeamLogo).SingleOrDefault(); if (teamLogo.Length > 0) { plitTeams.Text += "<td><img src='" + teamLogo + "'></td>"; } } if (plitTeams.Text.Trim().Length > 0) { plitTeams.Text = "<table cellpadding='5'><tr>" + plitTeams.Text + "</tr></table>"; } if (phdnWinner.Value == "" || phdnWinner.Value == "0") { pimgWinner.Visible = false; } else { pimgWinner.ImageUrl = DALPortal.GetTeamLogo(phdnWinner.Value.ToInt()); } pimgFinished.ImageUrl = "~/Support/" + (phdnFinished.Value == "True" ? "check16" : "history16") + ".png"; plblGamePhase.Text = DALPortal.GetGamePhaseName(phdnGamePhase.Value); } } else { divSchedule.Visible = false; lblNoSchedule.Visible = true; } } }
private void BindEventScheduleList() { using (PortalDataContext pdc = new PortalDataContext()) { var predicate = PredicateBuilder.True <EventGame>(); if (ddlEvent.SelectedValue != "ALL") { predicate = predicate.And(p => p.EventID == ddlEvent.SelectedValue.ToInt()); } if (ddlTeam.SelectedValue != "ALL") { predicate = predicate.And(p => (from egt in pdc.EventGameTeams where egt.TeamID == ddlTeam.SelectedValue.ToInt() select egt.GameID).Contains(p.GameID)); } var q = (from eg in pdc.EventGames.Where(predicate) where eg.IsActive == true && (from ev in pdc.Events where ev.ActivityID == SynergyCurrentID select ev.EventID).Contains(eg.EventID) let xEventName = (from ev in pdc.Events where ev.EventID == eg.EventID select ev.Name).SingleOrDefault() orderby eg.StartDate select new { EventID = eg.EventID, EventName = xEventName, GameID = eg.GameID, GamePhase = eg.GamePhase, StartDate = eg.StartDate, Location = eg.Location, WinnerTeamID = eg.WinnerTeamID, IsFinished = eg.IsFinished }).ToList(); dgSchedule.DataSource = q; dgSchedule.DataBind(); foreach (DataGridItem ditm in dgSchedule.Items) { HiddenField phdnEventID = (HiddenField)ditm.FindControl("hdnEventID"); HiddenField phdnGameID = (HiddenField)ditm.FindControl("hdnGameID"); HiddenField phdnDateStart = (HiddenField)ditm.FindControl("hdnDateStart"); Label plblDateStart = (Label)ditm.FindControl("lblDateStart"); Literal plitTeams = (Literal)ditm.FindControl("litTeams"); HiddenField phdnWinner = (HiddenField)ditm.FindControl("hdnWinner"); Image pimgWinner = (Image)ditm.FindControl("imgWinner"); HiddenField phdnGamePhase = (HiddenField)ditm.FindControl("hdnGamePhase"); Label plblGamePhase = (Label)ditm.FindControl("lblGamePhase"); List <EventGameTeam> egtList = new List <EventGameTeam>(); egtList = (from egt in pdc.EventGameTeams where egt.GameID == phdnGameID.Value.ToInt() orderby egt.TeamID select egt).ToList(); foreach (EventGameTeam egt in egtList) { string teamLogo = (from t in pdc.Teams where t.TeamID == egt.TeamID select t.TeamLogo).SingleOrDefault(); if (teamLogo.Length > 0) { plitTeams.Text += "<td><img src='" + teamLogo + "' Width='50px' Height='50px'></td>"; } } if (plitTeams.Text.Trim().Length > 0) { plitTeams.Text = "<table cellpadding='5'><tr>" + plitTeams.Text + "</tr></table>"; } if (phdnWinner.Value == "" || phdnWinner.Value == "0") { pimgWinner.Visible = false; } else { pimgWinner.ImageUrl = DALPortal.GetTeamLogo(phdnWinner.Value.ToInt()); } plblDateStart.Text = clsValidator.CheckDate(phdnDateStart.Value).ToString("MMM dd, yyyy hh:mm tt"); plblGamePhase.Text = DALPortal.GetGamePhaseName(phdnGamePhase.Value); } } }
private void LoadUpcomingSchedules() { //added by rollie 7/29/11 DateTime latestDate = DALPortal.GetLatestGameDate(); DateTime latestDateStart = clsDateTime.ChangeTimeToStart(latestDate); DateTime latestDateEnd = clsDateTime.ChangeTimeToEnd(latestDate); //////// //Add By Charlie Bachiller 2-1-2012 DateTime dtCurrentDate = latestDate; DateTime dtFirstDayOfMonth = new DateTime(); dtFirstDayOfMonth = dtCurrentDate.AddDays(-(dtCurrentDate.Day - 1)); //// using (PortalDataContext pdc = new PortalDataContext()) { var q = (from eg in pdc.EventGames join e in pdc.Events on eg.EventID equals e.EventID into eeg from eegx in eeg.DefaultIfEmpty() //where eg.IsActive == true && eg.StartDate >= latestDateStart && eg.StartDate <= latestDateEnd where eg.IsActive == true && eg.StartDate >= dtFirstDayOfMonth && eg.IsFinished == false orderby eg.StartDate select new { EventID = eg.EventID, EventName = eegx.Name, GameID = eg.GameID, StartDate = eg.StartDate, GamePhase = eg.GamePhase, Location = eg.Location, WinnerTeamID = eg.WinnerTeamID }); //var q = (from eg in pdc.EventGames // join e in pdc.Events on eg.EventID equals e.EventID into eeg // from eegx in eeg.DefaultIfEmpty() // where eg.IsActive == true && eg.StartDate >= DateTime.Now.Date // orderby eg.StartDate // select new // { // EventID = eg.EventID, // EventName = eegx.Name, // GameID = eg.GameID, // StartDate = eg.StartDate, // GamePhase = eg.GamePhase, // Location = eg.Location, // WinnerTeamID = eg.WinnerTeamID // }); dgSchedule.DataSource = q.ToList(); dgSchedule.DataBind(); foreach (DataGridItem ditm in dgSchedule.Items) { HiddenField phdnGameID = (HiddenField)ditm.FindControl("hdnGameID"); Literal plitTeams = (Literal)ditm.FindControl("litTeams"); HiddenField phdnWinner = (HiddenField)ditm.FindControl("hdnWinner"); Image pimgWinner = (Image)ditm.FindControl("imgWinner"); HiddenField phdnGamePhase = (HiddenField)ditm.FindControl("hdnGamePhase"); Label plblGamePhase = (Label)ditm.FindControl("lblGamePhase"); List <EventGameTeam> egtList = new List <EventGameTeam>(); egtList = (from egt in pdc.EventGameTeams where egt.GameID == phdnGameID.Value.ToInt() orderby egt.TeamID select egt).ToList(); foreach (EventGameTeam egt in egtList) { string teamLogo = (from t in pdc.Teams where t.TeamID == egt.TeamID select t.TeamLogo).SingleOrDefault(); if (teamLogo.Length > 0) { plitTeams.Text += "<td ><img src='" + teamLogo + "' Width='50px' Height='50px'></td>"; } } if (plitTeams.Text.Trim().Length > 0) { plitTeams.Text = "<table cellpadding='5'><tr>" + plitTeams.Text + "</tr></table>"; } if (phdnWinner.Value == "" || phdnWinner.Value == "0") { pimgWinner.Visible = false; } else { pimgWinner.ImageUrl = (from t in pdc.Teams where t.TeamID == phdnWinner.Value.ToInt() select t.TeamLogo).SingleOrDefault(); } plblGamePhase.Text = DALPortal.GetGamePhaseName(phdnGamePhase.Value); } } }