Ejemplo n.º 1
0
        /// <summary>
        /// Updates the memento.
        /// </summary>
        private void updateMemento()
        {
            OriginatorTeams   orgTim     = new OriginatorTeams();
            OriginatorResults orgRez     = new OriginatorResults();
            OriginatorTeams   orgTimDiff = new OriginatorTeams();

            orgRez.round     = this.round;
            orgTim.Teams     = this.teams.OrderByDescending(o => o.points).ToList();
            orgTimDiff.Teams = this.teams.OrderByDescending(o => o.points).ToList();

            this.takerTeam.AddMemento(orgTim.SaveMemento());

            if (takerTeamDiff.Old.Count > 1)
            {
                int id = 0;
                foreach (team t in orgTimDiff.Teams)
                {
                    if (takerTeamDiff.Old[takerTeamDiff.Old.Count - 1].Teams[takerTeamDiff.Old[takerTeamDiff.Old.Count - 1].Teams.FindIndex(p => p.ID == orgTimDiff.Teams[orgTimDiff.Teams.IndexOf(t)].ID)].rank == orgTimDiff.Teams[orgTimDiff.Teams.IndexOf(t)].rank)
                    {
                        id++;
                    }
                }

                if (id != orgTimDiff.Teams.Count)
                {
                    this.takerTeamDiff.AddMemento(orgTim.SaveMemento());
                    this.takerRez.AddMemento(orgRez.SaveMemento());
                }
            }
            else
            {
                this.takerTeamDiff.AddMemento(orgTim.SaveMemento());
                this.takerRez.AddMemento(orgRez.SaveMemento());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Updates the memento.
        /// </summary>
        private void updateMemento()
        {
            OriginatorTeams orgTim = new OriginatorTeams();
            OriginatorResults orgRez = new OriginatorResults();
            OriginatorTeams orgTimDiff = new OriginatorTeams();
            orgRez.round = this.round;
            orgTim.Teams = this.teams.OrderByDescending(o => o.points).ToList();
            orgTimDiff.Teams = this.teams.OrderByDescending(o => o.points).ToList();
            
            this.takerTeam.AddMemento(orgTim.SaveMemento());

            if (takerTeamDiff.Old.Count > 1)
            {
                int id = 0;
                foreach (team t in orgTimDiff.Teams)
                {
                    if (takerTeamDiff.Old[takerTeamDiff.Old.Count - 1].Teams[takerTeamDiff.Old[takerTeamDiff.Old.Count - 1].Teams.FindIndex(p => p.ID == orgTimDiff.Teams[orgTimDiff.Teams.IndexOf(t)].ID)].rank == orgTimDiff.Teams[orgTimDiff.Teams.IndexOf(t)].rank)
                    {
                        id++;
                    }
                }

                if (id != orgTimDiff.Teams.Count)
                {
                    this.takerTeamDiff.AddMemento(orgTim.SaveMemento());
                    this.takerRez.AddMemento(orgRez.SaveMemento());
                }
            }
            else
            {
                this.takerTeamDiff.AddMemento(orgTim.SaveMemento());
                this.takerRez.AddMemento(orgRez.SaveMemento());
            }
        }