Пример #1
0
        private void btnCreateEvent_Click(object sender, RoutedEventArgs e)
        {
            if (
                tbEventName.Text.Length != 0 &&
                tbEventLocation.Text.Length != 0 &&
                tbEventDescription.Text.Length != 0 &&
                ValidateHelper.checkStringForNumbers(tbEventMinPrice.Text) &&
                ValidateHelper.checkStringForNumbers(tbEventNumOfParticipants.Text) &&
                ValidateHelper.checkStringForNumbers(tbEventMaxPrice.Text)
                )
            {
                DateTime datetime = dtpEventDatetime.Value.Value;
                bool     isPublic = rbEventPublic.IsChecked.Value;

                int numOfParticipants;
                Int32.TryParse(tbEventNumOfParticipants.Text, out numOfParticipants);

                int minPrice;
                Int32.TryParse(tbEventMinPrice.Text, out minPrice);

                int maxPrice;
                Int32.TryParse(tbEventMaxPrice.Text, out maxPrice);

                try
                {
                    var evnt = service.CreateEvent(
                        tbEventName.Text,
                        tbEventDescription.Text,
                        numOfParticipants,
                        minPrice,
                        maxPrice,
                        tbEventLocation.Text,
                        datetime,
                        isPublic,
                        user
                        );
                    MessageBox.Show("Event oprettet");

                    var eventWindow = new EventWindow(evnt, user);
                    eventWindow.Show();
                    this.NavigationService.Navigate(new MainPage());
                }
                catch (FaultException err)
                {
                    MessageBox.Show(err.Message);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Oplysninger mangler");
            }
        }
Пример #2
0
        private void btnSelectedEventInfo_Click(object sender, RoutedEventArgs e)
        {
            Event e2 = (Event)lwSignedUpEvents.SelectedItem;

            if (e2 == null)
            {
                MessageBox.Show("Du skal trykke på en begivenhed for at kunne se info om den");
            }
            else
            {
                var eventWindow = new EventWindow(e2, usr);
                eventWindow.Show();
            }
        }