Example #1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (DatePicker.DisplayDate == null)
            {
                MessageBox.Show("Date can`t be null.");
                return;
            }

            Olympiad newType = new Olympiad();

            GetPropForSelectedService getService = new GetPropForSelectedService();

            newType.Date    = DatePicker.SelectedDate.Value;
            newType.Type    = getService.GetOlympTypes().FirstOrDefault(x => x.Name == (OlympTypeComboBox.SelectedItem as OlympType).Name);
            newType.Country = getService.GetCountry().FirstOrDefault(x => x.Name == (CountryComboBox.SelectedValue as Country).Name);


            foreach (var o in getService.GetOlympiads())
            {
                if (o.Date == newType.Date)
                {
                    MessageBox.Show($"Olympiads in {o.Date.ToString("0:d")} alredy exists.");
                }
            }

            AddingService addService = new AddingService();

            addService.AddOlympiad(newType);
            MessageBox.Show("Olympiad adding");
        }
Example #2
0
        public AddOlympiadWindow()
        {
            InitializeComponent();

            GetPropForSelectedService service = new GetPropForSelectedService();

            Countries  = service.GetCountry(false);
            OlympTypes = service.GetOlympTypes(false);

            if (Countries.Count <= 0)
            {
                this.Hide();
                MessageBox.Show("Add countries first.");
                this.Close();
                return;
            }
            if (OlympTypes.Count <= 0)
            {
                this.Hide();
                MessageBox.Show("Add olymp types first.");
                this.Close();
                return;
            }

            OlympTypeComboBox.ItemsSource = OlympTypes;
            CountryComboBox.ItemsSource   = Countries;

            this.DataContext = this;
        }
Example #3
0
        public AddCityWindow()
        {
            InitializeComponent();

            GetPropForSelectedService getService = new GetPropForSelectedService();

            if (getService.GetCountry(true).Count <= 0)
            {
                MessageBox.Show("Add country first.");
                this.Close();
                return;
            }

            CountryComboBox.ItemsSource = getService.GetCountry(false);

            this.DataContext = this;
        }
Example #4
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (DatePicker.DisplayDate == null)
            {
                MessageBox.Show("Date can`t be null.");
                return;
            }
            if (PhotoPath == null)
            {
                MessageBox.Show("Photo can`t be null.");
                return;
            }


            Person newType = new Person();
            GetPropForSelectedService getService = new GetPropForSelectedService();

            newType.FirstName   = FirstName;
            newType.SecondName  = SecondName;
            newType.ThirdName   = ThirdName;
            newType.CountryID   = getService.GetCountry(false).FirstOrDefault(x => x.Name == (CountryComboBox.SelectedItem as Country).Name).ID;
            newType.DateOfBirth = DatePicker.SelectedDate.Value;
            newType.PhotoPath   = PhotoPath;


            foreach (var p in getService.GetPersons())
            {
                if (p.FirstName == newType.FirstName)
                {
                    if (p.SecondName == newType.SecondName)
                    {
                        if (p.ThirdName == newType.ThirdName)
                        {
                            MessageBox.Show($"{p.FirstName} {p.SecondName} {p.ThirdName} alredy exist`s.");
                            return;
                        }
                    }
                }
            }


            AddingService addService = new AddingService();

            addService.AddPerson(newType);
            MessageBox.Show("New person added.");
        }
Example #5
0
        public AddPersonWindow()
        {
            InitializeComponent();


            GetPropForSelectedService service = new GetPropForSelectedService();

            Countries = service.GetCountry(true);

            if (Countries.Count <= 0)
            {
                this.Hide();
                MessageBox.Show("Add countries first.");
                this.Close();
                return;
            }

            CountryComboBox.ItemsSource = Countries;

            this.DataContext = this;
        }
Example #6
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            Country newType = new Country();

            newType.Name = Name_;

            GetPropForSelectedService GettingService = new GetPropForSelectedService();

            foreach (var type in GettingService.GetCountry())
            {
                if (type.Name == Name_)
                {
                    MessageBox.Show($"{Name_} alredy exists.");
                    return;
                }
            }

            AddingService service = new AddingService();

            service.AddCountry(newType);

            MessageBox.Show("New country added.");
        }