partial void DeleteInti_TeamPointEvents(Inti_TeamPointEvents instance);
partial void UpdateInti_TeamPointEvents(Inti_TeamPointEvents instance);
partial void InsertInti_TeamPointEvents(Inti_TeamPointEvents instance);
private void detach_Inti_TeamPointEvents(Inti_TeamPointEvents entity) { this.SendPropertyChanging(); entity.Inti_Team = null; }
private void attach_Inti_TeamPointEvents(Inti_TeamPointEvents entity) { this.SendPropertyChanging(); entity.Inti_MatchPointEvent = this; }
public void DistributePoints(Guid matchId) { using (var db = new IntiDataContext(_connectionString)) { var match = db.Inti_Match.Single(m => m.GUID == matchId); var mpes = from mpe in db.Inti_MatchPointEvent where mpe.Inti_Match.GUID == matchId orderby mpe.Inti_AthleteClub.Inti_Club.Name orderby mpe.Inti_AthleteClub.Inti_Position.Name orderby mpe.Inti_PointEvent.Name select mpe; foreach (var mpe in mpes) { //loop the teams that has this athlete var teamAthletes = from ta in db.Inti_TeamAthlete where ta.Inti_TeamVersion.ValidFrom < match.MatchDate && (ta.Inti_TeamVersion.ValidTo ?? match.MatchDate) >= match.MatchDate && (ta.Inti_TeamVersion.Inti_Team.IsActive ?? false) && (ta.Inti_TeamVersion.Inti_Team.IsPaid ?? false) && ta.AthleteGUID == mpe.AthleteClubGUID select new { ta.Inti_TeamVersion.TeamGUID }; foreach (var teamAthlete in teamAthletes) { var tpe = new Inti_TeamPointEvents(); tpe.MatchPointEventGUID = mpe.GUID; tpe.TeamGUID = teamAthlete.TeamGUID; db.Inti_TeamPointEvents.InsertOnSubmit(tpe); } } match.IsUpdated = true; db.SubmitChanges(); LogEvent(matchId, typeof(Inti_Match), SessionProperties.UserGuid, SessionProperties.ClientInfo, EventType.Update, "DistributePoints" ); } }