コード例 #1
0
        private void ExecuteDelete(object parameter)
        {
            Collection <CountryModel> deleteditems = new Collection <CountryModel>();
            IMessageBoxService        msg          = new MessageBoxService();
            string title      = "Deleting Country";
            string confirmtxt = "Do you want to delete the selected item";

            if (Countries.Count(x => x.Selected) > 1)
            {
                title      = "Deleting Countries";
                confirmtxt = confirmtxt + "s";
            }
            if (msg.ShowMessage(confirmtxt + "?", title, GenericMessageBoxButton.OKCancel, GenericMessageBoxIcon.Question).Equals(GenericMessageBoxResult.OK))
            {
                foreach (CountryModel si in Countries)
                {
                    if (si.Selected)
                    {
                        if (si.ID > 0)
                        {
                            DeleteItem(si.ID, "Countries");
                        }
                        deleteditems.Add(si);
                    }
                }
                foreach (CountryModel pm in deleteditems)
                {
                    Countries.Remove(pm);
                }
                deleteditems.Clear();
            }
            msg = null;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: dmasaliy/NBA
        private async void Form1_Load(object sender, EventArgs e)
        {
            Countries = await nb.GetCountries();

            Leagues = await nb.GetLeagues();


            if (Countries.Count() > 0)
            {
                foreach (Country country in Countries)
                {
                    listBox1.Items.Add(country.Country_name);
                }
            }
            List <int> teamIds = new List <int>();

            Fixturess = await nb.GetFixtures(textBox1.Text, textBox2.Text);

            if (Fixturess.Count() > 0)
            {
                foreach (var item in Fixturess)
                {
                    if (!teamIds.Contains(item.Away_team_key))
                    {
                        teamIds.Add(item.Away_team_key);
                    }
                }
            }
        }
コード例 #3
0
ファイル: SignUpContext.cs プロジェクト: vpernankil/dak4.net
        private void SeedReferenceData()
        {
            var seeded = false;

            if (Roles.Count() == 0)
            {
                foreach (var role in Role.GetSeedData())
                {
                    Roles.Add(role);
                }
                seeded = true;
            }

            if (Countries.Count() == 0)
            {
                foreach (var country in Country.GetSeedData())
                {
                    Countries.Add(country);
                }
                seeded = true;
            }

            if (seeded)
            {
                this.SaveChanges();
            }
        }
コード例 #4
0
        private TurnStarted StartTurn(Player player)
        {
            var countries = Countries.Count(c => c.Owner == player);
            var deploy    = (Math.Max(3, countries / 3));

            deploy += Continents.Where(c => c.Owner == player).Sum(c => c.Bonus);
            return(new TurnStarted(Deployments: player.Army(deploy)));
        }
コード例 #5
0
        private void SetNextState()
        {
            this.state = this.state != ResultsState.TwelvePoints ? this.state + 1 : ResultsState.RevealCountry;

            if (this.state == ResultsState.SplashScreen)
            {
                Messenger.Default.Send(new ReadyForLateVotesMessage());
            }

            if (this.state == ResultsState.RevealCountry)
            {
                if (Countries.Count(c => c.IsInQueue) > 0)
                {
                    this.currentlyRevealedCountry = GetSelectedCountry();
                }
                else
                {
                    this.state = ResultsState.RevealWinner;
                }
            }

            if (this.state == ResultsState.TwelvePoints)
            {
                if (this.currentlyRevealedCountry != null)
                {
                    this.currentlyRevealedCountry.IsSelected = false;
                    this.currentlyRevealedCountry.IsInQueue  = false;

                    if (Countries.Count(c => c.IsInQueue) > 0)
                    {
                        if (Countries.Count(c => c.IsInQueue && c.IsSelected) == 0)
                        {
                            Countries.First(c => c.IsInQueue).IsSelected = true;
                        }
                    }
                }
            }

            var selectedCountryId = Countries.FirstOrDefault(c => c.IsSelected)?.Id;

            Model.Country nextCountry = null;
            if (selectedCountryId.HasValue)
            {
                nextCountry = dataService.GetCountry(selectedCountryId.Value);
            }

            Messenger.Default.Send(new ChangeStateMessage(this.state, nextCountry));
            NextCommand.RaiseCanExecuteChanged();
        }
コード例 #6
0
 public int Testing_8()
 {
     using (var db = new NorthwindDbContext())
     {
         var customersInCountry =
             from c in db.Customers
             group c by c.Country into Countries
             where Countries.Count() > 3
             select new
         {
             Countries.Key,
             Count = Countries.Count()
         };
         return(customersInCountry.Count());
     }
 }
コード例 #7
0
 public override string ToString()
 {
     return($"Countries : {Countries.Count()}\nProduct Types : {ProductTypes.Count()}\nFBOTypes : {FBOTypes.Count()}\nUnits : {Units.Count()}\nNotifier Types : {NotifierTypes.Count()}");
 }
コード例 #8
0
        private bool IsDuplicateName(string _name)
        {
            var q = Countries.Count(x => x.Name == _name);

            return(q > 1);
        }
コード例 #9
0
 private bool CanExecuteDelete(object obj)
 {
     return(Countries.Count(x => x.Selected) > 0);
 }
コード例 #10
0
 private bool ConquerCountryWillKillPlayer(CountryId country) => Countries.Count(c => c.Owner == Countries.ById(country).Owner) == 1;