예제 #1
0
        public void initialiseFileWithoutDialog(int dayNr, String folderData, Compet Compet)
        {
            _dayNr = dayNr;
            _c     = Compet;
            _file  = Path.Combine(folderData, String.Format("ExtraShamrock{0}.json", _dayNr));

            _c.getDaybyNr(_dayNr).initialiseEmptyExtra();
            File.WriteAllText(_file, JsonConvert.SerializeObject(_c.getDaybyNr(_dayNr).extras));
        }
예제 #2
0
        public void initialiseFileWithoutDialog(int dayNr, String folderData, Compet Compet)
        {
            _dayNr = dayNr;
            _c     = Compet;
            _file  = Path.Combine(folderData, String.Format("MatchScores{0}.json", _dayNr));

            _c.getDaybyNr(_dayNr).matchScores.initialise(_c.getDaybyNr(_dayNr).flights);
            File.WriteAllText(_file, JsonConvert.SerializeObject(_c.getDaybyNr(_dayNr).matchScores));
        }
예제 #3
0
        public void ShowDialog(int dayNr, String folderData, Compet Compet)
        {
            _dayNr = dayNr;
            _c     = Compet;
            _file  = Path.Combine(folderData, String.Format("ExtraShamrock{0}.json", _dayNr));

            if (File.Exists(_file))
            {
                _c.getDaybyNr(_dayNr).extras = JsonConvert.DeserializeObject <dailyExtras>(File.ReadAllText(_file));
            }
            else
            {
                _c.getDaybyNr(_dayNr).initialiseEmptyExtra();
            }

            display();
            this.Text = "Extra Shamrock input for round " + _dayNr.ToString();

            this.ShowDialog();
        }
예제 #4
0
        public void ShowDialog(int dayNr, String folderData, Compet Compet)
        {
            _dayNr = dayNr;
            _c     = Compet;
            _file  = Path.Combine(folderData, String.Format("MatchScores{0}.json", _dayNr));

            if (File.Exists(_file))
            {
                _c.getDaybyNr(_dayNr).matchScores = JsonConvert.DeserializeObject <MatchScores>(File.ReadAllText(_file));
            }
            else
            {
                _c.getDaybyNr(_dayNr).matchScores.initialise(_c.getDaybyNr(_dayNr).flights);
            }

            display();
            this.Text = "Match Results input for round " + _dayNr.ToString();

            this.ShowDialog();
        }
예제 #5
0
        public void ShowDialog(String folderData, Compet Compet)
        {
            _c    = Compet;
            _file = Path.Combine(folderData, String.Format("configForYear.json"));

            if (File.Exists(_file))
            {
                _c.configForYear = JsonConvert.DeserializeObject <ConfigsForYear>(File.ReadAllText(_file));
            }
            else
            {
                _c.configForYear.ptsMatch   = "2,2"; //2 points for match, 2 points for foursome
                _c.configForYear.stlDay     = "1.5,1,0.5";
                _c.configForYear.stlWeek    = "4,3,2,1,0.5";
                _c.configForYear.useExtra   = false;
                _c.configForYear.useScratch = false;
            }

            display();
            this.Text = "Input for Shamrock Points ";

            this.ShowDialog();
        }
예제 #6
0
        public void addC(Compet ctC)
        {
            foreach (day ctDay in ctC.days)
            {
                foreach (flight ctFlight in ctDay.flights.Values)
                {
                    foreach (match match in ctFlight.matchs.Values)
                    {
                        if (ctDay.matchScores.matchResults.ContainsKey(match.name))
                        {
                            MatchScore ctMS = ctDay.matchScores.matchResults[match.name];
                            foreach (team ctT in match.teams)
                            {
                                #region store MatchInfo at Player level
                                foreach (Player cttp in ctT.players.Values)
                                {
                                    MatchInfo ctMInfo = new MatchInfo {
                                        year = ctC.year, matchScore = ctMS.CloneJson(), flight = ctFlight.CloneJson(), dayNr = ctDay.nr, matchName = match.name
                                    };
                                    ctMInfo.myTeam = match.GetMyTeam(cttp.name).CloneJson();
                                    ctMInfo.opTeam = match.GetOpponnentTeam(cttp.name).CloneJson();

                                    if (!histMatchsForPlayer.ContainsKey(cttp.name))
                                    {
                                        histMatchsForPlayer.Add(cttp.name, new MatchHistory {
                                            name = cttp.name
                                        });
                                    }
                                    MatchHistory ctMHist = histMatchsForPlayer[cttp.name];
                                    ctMHist.matchs.Add(ctMInfo);

                                    if (!histMatchsBeteNoire.ContainsKey(cttp.name))
                                    {
                                        histMatchsBeteNoire.Add(cttp.name, new Dictionary <string, MatchHistory>());
                                    }
                                    Dictionary <string, MatchHistory> ctMHistBN = histMatchsBeteNoire[cttp.name];
                                    foreach (string ctOpP in ctMInfo.opTeam.players.Keys)
                                    {
                                        if (!ctMHistBN.ContainsKey(ctOpP))
                                        {
                                            ctMHistBN.Add(ctOpP, new MatchHistory {
                                                name = ctOpP
                                            });
                                        }
                                        MatchHistory ctMHistBNp = ctMHistBN[ctOpP];
                                        ctMHistBNp.matchs.Add(ctMInfo.CloneJson());
                                    }
                                }
                                #endregion
                                #region store MatchInfo at Team level (2 players playing together)
                                if (match.GetNbOfPlayers() == 4)
                                {
                                    string key = getPairsKey(ctT);
                                    if (!histMatchsAsTeam.ContainsKey(key))
                                    {
                                        histMatchsAsTeam.Add(key, new MatchHistory {
                                            name = key
                                        });
                                    }
                                    MatchHistory ctMHist = histMatchsAsTeam[key];
                                    MatchInfo    ctMInfo = new MatchInfo {
                                        year = ctC.year, matchScore = ctMS.CloneJson(), flight = ctFlight.CloneJson(), dayNr = ctDay.nr, matchName = match.name
                                    };
                                    ctMInfo.myTeam = match.GetMyTeam(ctT.GetPlayer1()).CloneJson();
                                    ctMInfo.opTeam = match.GetOpponnentTeam(ctT.GetPlayer1()).CloneJson();

                                    ctMHist.matchs.Add(ctMInfo);
                                }
                                #endregion
                            }
                        }
                        else
                        {
                            throw new Exception(String.Format("Could not find matchScore for this match on day {0}: {1}", ctDay.displayName, match.name));
                        }
                    }
                }
            }
        }