Exemplo n.º 1
0
 public static void gerarCards()
 {
     Cards card = new Cards();
     for (int i = 0; i < 16; i++)
     {
         card.PlayerName = players[i, 0];
         card.PlayerTeam = players[i, 1];
         card.PlayerPath = players[i, 2];
         card.Rarity = Int32.Parse(players[i,3]);
         card.Amount = Int32.Parse(players[i,4]);
         card.Save();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Exclui o card do banco de dados
 /// </summary>
 /// <param name="card"></param>
 /// <returns>bool</returns>
 public bool Destroy(Cards card)
 {
     try
     {
         using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString))
         {
             var excluir = db.cards.Where(t => t.id == card.id).First();
             db.cards.DeleteOnSubmit(excluir);
             db.SubmitChanges();
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Decrease the card amount
 /// </summary>
 /// <param name="card"></param>
 /// <returns>bool</returns>
 public bool Decrease(Cards card)
 {
     try
     {
         using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString))
         {
             Cards update = (from tar in db.cards
                             where tar.id == card.id
                             select tar).First();
             update.Amount -= 1;
             db.SubmitChanges();
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }
Exemplo n.º 4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            // Maintain a list of peers and bind that list to the UI
            _peerApps = new ObservableCollection<PeerAppInfo>();
            PeerList.ItemsSource = _peerApps;

            // Register for incoming connection requests
            PeerFinder.ConnectionRequested += PeerFinder_ConnectionRequested;

            // Start advertising ourselves so that our peers can find us
            PeerFinder.Start();

            RefreshPeerAppList();

            base.OnNavigatedTo(e);

            string parameterValue = NavigationContext.QueryString["parameter"];
            
            card = new Cards();
            card = card.getCard(int.Parse(parameterValue));
            this.DataContext = card;
        }
Exemplo n.º 5
0
 private void GetCard()
 {
     Random rand = new Random();
     int id = rand.Next(0, 2);
     Cards card = new Cards();
     card = card.getCard(id);
     card.Increase();
 }
Exemplo n.º 6
0
 private void ReloadCards()
 {
     Cards cards = new Cards();
     listCards.ItemsSource = cards.getAllCards();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Salva um card para o banco de dados
 /// </summary>
 /// <param name="card"></param>
 /// <returns>bool</returns>
 public bool Save(Cards card)
 {
     try
     {
         using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString))
         {
             db.cards.InsertOnSubmit(card);
             db.SubmitChanges();
         }
         return true;
     }
     catch (Exception)
     {
         return false;
     }
 }