Ejemplo n.º 1
0
    public void purchasePack()
    {
        /*getCollection creds = new getCollection("getCredits", Global.getID(), Global.getToken());
         * string amount = Global.NetworkRequest(creds);
         * Debug.Log(amount);
         * Int32 amountnum = Int32.Parse(amount);
         * if (amountnum > 100) //CHANGE TO WHATEVER THE COST SHOULD BE*/
        if (Global.usercredits > 100)
        {
            clicked = 0;
            getCollection asdf  = new getCollection("openPack", Global.getID(), Global.getToken());
            string        res   = Global.NetworkRequest(asdf);
            string[]      cards = res.Split(',');
            Global.usercredits -= 100;
            moneyAmount.text    = Global.usercredits.ToString();
            CreditRequest decrease = new CreditRequest("updateCredits", Global.getID(), Global.getToken(), -100);
            string        consumer = Global.NetworkRequest(decrease);
            foreach (string c in cards)
            {
                Debug.Log(c);
                AddCardRequest newcard = new AddCardRequest(Global.getID(), Global.getToken(), c, "addCardToCollection");
                string         added   = Global.NetworkRequest(newcard);
            }
            for (int a = 0; a < cards.Length; a++)
            {
                cards[a] = cards[a].Replace(" ", String.Empty);
            }
            //sets up card screen
            lobbybutton.interactable = false;
            card1.interactable       = true;
            card2.interactable       = true;
            card3.interactable       = true;
            card4.interactable       = true;
            card5.interactable       = true;
            card1image.gameObject.SetActive(false);
            card1image.sprite = Resources.Load <Sprite>("images/" + cards[0]);
            card1imageback.gameObject.SetActive(true);
            card2image.gameObject.SetActive(false);
            card2image.sprite = Resources.Load <Sprite>("images/" + cards[1]);
            card2imageback.gameObject.SetActive(true);
            card3image.gameObject.SetActive(false);
            card3image.sprite = Resources.Load <Sprite>("images/" + cards[2]);
            card3imageback.gameObject.SetActive(true);
            card4image.gameObject.SetActive(false);
            card4image.sprite = Resources.Load <Sprite>("images/" + cards[3]);
            card4imageback.gameObject.SetActive(true);
            card5image.gameObject.SetActive(false);
            card5image.sprite = Resources.Load <Sprite>("images/" + cards[4]);
            card5imageback.gameObject.SetActive(true);
            confirm.gameObject.SetActive(false);

            CardsPanel.gameObject.SetActive(true);
        }
        else
        {
            ErrorPanel.gameObject.SetActive(true);
        }
    }
Ejemplo n.º 2
0
        public void Execute(AddCardRequest addCardRequest)
        {
            var cardData = CardData.Factory.CreateNew(
                addCardRequest.BankId,
                addCardRequest.CardTypeId,
                addCardRequest.CardNumber,
                addCardRequest.Cvv,
                addCardRequest.ExpiryMonth,
                addCardRequest.ExpiryYear,
                addCardRequest.CreateDate,
                addCardRequest.Notes
                );

            _secureVaultDataStore.AddCard(cardData);
        }
Ejemplo n.º 3
0
        public async Task <int> AddCard(AddCardRequest card)
        {
            var cardDefinition = await context.CardDefinitions.FindAsync(card.DefinitionId);

            var cardEntity = new Entities.Card
            {
                Definition = cardDefinition,
                Name       = card.Name,
                Properties = JsonConvert.SerializeObject(card.Properties)
            };

            context.Cards.Add(cardEntity);
            await context.SaveChangesAsync();

            return(cardEntity.Id);
        }
Ejemplo n.º 4
0
        public async Task <int> AddCard(AddCardRequest card)
        {
            var cardDefinition = await cardsRepository.GetCardDefinition(card.DefinitionId);

            if (cardDefinition == null)
            {
                throw new ArgumentException($"Cannot find card definition {card.DefinitionId}.");
            }

            if (ValidateIfCardMatchDefinition(card, cardDefinition))
            {
                throw new ArgumentException($"Provided card doesnt match definition {card.DefinitionId}.");
            }

            return(await cardsRepository.AddCard(card));
        }
Ejemplo n.º 5
0
        public IActionResult Add(CardViewModel cardViewModel)
        {
            if (ModelState.IsValid)
            {
                var addCardRequest = new AddCardRequest(
                    cardViewModel.BankId,
                    cardViewModel.CardTypeId,
                    cardViewModel.CardNumber,
                    cardViewModel.Cvv,
                    cardViewModel.ExpiryMonth,
                    cardViewModel.ExpiryYear,
                    cardViewModel.Notes
                    );

                _addCardUseCase.Execute(addCardRequest);
            }
            else
            {
                return(View("Create"));
            }

            return(RedirectToAction(nameof(Index)));
        }
 public void Post([FromBody] AddCardRequest request)
 {
     Console.WriteLine("Request - User: "******" Card: " + request.CardId);
     //Service.AddCard(request.InventoryId, request.CardId);
 }
Ejemplo n.º 7
0
 public static void Execute(AddCardRequest request)
 {
     DbHelper.CommandSkip(Guid.Parse(request.Card.TurnamentId), Guid.Parse(request.Card.CommandId), Guid.Parse(request.Card.PlayerId), Guid.Parse(request.Card.GameId), request.Card.Type);
     DbHelper.AddCard(Guid.Parse(request.Card.TurnamentId), Guid.Parse(request.Card.CommandId), Guid.Parse(request.Card.PlayerId), Guid.Parse(request.Card.GameId), request.Card.Type);
 }
 public void AddCard(AddCardRequest request) => AddCardBLL.Execute(request);
Ejemplo n.º 9
0
 private bool ValidateIfCardMatchDefinition(AddCardRequest card, CardDefinition cardDefinition)
 {
     return(cardDefinition.Properties.Any(p => !card.Properties.Any(cp => cp.Name == p)));
 }