public string AddGame(int scoreBlue, int scoreRed, int idPlayerBlue, int idPlayerRed)
        {
            this.mssqlRepository = new MssqlRepository();
            this.mssqlRepository.AddGame(scoreBlue, scoreRed, idPlayerBlue, idPlayerRed);
 
            return "done";
        }
 public string AddTeam(string name, int idPlayer1, int idPlayer2)
 {
     this.mssqlRepository = new MssqlRepository();
     this.mssqlRepository.AddTeam(idPlayer1, idPlayer2);
     this.mssqlRepository.AddPlayerTeam(name, this.mssqlRepository.GetLastInsertedTeam());
     return "done";
 }
Example #3
0
        private static IEnumerable <Tuple <string, long> > Do(Transistor vtn, Transistor vtp, Filter filter, long sweepStart, long sweepEnd,
                                                              long seedStart, long seedEnd)
        {
            var dn = Transistor.ToTableName(vtn, vtp);

            var repo = new MssqlRepository();

            repo.Use(dn);
            return(repo.Count(r => r.Sweep.Within(sweepStart, sweepEnd) && r.Seed.Within(seedStart, seedEnd),
                              filter));
        }
        public string GetPlayers()
        {
            this.mssqlRepository = new MssqlRepository();
            List<Player> results = this.mssqlRepository.GetPlayers();
            string result = "";

            foreach (Player player in results)
            {
                result += player.idPlayer + " " + player.name + "<br />";
            }


            return result;
        }
        public string GetGames()
        {
            this.mssqlRepository = new MssqlRepository(); 
            List<Game> results = this.mssqlRepository.GetGames();
            string result = "";

            foreach (Game game in results)
            {
                result += game.idGame + " " + game.scoreBlue + " - " + game.scoreRed + "<br />";
            }
          

            return result;
        }
Example #6
0
        private Exception PushFiles(CancellationToken token, ProgressBarBase parentBar, ProgressBarBase parseBar, ProgressBarBase pushBar)
        {
            try {
                var repo = new MssqlRepository();
                var name = Transistor.ToTableName(
                    new Transistor(VtnVoltage, VtnSigma, VtnDeviation),
                    new Transistor(VtpVoltage, VtpSigma, VtpDeviation)
                    );
                repo.Use(name);

                using (var pipeline = new PipeLine.PipeLine(token)) {
                    var first = pipeline.AddSelectMany(Parallel, QueueBuffer, InputFiles, RecordFactory.BuildFromCsv);
                    first.OnInterval += s => parseBar?.Tick($"parsed: {s}");

                    first.OnFinish += () => parentBar?.Tick($"Finished parse csv files. {first.TotalResultsCount} records were parsed");

                    pipeline.Invoke(() => {
                        var list = new List <Record>();
                        var sum  = 0;

                        foreach (var r in first.Results.GetConsumingEnumerable())
                        {
                            list.Add(r);
                            pushBar.MaxTicks++;

                            if (list.Count != QueueBuffer)
                            {
                                continue;
                            }
                            sum += list.Count;
                            repo.BulkUpsert(list);
                            foreach (var record in list)
                            {
                                pushBar.Tick($"{record}");
                            }
                            pushBar.Message = $"{sum} records pushed";

                            list = new List <Record>();
                        }

                        if (!list.Any())
                        {
                            return;
                        }

                        sum += list.Count;
                        repo.BulkUpsert(list);
                        foreach (var record in list)
                        {
                            pushBar.Tick($"{record}");
                        }

                        pushBar.Message = $"{sum} records pushed";
                    });

                    parentBar.Tick("Finished push");
                }
            }
            catch (OperationCanceledException e) {
                return(e);
            }
            catch (Exception e) {
                return(e);
            }

            return(null);
        }
 public string AddPlayer(string name)
 {
     this.mssqlRepository = new MssqlRepository();
     this.mssqlRepository.AddPlayer(name);
     return "done";
 }