public async Task InitTest()
        {
            var itemDesc1 = new DatabaseModel.ItemDescription("item1", new decimal(10.20), "730", "2", "imageUrl", true);
            var itemDesc2 = new DatabaseModel.ItemDescription("item2", new decimal(11.40), "730", "2", "imageUrl", true);

            ItemDescription1 = await new ItemDescriptionRepoService(DatabaseConnectionFactory, new ItemDescriptionQueries()).InsertAsync(itemDesc1);
            ItemDescription2 = await new ItemDescriptionRepoService(DatabaseConnectionFactory, new ItemDescriptionQueries()).InsertAsync(itemDesc2);

            var gameMode  = new DatabaseModel.GameMode("Jackpot", 1);
            var gameMode2 = new DatabaseModel.GameMode("Jackpot1", 2);
            var gameMode3 = new DatabaseModel.GameMode("Jackpot2", 3);
            var gameMode4 = new DatabaseModel.GameMode("Jackpot3", 4);

            GameMode  = await new GameModeRepoService(DatabaseConnectionFactory).Insert(gameMode);
            GameMode2 = await new GameModeRepoService(DatabaseConnectionFactory).Insert(gameMode2);
            GameMode3 = await new GameModeRepoService(DatabaseConnectionFactory).Insert(gameMode3);
            GameMode4 = await new GameModeRepoService(DatabaseConnectionFactory).Insert(gameMode4);

            var bot = new DatabaseModel.Bot(",anotherBot", "Bot 2");

            Bot1 = await new BotRepoService(DatabaseConnectionFactory, new BotQueries()).InsertAsync(bot);
            var match = new DatabaseModel.Match(1, "salt", "hash", 55.ToString(CultureInfo.InvariantCulture), 1, null, null, 1, GameMode.Id,
                                                DateTime.Now);

            Match1 = await new MatchRepoService(DatabaseConnectionFactory, new MatchQueries()).InsertAsync(match);
            var match1 = new DatabaseModel.Match(2, "salt", "hash", 55.ToString(CultureInfo.InvariantCulture), 1, null, null, 1, GameMode.Id,
                                                 DateTime.Now);

            Match2 = await new MatchRepoService(DatabaseConnectionFactory, new MatchQueries()).InsertAsync(match1);
        }
        public async void GetValueSuccess()
        {
            var itemDescription1 = new DatabaseModel.ItemDescription("AWP AZIMOW Q1", new decimal(12.21), "730", "2", "imageUrl", true);
            var itemDescription2 = new DatabaseModel.ItemDescription("AWP AZIMOW Q2", new decimal(11.21), "730", "2", "imageUrl", true);
            var itemDescription3 = new DatabaseModel.ItemDescription("AWP AZIMOW Q3", new decimal(10.21), "730", "2", "imageUrl", true);
            var itemDescription4 = new DatabaseModel.ItemDescription("AWP AZIMOW Q4", new decimal(1.21), "730", "2", "imageUrl", true);
            var itemDescId1      = await _itemDescriptionRepoService.InsertAsync(itemDescription1);

            var itemDescId2 = await _itemDescriptionRepoService.InsertAsync(itemDescription2);

            var itemDescId3 = await _itemDescriptionRepoService.InsertAsync(itemDescription3);

            var itemDescId4 = await _itemDescriptionRepoService.InsertAsync(itemDescription4);

            var res = await _itemDescriptionRepoService.ValueOfItemDescriptions(new List <int>
            {
                itemDescId1.Id,
                itemDescId2.Id,
                itemDescId3.Id,
                itemDescId4.Id,
            });


            Assert.Equal(new decimal(12.21), res[itemDescId1.Id]);
            Assert.Equal(new decimal(11.21), res[itemDescId2.Id]);
            Assert.Equal(new decimal(10.21), res[itemDescId3.Id]);
            Assert.Equal(new decimal(1.21), res[itemDescId4.Id]);
        }
示例#3
0
        private async Task UpdatePriceing(int appId)
        {
            var pricingResponse = await _httpRequestService.MakeRequest($"https://api.opskins.com/IPricing/GetSuggestedPrices/v2/?appid={appId}");

            var obj = JObject.Parse(pricingResponse);

            var status   = obj["status"];
            var response = obj["response"];

            if (status == null || status.Value <long>() != 1)
            {
                throw new BadResponseException($"Statuscode is {status.Value<long>()}");
            }

            var parsedResponse = response.ToObject <Dictionary <string, OpSkinsResponse> >();

            var index = 0;

            foreach (var opSkinsResponse in parsedResponse)
            {
                index++;
                var name = opSkinsResponse.Key;
                var op30 = opSkinsResponse.Value.Op30Days;
                var op7  = opSkinsResponse.Value.Op7Days;

                var lowestAvg = op30 > op7 ? op7 : op30;

                var itemDesc = new DatabaseModel.ItemDescription(name, Math.Round(lowestAvg / 100, 2), appId.ToString(), "2", "noImg", true);
                if (index % 50 == 0)
                {
                    _logger.Info($"Pricing Status {appId} {index + 1}/{parsedResponse.Count}");
                }
                await _repoServiceFactory.ItemDescriptionRepoService.InsertOrUpdate(itemDesc);
            }
        }
示例#4
0
        private async Task UpdatePriceing(string url, int appId)
        {
            await _repoServiceFactory.ItemDescriptionRepoService.InvalidateItemForAppId(appId);

            var jObject = await _jsonRequestParser.ExecuteAsJObject(new RequestMessage(HttpMethod.Get, url));

            using (var cureser = jObject.GetEnumerator())
            {
                var index = 0;

                while (cureser.MoveNext())
                {
                    index++;
                    var name  = cureser.Current.Key.ToString();
                    var price = decimal.Parse(cureser.Current.Value.ToString());

                    var itemDesc = new DatabaseModel.ItemDescription(name, Math.Round(price, 2), appId.ToString(), "2", "noImg", true);
                    if (index % 50 == 0)
                    {
                        _logger.Info($"Pricing Status {appId} {index + 1}/{jObject.Count}");
                    }
                    await _repoServiceFactory.ItemDescriptionRepoService.InsertOrUpdate(itemDesc);
                }
            }
        }
示例#5
0
        private async Task BetSkinsForUser(DatabaseModel.ItemDescription itemDesc, int botId, DatabaseModel.User user, int roundId, int nrOfSkins)
        {
            var insertedItems = new List <string>();

            for (int i = 0; i < nrOfSkins; i++)
            {
                var randomAssetId = RandomString(10);
                try
                {
                    await _repoServiceFactory.ItemRepoService.InsertAsync(new DatabaseModel.Item(randomAssetId, itemDesc.Id, botId, user.Id, DateTimeOffset.Now));

                    insertedItems.Add(randomAssetId);
                }
                catch (System.Exception)
                {
                    // ignored
                }
            }

            var itemsToBet = insertedItems.Select(assetId => new AssetAndDescriptionId {
                AssetId = assetId, DescriptionId = itemDesc.Id
            }).ToList();

            _jackpotMatchManager.PlaceBetOnMatch(itemsToBet, roundId, user.SteamId);
        }
示例#6
0
        public SqlQuery Update(DatabaseModel.ItemDescription itemDescription)
        {
            var dict = new Dictionary <string, object>
            {
                { "@value", itemDescription.Value },
                { "@name", ItemDescriptionHelper.ToDatabase(itemDescription.Name) },
            };

            return(new SqlQuery($"UPDATE [ItemDescription] SET Value = @value, Valid = 1 WHERE Name = @name", dict));
        }
        public async Task InitTest()
        {
            var offerTransactionServiceRepo = new OfferTransactionRepoService(DatabaseConnectionFactory, new OfferTransationQueries());
            var botServiceRepo      = new BotRepoService(DatabaseConnectionFactory, new BotQueries());
            var userServiceRepo     = new UserRepoService(DatabaseConnectionFactory, new UserQueries());
            var itemDescServiceRepo = new ItemDescriptionRepoService(DatabaseConnectionFactory, new ItemDescriptionQueries());

            _user1 = await userServiceRepo.InsertAsync(new DatabaseModel.User("steamId1", "name1", "imgUrl", "tradelink", DateTime.Now,
                                                                              DateTime.Now, false));

            _user2 = await userServiceRepo.InsertAsync(new DatabaseModel.User("steamId2", "name2", "imgUrl", "tradelink", DateTime.Now,
                                                                              DateTime.Now, false));

            _bot1 = await botServiceRepo.InsertAsync(new DatabaseModel.Bot("botSteamId1", "botName1"));


            var toInsert1 = new DatabaseModel.OfferTransaction(_user1.Id, _bot1.Id, new decimal(10.45), true, "456232", DateTime.Now);
            var toInsert2 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(54.45), false, "456332", DateTime.Now);
            var toInsert3 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(666.66), false, "454132", DateTime.Now);
            var toInsert4 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(544.75), false, "455132", null);
            var toInsert5 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(10.75), true, "456162", DateTime.Today);
            var toInsert6 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(10.75), true, "44864748654", DateTime.Today);
            var toInsert7 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(10.75), true, "548", DateTime.Today);
            var toInsert8 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(10.75), true, "555", DateTime.Today);
            var toInsert9 = new DatabaseModel.OfferTransaction(_user2.Id, _bot1.Id, new decimal(10.75), true, "5646555", DateTime.Today);

            OfferTransaction1 = await offerTransactionServiceRepo.InsertAsync(toInsert1);

            OfferTransaction2 = await offerTransactionServiceRepo.InsertAsync(toInsert2);

            OfferTransaction3 = await offerTransactionServiceRepo.InsertAsync(toInsert3);

            OfferTransaction4 = await offerTransactionServiceRepo.InsertAsync(toInsert4);

            OfferTransaction5 = await offerTransactionServiceRepo.InsertAsync(toInsert5);

            OfferTransaction6 = await offerTransactionServiceRepo.InsertAsync(toInsert6);

            OfferTransaction7 = await offerTransactionServiceRepo.InsertAsync(toInsert7);

            OfferTransaction8 = await offerTransactionServiceRepo.InsertAsync(toInsert8);

            OfferTransaction9 = await offerTransactionServiceRepo.InsertAsync(toInsert9);

            ItemDescription1 =
                await itemDescServiceRepo.InsertAsync(new DatabaseModel.ItemDescription("weapon1", new decimal(1.40), "720", "2", "imgUrl1", true));

            ItemDescription2 =
                await itemDescServiceRepo.InsertAsync(new DatabaseModel.ItemDescription("weapon2", new decimal(8.75), "720", "2", "imgUrl2", true));
        }
        public async void InsertAndGetSuccess()
        {
            var itemDescription = new DatabaseModel.ItemDescription("AWP AZIMOW", new decimal(42.21), "730", "2", "imageUrl", true);
            var insertRes       = await _itemDescriptionRepoService.InsertAsync(itemDescription);

            Assert.True(insertRes.Id > 0);

            var getRes = await new ItemDescriptionRepoService(_fakedFactory, new ItemDescriptionQueries()).FindAsync("AWP AZIMOW");

            Assert.Equal(new decimal(42.21), getRes.Value);
            Assert.Equal("730", getRes.AppId);
            Assert.Equal("2", getRes.ContextId);
            Assert.NotEqual(0, getRes.Id);
        }
示例#9
0
        public async Task <DatabaseModel.ItemDescription> InsertAsync(DatabaseModel.ItemDescription itemDescription)
        {
            var query = _itemDescriptionQueries.InsertReturnsId(itemDescription);
            var id    = (int)await _databaseConnection.ExecuteScalarAsync(query);

            return(new DatabaseModel.ItemDescription(
                       itemDescription.Name,
                       itemDescription.Value,
                       itemDescription.AppId,
                       itemDescription.ContextId,
                       itemDescription.ImageUrl,
                       itemDescription.Valid,
                       id
                       ));
        }
示例#10
0
        public SqlQuery InsertReturnsId(DatabaseModel.ItemDescription itemDescription)
        {
            var dict = new Dictionary <string, object>
            {
                { "@name", ItemDescriptionHelper.ToDatabase(itemDescription.Name) },
                { "@value", itemDescription.Value },
                { "@appId", itemDescription.AppId },
                { "@imgUrl", itemDescription.ImageUrl },
                { "@contextId", itemDescription.ContextId },
                { "@valid", itemDescription.Valid }
            };

            return(new SqlQuery(
                       "INSERT INTO [ItemDescription] (Name, Value, AppId, ContextId, ImageUrl, Valid) OUTPUT INSERTED.Id VALUES (@name,@value,@appId,@contextId,@imgUrl,@valid);",
                       dict));
        }
        public async void InsertOrUpdateSuccess()
        {
            var itemDesc  = new DatabaseModel.ItemDescription("AWP AZIMOW D1asd", new decimal(10), "730", "2", "imageUrl", true);
            var itemDesc1 = new DatabaseModel.ItemDescription("AWP AZIMOW D1asd", new decimal(20), "730", "2", "imageUrl", true);

            var insertRes = await _itemDescriptionRepoService.InsertOrUpdate(itemDesc);

            var findRes = await _itemDescriptionRepoService.FindAsync(insertRes.Id);

            Assert.Equal(new decimal(10), findRes.Value);

            var insertRes1 = await _itemDescriptionRepoService.InsertOrUpdate(itemDesc1);

            var findRes1 = await _itemDescriptionRepoService.FindAsync(insertRes1.Id);

            Assert.Equal(insertRes1.Id, insertRes.Id);
            Assert.Equal(findRes1.Id, insertRes.Id);
            Assert.Equal(new decimal(20), findRes1.Value);
        }
示例#12
0
        public async Task <DatabaseModel.ItemDescription> InsertOrUpdate(DatabaseModel.ItemDescription itemDesc)
        {
            var findRes = await FindAsync(itemDesc.Name);

            if (findRes == null)
            {
                return(await InsertAsync(itemDesc));
            }

            await Update(itemDesc);

            return(new DatabaseModel.ItemDescription
                   (
                       itemDesc.Name,
                       itemDesc.Value,
                       itemDesc.AppId,
                       itemDesc.ContextId,
                       itemDesc.ImageUrl,
                       itemDesc.Valid,
                       findRes.Id
                   ));
        }
        public async void GetFromNamesSuccess()
        {
            var itemDescription1 = new DatabaseModel.ItemDescription("AWP AZIMOW D1", new decimal(12.21), "730", "2", "imageUrl", true);
            var itemDescription2 = new DatabaseModel.ItemDescription("AWP AZIMOW D2", new decimal(11.21), "730", "2", "imageUrl", true);
            var itemDescription3 = new DatabaseModel.ItemDescription("AWP AZIMOW D3", new decimal(10.21), "730", "2", "imageUrl", true);
            var itemDescription4 = new DatabaseModel.ItemDescription("AWP AZIMOW D4", new decimal(10.21), "730", "2", "imageUrl", true);
            var itemDescId1      = await _itemDescriptionRepoService.InsertAsync(itemDescription1);

            var itemDescId2 = await _itemDescriptionRepoService.InsertAsync(itemDescription2);

            var itemDescId3 = await _itemDescriptionRepoService.InsertAsync(itemDescription3);

            await _itemDescriptionRepoService.InsertAsync(itemDescription4);

            var res = await _itemDescriptionRepoService.FindAsync(new List <string>
            {
                "AWP AZIMOW D1",
                "AWP AZIMOW D2",
                "AWP AZIMOW D3",
            });

            Assert.Equal(3, res.Count);
        }
        public async void GetIdsSuccess()
        {
            var itemDescription1 = new DatabaseModel.ItemDescription("AWP AZIMOW xD1", new decimal(12.21), "730", "2", "imageUrl", true);
            var itemDescription2 = new DatabaseModel.ItemDescription("AWP AZIMOW xD2", new decimal(11.21), "730", "2", "imageUrl", true);
            var itemDescription3 = new DatabaseModel.ItemDescription("AWP AZIMOW xD3", new decimal(10.21), "730", "2", "imageUrl", false);
            var itemDescription4 = new DatabaseModel.ItemDescription("AWP AZIMOW xD4", new decimal(10.21), "730", "2", "imageUrl", true);
            var itemDescId1      = await _itemDescriptionRepoService.InsertAsync(itemDescription1);

            var itemDescId2 = await _itemDescriptionRepoService.InsertAsync(itemDescription2);

            var itemDescId3 = await _itemDescriptionRepoService.InsertAsync(itemDescription3);

            await _itemDescriptionRepoService.InsertAsync(itemDescription4);

            var res = await _itemDescriptionRepoService.FindAsync(new List <int>
            {
                itemDescId1.Id,
                itemDescId2.Id,
                itemDescId3.Id,
            });

            Assert.False(res.SingleOrDefault(description => description.Id == itemDescId3.Id)?.Valid);
            Assert.Equal(3, res.Count);
        }
示例#15
0
 public SqlQuery Insert(DatabaseModel.ItemDescription itemDescription)
 {
     return(InsertRange(new List <DatabaseModel.ItemDescription> {
         itemDescription
     }));
 }
示例#16
0
        public OfferTransactionServiceTest()
        {
            var fakedItemDescriptionRepoService = A.Fake <IItemDescriptionRepoService>();
            var fakedTransactionFactory         = A.Fake <ITransactionFactory>();
            var fakedRepoServiceFactory         = A.Fake <IRepoServiceFactory>();

            _fakedItemInOfferTransactionRepoService = A.Fake <IItemInOfferTransactionRepoService>();
            _fakedOfferTranascrionRepoService       = A.Fake <IOfferTranascrionRepoService>();
            _fakedUserRepoService = A.Fake <IUserRepoService>();
            _fakedBotRepoService  = A.Fake <IBotRepoService>();
            _fakedItemRepoService = A.Fake <IItemRepoService>();

            _fakedTransactionWrapper = A.Fake <ITransactionWrapper>();

            A.CallTo(() => fakedRepoServiceFactory.ItemInOfferTransactionRepoService).Returns(_fakedItemInOfferTransactionRepoService);
            A.CallTo(() => fakedRepoServiceFactory.OfferTranascrionRepoService).Returns(_fakedOfferTranascrionRepoService);
            A.CallTo(() => fakedRepoServiceFactory.UserRepoService).Returns(_fakedUserRepoService);
            A.CallTo(() => fakedRepoServiceFactory.BotRepoService).Returns(_fakedBotRepoService);
            A.CallTo(() => fakedRepoServiceFactory.ItemDescriptionRepoService).Returns(fakedItemDescriptionRepoService);
            A.CallTo(() => fakedRepoServiceFactory.ItemRepoService).Returns(_fakedItemRepoService);
            A.CallTo(() => fakedTransactionFactory.BeginTransaction()).Returns(_fakedTransactionWrapper);

            _offerMinmalInfo = new OfferStatusRequest
            {
                Bot = new Bot
                {
                    Username = "******",
                    SteamId  = "botSteamId"
                },
                SteamId       = "userSteamId",
                StatusCode    = int.MinValue,
                StatusMessage = "",
                OfferSend     = new OfferStatusOffer
                {
                    SteamOffer = new SteamOffer
                    {
                        ItemsToGive =
                        {
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "1", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "2", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "3", MarketHashName = "SomeWeapon2"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "4", MarketHashName = "SomeWeapon3"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "5", MarketHashName = "SomeWeapon4"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "6", MarketHashName = "SomeWeapon2"
                            },
                        },
                        ItemsToReceive =
                        {
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "11", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "12", MarketHashName = "SomeWeapon1"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "13", MarketHashName = "SomeWeapon2"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "14", MarketHashName = "SomeWeapon3"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "15", MarketHashName = "SomeWeapon4"
                            },
                            new Item {
                                AppId = 730, ContextId = "2", AssetId = "16", MarketHashName = "SomeWeapon2"
                            },
                        },
                    }
                }
            };


            var someWeapon1 = new DatabaseModel.ItemDescription("SomeWeapon1", new decimal(11.22), "720", "2", "imgUrl", true, 1);
            var someWeapon2 = new DatabaseModel.ItemDescription("SomeWeapon2", new decimal(45.5), "720", "2", "imgUrl", true, 2);
            var someWeapon3 = new DatabaseModel.ItemDescription("SomeWeapon3", new decimal(78.00), "720", "2", "imgUrl", true, 3);
            var someWeapon4 = new DatabaseModel.ItemDescription("SomeWeapon4", new decimal(5.47), "720", "2", "imgUrl", true, 4);

            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon1")).Returns(someWeapon1);
            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon2")).Returns(someWeapon2);
            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon3")).Returns(someWeapon3);
            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync("SomeWeapon4")).Returns(someWeapon4);

            A.CallTo(() => fakedItemDescriptionRepoService.FindAsync(A <List <string> > ._)).Returns(new List <DatabaseModel.ItemDescription>
            {
                someWeapon1,
                someWeapon2,
                someWeapon3,
                someWeapon4,
            });


            _offerService = new OfferService(fakedRepoServiceFactory, fakedTransactionFactory, A.Dummy <ILogServiceFactory>());
        }
示例#17
0
        public async Task InitTest()
        {
            var itemDesc1 = new DatabaseModel.ItemDescription("item1", new decimal(10.20), "730", "2", "imageUrl", true);
            var itemDesc2 = new DatabaseModel.ItemDescription("item2", new decimal(11.40), "730", "2", "imageUrl", true);

            ItemDescription1 = await new ItemDescriptionRepoService(DatabaseConnectionFactory, new ItemDescriptionQueries()).InsertAsync(itemDesc1);
            ItemDescription2 = await new ItemDescriptionRepoService(DatabaseConnectionFactory, new ItemDescriptionQueries()).InsertAsync(itemDesc2);

            var bot = new DatabaseModel.Bot(",anotherBot", "Bot 2");

            Bot1 = await new BotRepoService(DatabaseConnectionFactory, new BotQueries()).InsertAsync(bot);

            var userRepo        = new QueryFactory().UserQueries;
            var userRepoService = new UserRepoService(DatabaseConnectionFactory, userRepo);

            User1 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "987456131549",
                                                          "Kalle",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User2 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "987456131548",
                                                          "Kalle1",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User3 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "789456321159",
                                                          "Kalle1",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User4 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "4571248613587",
                                                          "Kalle1",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User5 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "2745613477",
                                                          "Kalle1",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User6 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "27456134hjadshjgs77",
                                                          "Kalle1",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));
        }
示例#18
0
 public static bool IsCsgoItem(DatabaseModel.ItemDescription item)
 {
     return(item.AppId == 730.ToString());
 }
        public async Task InitTest()
        {
            var userRepoService  = new UserRepoService(DatabaseConnectionFactory, new UserQueries());
            var matchRepoService = new MatchRepoService(DatabaseConnectionFactory, new MatchQueries());
            var betRepoService   = new BetRepoService(DatabaseConnectionFactory, new BetQueries());
            var itemRepoService  = new ItemRepoService(DatabaseConnectionFactory, new ItemQueries());

            GameMode = new DatabaseModel.GameMode("Jackpot", 1);
            await new GameModeRepoService(DatabaseConnectionFactory).Insert(GameMode);

            User1 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "987654321",
                                                          "Kalle",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User2 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "4477654321",
                                                          "Kalle",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            User3 = await userRepoService.InsertAsync(new DatabaseModel.User(
                                                          "444784",
                                                          "Kalle",
                                                          " ba/bab154f01140ec39b2986d97838f0127534ec82d_full.jpg ",
                                                          "?partner=117688384&token=mn347bmb ",
                                                          DateTime.Now,
                                                          DateTime.Now,
                                                          false
                                                          ));

            Match1 = await matchRepoService.InsertAsync(new DatabaseModel.Match(
                                                            11,
                                                            "salt",
                                                            "hash",
                                                            47.5484.ToString(CultureInfo.InvariantCulture),
                                                            1,
                                                            null,
                                                            null,
                                                            1,
                                                            GameMode.Id,
                                                            DateTime.Now
                                                            ));

            Match2 = await matchRepoService.InsertAsync(new DatabaseModel.Match(
                                                            101,
                                                            "salt",
                                                            "hash",
                                                            47.5484.ToString(CultureInfo.InvariantCulture),
                                                            1,
                                                            null,
                                                            null,
                                                            1,
                                                            GameMode.Id,
                                                            DateTime.Now
                                                            ));

            var model1 =
                new DatabaseModel.ItemDescription("itemDescription itembet 2", new decimal(13.37), "730", "2", "imageUrl", true);
            var model2 =
                new DatabaseModel.ItemDescription("itemDescription itembet 1", new decimal(13.37), "730", "2", "imageUrl", true);
            var itemDescriptionRepoService = new ItemDescriptionRepoService(DatabaseConnectionFactory, new ItemDescriptionQueries());

            BotId =
                await new BotRepoService(DatabaseConnectionFactory, new BotQueries()).InsertAsync(new DatabaseModel.Bot("47489", "Bot ItemBet"));
            ItemDescription1 = await itemDescriptionRepoService.InsertAsync(model2);

            ItemDescription2 = await itemDescriptionRepoService.InsertAsync(model1);

            Item1 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 1", ItemDescription1.Id, BotId.Id, User1.Id, DateTimeOffset.Now));

            Item2 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 2", ItemDescription1.Id, BotId.Id, User1.Id, DateTimeOffset.Now));

            Item3 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 3", ItemDescription2.Id, BotId.Id, User1.Id, DateTimeOffset.Now));

            Item4 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 4", ItemDescription1.Id, BotId.Id, User1.Id, DateTimeOffset.Now));

            Item5 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 5", ItemDescription2.Id, BotId.Id, User1.Id, DateTimeOffset.Now));

            Item6 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 6", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item7 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 7", ItemDescription2.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item8 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 8", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item9 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 9", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item10 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 10", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item11 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 11", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item12 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 12", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item13 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 13", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item14 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 14", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Item15 = await itemRepoService.InsertAsync(new DatabaseModel.Item("itemBet 15", ItemDescription1.Id, BotId.Id, User2.Id, DateTimeOffset.Now));

            Bet1 = await betRepoService.InsertAsync(new DatabaseModel.Bet(User1.Id, Match1.Id, GameMode.Id, DateTime.Now));

            Bet2 = await betRepoService.InsertAsync(new DatabaseModel.Bet(User2.Id, Match1.Id, GameMode.Id, DateTime.Now));

            Bet3 = await betRepoService.InsertAsync(new DatabaseModel.Bet(User3.Id, Match1.Id, GameMode.Id, DateTime.Now));

            Bet4 = await betRepoService.InsertAsync(new DatabaseModel.Bet(User3.Id, Match2.Id, GameMode.Id, DateTime.Now));

            Bet5 = await betRepoService.InsertAsync(new DatabaseModel.Bet(User1.Id, Match2.Id, GameMode.Id, DateTime.Now));
        }
示例#20
0
 public static bool IsPubgItem(DatabaseModel.ItemDescription item)
 {
     return(item.AppId == 578080.ToString());
 }
示例#21
0
 public async Task Update(DatabaseModel.ItemDescription itemDesc)
 {
     var query = _itemDescriptionQueries.Update(itemDesc);
     var res   = await _databaseConnection.ExecuteNonQueryAsync(query);
 }