Ejemplo n.º 1
0
        public async void Initialize()
        {
            this.AuthorizedEmployee = SessionService.Instance.AuthorizedEmployee;

            Favorite favorite = new Favorite();

            this.Favorites = await favorite.GetFavoritesAsync();

            this.Date      = new Card();
            this.Date.Date = this.Date.Date.Date;
            this.Favorite  = new Favorite();

            Card card = new Card();

            this.AllCards = await card.GetCardsAsync();

            this.AllCards = AllCards.Where(ac => ac.PickUp == true).ToList();

            var FavoriteCheckCards = new List <Card>();

            for (var i = 0; i < AllCards.Count; i++)
            {
                card = AllCards.ElementAt(i);
                //card.Id == Favorites.CardId && this.AuthorizedEmployee.Id == Favorites.EmployeeId
                if (Favorites.Any(f => f.CardId == card.Id && f.EmployeeId == this.AuthorizedEmployee.Id))
                {
                    //List<int> intList = new List<int>;

                    card          = AllCards.ElementAt(i);
                    card.Favorite = true;

                    FavoriteCheckCards.Add(card);

                    //this.AllCards.RemoveAt(i);
                    //this.Cards.Insert(i, card);
                    //this.Cards.Insert(i, new Card() { Id = card.Id, CD = card.CD, Text = card.Text, Date = card.Date, FromId = card.FromId, ToId = card.ToId, Title = card.Title, Reply = card.Reply, Favorite = card.Favorite, PickUp = card.PickUp });
                    //this.Cards.Add(card);
                    //this.AllCards.Insert(i, new Card() { Id = card.Id, CD = card.CD, Text = card.Text, Date = card.Date, FromId = card.FromId, ToId = card.ToId, Title = card.Title, Reply = card.Reply, Favorite = card.Favorite, PickUp = card.PickUp });
                    //this.Cards.Add(new Card() { Id = card.Id, CD = card.CD, Text = card.Text, Date = card.Date, FromId = card.FromId, ToId = card.ToId, Title=card.Title, Reply=card.Reply, Favorite=card.Favorite, PickUp=card.PickUp});
                }
                else
                {
                    FavoriteCheckCards.Add(card);
                }
            }



            this.Cards = AllCards;
            //this.AuthorizedEmployee = SessionService.Instance.AuthorizedEmployee;
        }
Ejemplo n.º 2
0
        public void CalculateCardSet()
        {
            Dictionary <Card, int> cardCounter = new Dictionary <Card, int>();

            foreach (Deck d in AllDecks)
            {
                foreach (Card c in d.ClassCards)
                {
                    var foundCard = AllCards.Where(card => card.HearthstoneCard.Name == c.Name).FirstOrDefault();
                    if (foundCard == null)
                    {
                        foundCard = new CardReport()
                        {
                            HearthstoneCard = c
                        };
                        AllCards.Add(foundCard);
                    }

                    foreach (var cardReport in AllCards.Where(w => w.HearthstoneCard.Name == c.Name))
                    {
                        cardReport.CardCount++;
                        cardReport.DecksWithCard.Add(d);
                    }
                }

                foreach (Card c in d.NeutralCards)
                {
                    var foundCard = AllCards.Where(card => card.HearthstoneCard.Name == c.Name).FirstOrDefault();
                    if (foundCard == null)
                    {
                        foundCard = new CardReport()
                        {
                            HearthstoneCard = c
                        };
                        AllCards.Add(foundCard);
                    }

                    foreach (var cardReport in AllCards.Where(w => w.HearthstoneCard.Name == c.Name))
                    {
                        cardReport.CardCount++;
                        cardReport.DecksWithCard.Add(d);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void ShuffleCards()
        {
            Player1Cards = new List <Car>();
            Player2Cards = new List <Car>();
            var    cardsPerPlayer = 20;
            var    allCardsTotal  = 40;
            Random random         = new Random();
            var    value          = 0;

            for (int i = 1; i <= cardsPerPlayer; i++)
            {
                do
                {
                    value = random.Next(allCardsTotal);
                }while(!AllCards.Any(obj => obj.Id == value));
                Player1Cards.Add((Car)AllCards.Where(obj => obj.Id == value).FirstOrDefault());
                AllCards.Remove((Car)AllCards.Where(obj => obj.Id == value).FirstOrDefault());
            }
            Player2Cards = AllCards;
        }
        private void Save(object obj)
        {
            this._notification.CardCollection.ForEach(x =>
            {
                x.Reset();
            });

            int i = 0;
            var cardCollection = _notification.CardCollection;

            foreach (var card  in AllCards.Where(x => x.IsChecked))
            {
                if (i >= cardCollection.Count())
                {
                    break;
                }
                cardCollection.ElementAt(i).Suit = card.Suit;
                cardCollection.ElementAt(i).Rank = card.Rank;
                i++;
            }

            this._notification.Confirmed = true;
            this.FinishInteraction();
        }
Ejemplo n.º 5
0
 public void ShowRefineCards()
 {
     this.Cards = AllCards.Where(ac => ac.Date.Date == this.Date.Date).ToList();
 }
Ejemplo n.º 6
0
        public async void Initialize()
        {
            Employee   employees   = new Employee();
            Department departments = new Department();
            Card       card        = new Card();
            Favorite   favorite    = new Favorite();

            //下のやつは、ログイン者のEmployee情報をAuthorizedEMployeeに入れてます。
            this.AuthorizedEmployee = SessionService.Instance.AuthorizedEmployee;
            if (SessionService.Instance.AuthorizedEmployee != null)
            {
                this.Employees = await employees.GetEmployeesAsync();

                this.Departments = await departments.GetDepartmentsAsync();

                this.AllCards = await card.GetCardsAsync();

                this.Favorites = await favorite.GetFavoritesAsync();
            }


            #region FavoriteCards
            this.FavoriteCards = Favorites.Where(f => f.EmployeeId == this.AuthorizedEmployee.Id).ToList();
            for (var i = 0; i < FavoriteCards.Count; i++)
            {
                favorite = FavoriteCards.ElementAt(i);
                favorite.Card.Favorite = true;

                FavoriteCards.RemoveAt(i);
                FavoriteCards.Insert(i, favorite);
            }
            #endregion

            #region SendCards
            this.SendCards = AllCards.Where(al => al.From.Id == this.AuthorizedEmployee.Id).ToList();
            for (var i = 0; i < SendCards.Count; i++)
            {
                if (Favorites.Any(f => f.CardId == card.Id && f.EmployeeId == this.AuthorizedEmployee.Id))
                {
                    card          = SendCards.ElementAt(i);
                    card.Favorite = true;

                    SendCards.RemoveAt(i);
                    SendCards.Insert(i, card);
                }
            }
            #endregion

            #region ReceiveCards
            this.ReceiveCards = AllCards.Where(al => al.To.Id == this.AuthorizedEmployee.Id).ToList();
            for (var i = 0; i < ReceiveCards.Count; i++)
            {
                if (Favorites.Any(f => f.CardId == card.Id && f.EmployeeId == this.AuthorizedEmployee.Id))
                {
                    card          = ReceiveCards.ElementAt(i);
                    card.Favorite = true;

                    ReceiveCards.RemoveAt(i);
                    ReceiveCards.Insert(i, card);
                }
            }
            #endregion

            var FavoriteCheckCards = new List <Card>();

            for (var i = 0; i < AllCards.Count; i++)
            {
                card = AllCards.ElementAt(i);

                if (Favorites.Any(f => f.CardId == card.Id && f.EmployeeId == this.AuthorizedEmployee.Id))
                {
                    card          = AllCards.ElementAt(i);
                    card.Favorite = true;

                    FavoriteCheckCards.Add(card);
                }
            }
            this.Cards = FavoriteCheckCards;
            this.Cards = Cards.OrderBy(ac => ac.Date).ToList();
        }