Ejemplo n.º 1
0
        public static void Main()
        {
            Console.WriteLine("DotNetBay Commandline");

            IAuctionRunner auctionRunner = null;

            try {
                var store          = ServiceLocator.GetInstance.GetMainRepository;
                var auctionService = ServiceLocator.GetInstance.GetAuctionService;

                auctionRunner = AuctionRunner.GetInstance(store);

                Console.WriteLine("Started AuctionRunner");
                auctionRunner.Start();

                var allAuctions = auctionService.GetAll();

                Console.WriteLine("Found {0} auctions returned by the service.", allAuctions.Count());

                Console.Write("Press enter to quit");
                Console.ReadLine();
            } finally {
                auctionRunner?.Dispose();
            }

            Environment.Exit(0);
        }
Ejemplo n.º 2
0
        public App()
        {
            MainRepository = new FileSystemMainRepository("WPF_DotNetBay_Data.json");
            MainRepository.SaveChanges();

            PopulateWithTestData();

            AuctionRunner = new AuctionRunner(MainRepository);
            AuctionRunner.Start();
        }
Ejemplo n.º 3
0
        static App()
        {
            SetupCulture();
            MainRepository = new FileSystemMainRepository("file.dat");
            AuctionRunner = new AuctionRunner(MainRepository);
            MemberService = new SimpleMemberService(MainRepository);
            AuctionService = new AuctionService(MainRepository, MemberService);

            InitTestAuctionData();
            AuctionRunner.Start();
        }
Ejemplo n.º 4
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // DotNetBay startup
            var mainRepository = new EFMainRepository();

            mainRepository.SaveChanges();

            AuctionRunner = new AuctionRunner(mainRepository);
            AuctionRunner.Start();
        }
Ejemplo n.º 5
0
        public App()
        {
            AuctionRunner = new AuctionRunner(MainRepository);
            AuctionRunner.Start();

            var memberService = new SimpleMemberService(this.MainRepository);
            var service       = new AuctionService(this.MainRepository, memberService);

            if (!service.GetAll().Any())
            {
                var me = memberService.GetCurrentMember();

                service.Save(new Auction
                {
                    Title            = "My First Auction",
                    StartDateTimeUtc = DateTime.UtcNow.AddSeconds(10),
                    EndDateTimeUtc   = DateTime.UtcNow.AddDays(14),
                    StartPrice       = 72,
                    Seller           = me
                });
            }
        }
Ejemplo n.º 6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            // DotNetBay startup
            var mainRepository = new EFMainRepository();

            mainRepository.SaveChanges();

            // SignalR Configuration
            var serializerSettings = new JsonSerializerSettings();

            serializerSettings.ReferenceLoopHandling      = ReferenceLoopHandling.Serialize;
            serializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.Objects;

            var serializer = JsonSerializer.Create(serializerSettings);

            GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer);

            AuctionRunner = new AuctionRunner(mainRepository);

            AuctionRunner.Auctioneer.BidAccepted += (sender, args) =>
            #pragma warning disable SA1501 // Statement must not be on a single line
            { AuctionsHub.NotifyBidAccepted(args.Auction, args.Bid); };

            AuctionRunner.Auctioneer.BidDeclined += (sender, args) =>
            { AuctionsHub.NotifyBidDeclined(args.Auction, args.Bid); };

            AuctionRunner.Auctioneer.AuctionStarted += (sender, args) =>
            { AuctionsHub.NotifyAuctionStarted(args.Auction); };

            AuctionRunner.Auctioneer.AuctionEnded += (sender, args) =>
            { AuctionsHub.NotifyAuctionEnded(args.Auction); };

            #pragma warning restore SA1501 // Statement must not be on a single line
            AuctionRunner.Start();
        }