예제 #1
0
        static void Main()
        {
            List <IBet>  listОfBets = new List <IBet>();
            StreamReader readerOfSportsBets;
            StreamReader readerOfCasinoBets;
            string       line;

            using (readerOfSportsBets = new StreamReader(SingeltonConfig.INSTANCE.SportBetsFile))
            {
                while ((line = readerOfSportsBets.ReadLine()) != null)
                {
                    string[] props = line.Split(',');
                    SportBet bet   = SportBet.Builder.NewBuilder()
                                     .SetBranch(props[0])
                                     .SetEventID(props[1])
                                     .SetMasterEventID(props[2])
                                     .SetStake(props[3])
                                     .SetLineID(props[4])
                                     .SetCreationDate(props[5])
                                     .Build();
                    listОfBets.Add(new SportBetAdapter(bet));
                }
            }


            using (readerOfCasinoBets = new StreamReader(SingeltonConfig.INSTANCE.CasinoBetsFile))
            {
                while ((line = readerOfCasinoBets.ReadLine()) != null)
                {
                    string[] props = line.Split(',');
                    listОfBets.Add(new CasinoBetAdapter(CasinoBet.Builder.newBuilder()
                                                        .SetCasinoProvider(props[0])
                                                        .SetGameProvider(props[1])
                                                        .SetGameID(props[2])
                                                        .SetStake(props[4])
                                                        .SetCreationDate(props[3])
                                                        .Build()));
                }
            }

            var stakeProcessor  = new StakeProcessor();
            var casinoProcessor = new CreationDateProcessor();

            foreach (var bet in listОfBets)
            {
                stakeProcessor.Process(bet);
                casinoProcessor.Process(bet);
            }

            Console.WriteLine(stakeProcessor.Sum);
            Console.WriteLine(casinoProcessor.Sum);
            Console.ReadLine();
        }
예제 #2
0
 public SportBetAdapter(SportBet bet)
 {
     this._bet = bet;
 }