Example #1
0
        public ActionResult RefuseOrganizer(int id)
        {
            PresidentService preservice = new PresidentService();

            preservice.RefuseOrganizer(id);
            return(RedirectToAction("Index"));
        }
Example #2
0
        public ActionResult Index(string eventName)
        {
            PresidentService orgserv = new PresidentService();
            var list = orgserv.searchEventParticipant(eventName);

            ViewBag.list = list;
            return(View(list));
        }
        private void PresidentComboBoxList()
        {
            var Pre = PresidentService.GetPresident().Select(x => x.Name);

            foreach (var pre in Pre)
            {
                CountryComboBox.Items.Add(pre);
            }
        }
Example #4
0
        private void PresidentComboBoxList() //Column 2
        {
            var Pre = PresidentService.GetPresident().Where(x => x.Id == 2).Select(x => x.Name);

            foreach (var pre in Pre)
            {
                PresidentComboBox.Items.Add(pre);
            }
        }
        private void CityComboBoxList()
        {
            var Cit = PresidentService.GetPresident().Select(x => x.Name);

            foreach (var cit in Cit)
            {
                PresidentComboBox.Items.Add(cit);
            }
        }
Example #6
0
        // GET: President
        public ActionResult Index()
        {
            var list = new List <Domain.Entities.EventOrganizer>();
            PresidentService orgserv = new PresidentService();

            list         = orgserv.getOrganizersRequest();
            ViewBag.list = list;
            return(View(list));
        }
        private void PresidentComboBoxList() //Column 2
        {
            PresidentComboBox.Items.Clear();
            var Pre = PresidentService.UpdataPresident().Where(x => x.Id == Id_Country).Select(x => x.Name);
            foreach (var pre in Pre)
            {
                PresidentComboBox.Items.Add(pre);
            }

        }
        private void PresidentComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            PresidentSetName.Text = PresidentService.GetPresident()
                                    .Where(x => (x.Name == PresidentComboBox.SelectedItem.ToString()))
                                    .Select(x => x.Name).FirstOrDefault().ToString();

            PresidentSetAge.Text = PresidentService.GetPresident()
                                   .Where(x => (x.Name == PresidentComboBox.SelectedItem.ToString()))
                                   .Select(x => x.Age).FirstOrDefault().ToString();
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            string _countryName      = CountrySetName.Text;
            string _countryContinent = CountrySetContinent.Text;
            string _presidentName    = PresidentSetName.Text;
            string _presidentAge     = PresidentSetAge.Text;

            string _cityName = CitySetName.Text ?? String.Empty;

            string _cityPopulation     = CitySetPopulation.Text;
            string _cityPopulationInt  = CitySetPopulation.Text;
            string _palceName          = PlaceSetName.Text;
            string _placePopulation    = PlaceSetPopulation.Text;
            string _buildingType       = BuildingSetType.Text;
            string _buildingWindows    = BuildingSetWindows.Text;
            string _buildingIndustrial = BuildingSetIsIndustrial.Text;

            if ((_countryName == countryName && _countryContinent != countryContinent) || (_countryName == countryName && _countryContinent == countryContinent))
            {
                CountryService.SaveCountry(_countryName, _countryContinent, Id_Country);

                if ((_presidentName == presidentName && _presidentAge != presidentAge) || _presidentName != presidentName)
                {
                    PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), Id_Country);
                }
                if (_cityName == cityName && _cityPopulation != cityPopulation)
                {
                    CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulationInt), Id_Country, Id_City);
                }
                else
                {
                    CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulationInt), Id_Country);
                }
            }
            if (_countryName != countryName)
            {
                CountryService.SaveCountry(_countryName, _countryContinent);
            }

            CountryComboBoxList();
            PresidentComboBoxList();
            CityComboBoxList();
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            string _countryName      = CountrySetName.Text;
            string _countryContinent = CountrySetContinent.Text;
            string _presidentName    = PresidentSetName.Text;
            string _presidentAge     = PresidentSetAge.Text;

            string _cityName = CitySetName.Text;

            string _cityPopulation     = CitySetPopulation.Text;
            string _cityPopulationInt  = CitySetPopulation.Text;
            string _palceName          = PlaceSetName.Text;
            string _placePopulation    = PlaceSetPopulation.Text;
            string _buildingType       = BuildingSetType.Text;
            string _buildingWindows    = BuildingSetWindows.Text;
            string _buildingIndustrial = BuildingSetIsIndustrial.Text;

            if ((_countryName == countryName && _countryContinent != countryContinent) || (_countryName == countryName && _countryContinent == countryContinent))
            {
                CountryService.SaveCountry(_countryName, _countryContinent, Id_Country); //bez sensu. nawet jak nie zmieniam country to męczy DB i updatuje

                if ((_presidentName == presidentName && _presidentAge != presidentAge) || _presidentName != presidentName)
                {
                    PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), Id_Country);
                }
                if (_cityName != "")
                {
                    CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulationInt), Id_Country, Id_City);
                }
            }
            if (_countryName != countryName)
            {
                CountryService.SaveCountry(_countryName, _countryContinent);
                int id_Country = CountryService.GetCountry().Select(x => x.Id).LastOrDefault();
                PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), id_Country);
                CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulationInt), id_Country);
                int id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault();
            }

            CountryComboBoxList();
            PresidentComboBoxList();
            CityComboBoxList();
        }
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            string _countryName      = CountrySetName.Text;
            string _countryContinent = CountrySetContinent.Text;
            string _presidentName    = PresidentSetName.Text;
            int    _presidentAge;
            bool   _presidentAgeBool = Int32.TryParse(PresidentSetAge.Text, out _presidentAge);
            string _cityName         = CitySetName.Text;
            int    _cityPopulation;
            bool   _cityPopulationBool = Int32.TryParse(CitySetPopulation.Text, out _cityPopulation);
            string _placeStreet        = PlaceSetStreet.Text;
            int    _placePopulation;
            bool   _placePopulationBool = Int32.TryParse(PlaceSetPopulation.Text, out _placePopulation);
            string _buildingType        = BuildingSetType.Text;
            string _buildingWindows     = BuildingSetWindows.Text;
            string _buildingIndustrial  = BuildingSetIsIndustrial.Text;
            bool   _buildingWindowsBool;
            bool   _buildingIndustrialBool;

            if (_buildingWindows.ToUpper().Trim() == "TAK")
            {
                _buildingWindowsBool = true;
            }
            else
            {
                _buildingWindowsBool = false;
            }
            if (_buildingIndustrial.ToUpper().Trim() == "TAK")
            {
                _buildingIndustrialBool = true;
            }
            else
            {
                _buildingIndustrialBool = false;
            }

            if (_countryName == "" || _presidentName == "")
            {
                MessageBox.Show("Nie została podana nazwa państwa lub/i nazwisko prezydenta");
                return;
            }
            if (!_presidentAgeBool || !_cityPopulationBool || !_placePopulationBool)
            {
                MessageBox.Show("Wartości dla wieku czy populacji należy podawać w liczbach całkowitych");
                return;
            }

            if (_countryName == countryName)
            {
                if (_countryContinent != countryContinent)
                {
                    CountryService.SaveCountry(_countryName, _countryContinent, Id_Country);
                }


                if (_cityName == cityName && _cityPopulation != Convert.ToInt32(cityPopulation))
                {
                    CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), Id_Country, Id_City);
                }

                if (_cityName != cityName)
                {
                    CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), Id_Country);
                    Id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault();
                }

                if ((_buildingType == buildingType && (_buildingWindows != buildingWindows || _buildingIndustrial != buildingIndustrial)))
                {
                    BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool, Place_Id_Building);
                }

                if (_buildingType != buildingType)
                {
                    BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool);
                    Place_Id_Building = BuildingService.GetBuilding().Select(x => x.Id).LastOrDefault();
                }

                if (_placeStreet == placeStreet && _placePopulation != Convert.ToInt32(placePopulation))
                {
                    PlaceService.SavePlace(_placeStreet, _placePopulation, Id_City, Place_Id_Building, Place_Id);
                }

                if (_placeStreet != placeStreet)
                {
                    PlaceService.SavePlace(_placeStreet, _placePopulation, Id_City, Place_Id_Building);
                }
            }
            else
            {
                CountryService.SaveCountry(_countryName, _countryContinent);
                int id_Country = CountryService.GetCountry().Select(x => x.Id).LastOrDefault();
                PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), id_Country);
                CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), id_Country);
                int id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault();

                BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool);
                Place_Id_Building = BuildingService.GetBuilding().Select(x => x.Id).LastOrDefault();
                PlaceService.SavePlace(_placeStreet, Convert.ToInt32(_placePopulation), id_City, Place_Id_Building);
            }


            CountryComboBoxList();
            PresidentComboBoxList();
            CityComboBoxList();
            PlaceComboBoxList();
            BuildingComboBoxList();
            CountrySetName.Clear();
            CountrySetContinent.Clear();
            PresidentSetName.Clear();
            PresidentSetAge.Clear();
            CitySetName.Clear();
            CitySetPopulation.Clear();
            CitySetPopulation.Clear();
            PlaceSetStreet.Clear();
            PlaceSetPopulation.Clear();
            BuildingSetType.Clear();
            BuildingSetWindows.Clear();
            BuildingSetIsIndustrial.Clear();
        }
Example #12
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            string _countryName        = CountrySetName.Text;
            string _countryContinent   = CountrySetContinent.Text;
            string _presidentName      = PresidentSetName.Text;
            string _presidentAge       = PresidentSetAge.Text;
            string _cityName           = CitySetName.Text;
            string _cityPopulation     = CitySetPopulation.Text;
            string _palceStreet        = PlaceSetStreet.Text;
            string _placePopulation    = PlaceSetPopulation.Text;
            string _buildingType       = BuildingSetType.Text;
            string _buildingWindows    = BuildingSetWindows.Text;
            string _buildingIndustrial = BuildingSetIsIndustrial.Text;

            //if(_countryName==""||)


            if ((_countryName == countryName && _countryContinent != countryContinent) || (_countryName == countryName && _countryContinent == countryContinent))
            {
                CountryService.SaveCountry(_countryName, _countryContinent, Id_Country); //bez sensu. nawet jak nie zmieniam country to męczy DB i updatuje

                if ((_presidentName == presidentName && _presidentAge != presidentAge) || _presidentName != presidentName)
                {
                    PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), Id_Country);
                }
                if (_cityName != "")
                {
                    CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), Id_Country, Id_City);
                }
            }
            if (_countryName != countryName)
            {
                bool _buildingWindowsBool;
                bool _buildingIndustrialBool;
                CountryService.SaveCountry(_countryName, _countryContinent);
                int id_Country = CountryService.GetCountry().Select(x => x.Id).LastOrDefault();
                PresidentService.SavePresident(_presidentName, Convert.ToInt32(_presidentAge), id_Country);
                CityService.SaveCity(_cityName, Convert.ToInt32(_cityPopulation), id_Country);
                int id_City = CityService.GetCity().Select(x => x.Id).LastOrDefault();
                if (_buildingWindows.ToUpper().Trim() == "TAK")
                {
                    _buildingWindowsBool = true;
                }
                else
                {
                    _buildingWindowsBool = false;
                }
                if (_buildingIndustrial.ToUpper().Trim() == "TAK")
                {
                    _buildingIndustrialBool = true;
                }
                else
                {
                    _buildingIndustrialBool = false;
                }
                BuildingService.SaveBuilding(_buildingType, _buildingWindowsBool, _buildingIndustrialBool);
                int id_Building = BuildingService.GetBuilding().Select(x => x.Id).LastOrDefault();
                PlaceService.SavePlace(_palceStreet, Convert.ToInt32(_placePopulation), id_City, id_Building);
            }

            CountryComboBoxList();
            PresidentComboBoxList();
            CityComboBoxList();
            PlaceComboBoxList();
            BuildingComboBoxList();
            CountrySetName.Clear();
            CountrySetContinent.Clear();
            PresidentSetName.Clear();
            PresidentSetAge.Clear();
            CitySetName.Clear();
            CitySetPopulation.Clear();
            CitySetPopulation.Clear();
            PlaceSetStreet.Clear();
            PlaceSetPopulation.Clear();
            BuildingSetType.Clear();
            BuildingSetWindows.Clear();
            BuildingSetIsIndustrial.Clear();
        }
Example #13
0
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     PresidentService.DeletePresident(Id_Country);
 }