예제 #1
0
        public void inputData()
        {
            string name = Name_TextBox.Text;
            string street = Street_TextBox.Text;
            string houseNumber = Housenumber_TextBox.Text;
            string zipCode = Zipcode_TextBox.Text;
            string city = Place_TextBox.Text;
            string country = Country_TextBox.Text;

            string openingTimeMa = OpeningTimeMa_TextBox.Text;
            string closingTimeMa = ClosingTimeMa_TextBox.Text;
            string openingTimeDi = OpeningTimeDi_TextBox.Text;
            string closingTimeDi = ClosingTimeDi_TextBox.Text;
            string openingTimeWo = OpeningTimeWo_TextBox.Text;
            string closingTimeWo = ClosingTimeWo_TextBox.Text;
            string openingTimeDo = OpeningTimeDo_TextBox.Text;
            string closingTimeDo = ClosingTimeDo_TextBox.Text;
            string openingTimeVr = OpeningTimeVr_TextBox.Text;
            string closingTimeVr = ClosingTimeVr_TextBox.Text;
            string openingTimeZa = OpeningTimeZa_TextBox.Text;
            string closingTimeZa = ClosingTimeZa_TextBox.Text;
            string openingTimeZo = OpeningTimeZo_TextBox.Text;
            string closingTimeZo = ClosingTimeZo_TextBox.Text;

            string longitude = Longitude_TextBox.Text;
            string latitude = Latitude_TextBox.Text;

            string happyhourFromMa = HappyhourFromMa_TextBox.Text;
            string happyhourToMa = HappyhourToMa_TextBox.Text;
            string happyhourFromDi = HappyhourFromDi_TextBox.Text;
            string happyhourToDi = HappyhourToDi_TextBox.Text;
            string happyhourFromWo = HappyhourFromWo_TextBox.Text;
            string happyhourToWo = HappyhourToWo_TextBox.Text;
            string happyhourFromDo = HappyhourFromDo_TextBox.Text;
            string happyhourToDo = HappyhourToDo_TextBox.Text;
            string happyhourFromVr = HappyhourFromVr_TextBox.Text;
            string happyhourToVr = HappyhourToVr_TextBox.Text;
            string happyhourFromZa = HappyhourFromZa_TextBox.Text;
            string happyhourToZa = HappyhourToZa_TextBox.Text;
            string happyhourFromZo = HappyhourFromZo_TextBox.Text;
            string happyhourToZo = HappyhourToZo_TextBox.Text;

            int selectedRatingIndex = Rating_ComboBox.SelectedIndex;
            Object rating = Rating_ComboBox.SelectedItem;

            if (string.IsNullOrEmpty(name))
                ErrorMessage_TextBlock.Text = "Er is geen naam opgegeven.";
            else if (string.IsNullOrEmpty(street))
                ErrorMessage_TextBlock.Text = "Er is geen straat opgegeven.";
            else if (string.IsNullOrEmpty(houseNumber))
                ErrorMessage_TextBlock.Text = "Er is geen huisnummer opgegeven.";
            else if (string.IsNullOrEmpty(zipCode))
                ErrorMessage_TextBlock.Text = "Er is geen postcode opgegeven.";
            else if (string.IsNullOrEmpty(city))
                ErrorMessage_TextBlock.Text = "Er is geen plaats opgegeven.";
            else if (string.IsNullOrEmpty(country))
                ErrorMessage_TextBlock.Text = "Er is geen land opgegeven.";
            else if (string.IsNullOrEmpty(OpeningTimeMa_TextBox.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen dag opgegeven.";
            else if (string.IsNullOrEmpty(openingTimeMa) &&
                     string.IsNullOrEmpty(openingTimeDi) &&
                     string.IsNullOrEmpty(openingTimeWo) &&
                     string.IsNullOrEmpty(openingTimeDo) &&
                     string.IsNullOrEmpty(openingTimeVr) &&
                     string.IsNullOrEmpty(openingTimeZa) &&
                     string.IsNullOrEmpty(openingTimeZo))
                ErrorMessage_TextBlock.Text = "Er zijn geen openingstijden opgegeven.";
            else if (string.IsNullOrEmpty(closingTimeMa) &&
                     string.IsNullOrEmpty(closingTimeDi) &&
                     string.IsNullOrEmpty(closingTimeWo) &&
                     string.IsNullOrEmpty(closingTimeDo) &&
                     string.IsNullOrEmpty(closingTimeVr) &&
                     string.IsNullOrEmpty(closingTimeZa) &&
                     string.IsNullOrEmpty(closingTimeZo))
                ErrorMessage_TextBlock.Text = "Er zijn geen sluitingstijden opgegeven.";
            else if (string.IsNullOrEmpty(rating.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen rating opgegeven.";
            else if (string.IsNullOrEmpty(longitude.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen longitude opgegeven.";
            else if (string.IsNullOrEmpty(latitude.ToString()))
                ErrorMessage_TextBlock.Text = "Er is geen latitude opgegeven.";
            else if (string.IsNullOrEmpty(happyhourFromMa) &&
                     string.IsNullOrEmpty(happyhourFromDi) &&
                     string.IsNullOrEmpty(happyhourFromWo) &&
                     string.IsNullOrEmpty(happyhourFromDo) &&
                     string.IsNullOrEmpty(happyhourFromVr) &&
                     string.IsNullOrEmpty(happyhourFromZa) &&
                     string.IsNullOrEmpty(happyhourFromZo))
                ErrorMessage_TextBlock.Text = "Er is geen tijd opgegeven.";
            else if (string.IsNullOrEmpty(happyhourToMa) &&
                     string.IsNullOrEmpty(happyhourToDi) &&
                     string.IsNullOrEmpty(happyhourToWo) &&
                     string.IsNullOrEmpty(happyhourToDo) &&
                     string.IsNullOrEmpty(happyhourToVr) &&
                     string.IsNullOrEmpty(happyhourToZa) &&
                     string.IsNullOrEmpty(happyhourToZo))
                ErrorMessage_TextBlock.Text = "Er is geen tijd opgegeven.";
            else
            {
                ErrorMessage_TextBlock.Text = "";

                List<string> happyhourFrom = new List<string>();
                happyhourFrom.Add(happyhourFromMa);
                happyhourFrom.Add(happyhourFromDi);
                happyhourFrom.Add(happyhourFromWo);
                happyhourFrom.Add(happyhourFromDo);
                happyhourFrom.Add(happyhourFromVr);
                happyhourFrom.Add(happyhourFromZa);
                happyhourFrom.Add(happyhourFromZo);

                List<string> happyhourTo = new List<string>();
                happyhourTo.Add(happyhourToMa);
                happyhourTo.Add(happyhourToDi);
                happyhourTo.Add(happyhourToWo);
                happyhourTo.Add(happyhourToDo);
                happyhourTo.Add(happyhourToVr);
                happyhourTo.Add(happyhourToZa);
                happyhourTo.Add(happyhourToZo);

                List<string> openTimes = new List<string>();
                openTimes.Add(openingTimeMa);
                openTimes.Add(openingTimeDi);
                openTimes.Add(openingTimeWo);
                openTimes.Add(openingTimeDo);
                openTimes.Add(openingTimeVr);
                openTimes.Add(openingTimeZa);
                openTimes.Add(openingTimeZo);

                List<string> closeTimes = new List<string>();
                closeTimes.Add(closingTimeMa);
                closeTimes.Add(closingTimeDi);
                closeTimes.Add(closingTimeWo);
                closeTimes.Add(closingTimeDo);
                closeTimes.Add(closingTimeVr);
                closeTimes.Add(closingTimeZa);
                closeTimes.Add(closingTimeZo);

                LocationData pub = new LocationData(name, street, houseNumber, zipCode, city, country, selectedRatingIndex, Convert.ToDouble(longitude), Convert.ToDouble(latitude), openTimes, closeTimes, happyhourFrom, happyhourTo);
                fillTimes(pub, openTimes, closeTimes);
                fillHappyTimes(pub, happyhourFrom, happyhourTo);
                pub.setPubdayTimes();
                LocationHandler.Instance.addPub(pub);

                Frame.Navigate(typeof(View.PubMenu));
            }
        }