protected void JqgridLeague1_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e) { using (var dc = ThaitaeDataDataContext.Create()) { var league = new thaitae.lib.League { LeagueName = e.RowData["LeagueName"], LeagueType = Convert.ToInt32(e.RowData["LeagueTypeName"]), LeagueDesc = e.RowData["LeagueDesc"], Active = Convert.ToByte(e.RowData["ActiveName"]) }; dc.Leagues.InsertOnSubmit(league); dc.SubmitChanges(); } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request.QueryString["leagueId"])) return; var leagueId = Convert.ToInt32(Request.QueryString["leagueId"]); using (var dc = ThaitaeDataDataContext.Create()) { League = dc.Leagues.Single(item => item.LeagueId == leagueId); var seasonId = dc.Seasons.OrderByDescending(item => item.SeasonId).First(item => item.LeagueId == leagueId).SeasonId; var matchList = dc.Matches.Where(item => item.SeasonId == seasonId).ToArray(); var j = 0; for (var i = 0; i < matchList.Count(); i++) { if (i % 2 == 0) { Match[j] = matchList[i]; j++; } } } }
partial void DeleteLeague(League instance);
partial void UpdateLeague(League instance);
partial void InsertLeague(League instance);