Пример #1
0
        private void updateStatistic()
        {
            int maleCount   = 0;
            int femaleCount = 0;

            try
            {
                citizenList = new List <Citizen>();

                foreach (Citizen citizen in AddUser.ReadAll())
                {
                    Console.WriteLine("CitizenID:" + citizen.citizenID + " / Name:" + citizen.name + " / Vorname:" + citizen.firstName + citizen.gender);

                    if (citizen.gender == "Herr")
                    {
                        maleCount++;
                    }
                    else
                    {
                        femaleCount++;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fehler beim Auslesen:" + ex.Message);
            }

            genderStatistic.ColumnDefinitions[0].Width = new GridLength(maleCount, GridUnitType.Star);
            genderStatistic.ColumnDefinitions[1].Width = new GridLength(femaleCount, GridUnitType.Star);
            mencount.Content   = "Männer: " + maleCount;
            womencount.Content = "Frauen: " + femaleCount;
        }
Пример #2
0
        private void updateDataGrid()
        {
            try
            {
                citizenList = new List <Citizen>();

                foreach (Citizen citizen in AddUser.ReadAll())
                {
                    citizenList.Add(citizen);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Fehler beim Auslesen:" + ex.Message);
            }
            ReadAll();

            listAllCitizens.ItemsSource = citizenList;
        }