예제 #1
0
        private void newBand(object sender, RoutedEventArgs e)
        {
            Band band = new Band();

            band.name         = newBandName.Text;
            band.city         = newBandCity.Text.Any() ? newBandCity.Text : "Nevyplneno";
            band.description  = new TextRange(bandDescription.Document.ContentStart, bandDescription.Document.ContentEnd).Text;
            band.facebook     = facebook.Text.Contains("facebook".ToUpper()) ? facebook.Text : "Kapela nemá Facebook";
            band.banzone      = bandzone.Text.Contains("banzone".ToUpper()) ? bandzone.Text : "Kapela nemá Bandzone";
            band.website      = website.Text.Contains("www.") ? website.Text : "Kapela nemá webovou stránku";
            band.style        = newBandStyle.Text.Any() ? newBandStyle.Text : "Nedefinován styl!";
            band.personalNote = new TextRange(personalNote.Document.ContentStart, personalNote.Document.ContentEnd).Text;

            if (band.checkIfBandExists(band))
            {
                MessageBox.Show("Kapela s tímto názvem již existuje!");
            }
            else
            {
                band.saveBandToDb(band);
                if (contactName.Text.Any() && contactName.Text != "Jmeno")
                {
                    BandContact contact = new BandContact();
                    contact.fName    = contactName.Text;
                    contact.lName    = ContactSurname.Text;
                    contact.function = contactFunction.Text;
                    contact.phone    = contactPhone.Text;
                    contact.email    = contactEmail.Text;
                    contact.bandId   = band._id;

                    contact.saveContactToDb(contact);
                }
                this.NavigationService.Navigate(new BandsAdmin());
            }
        }
예제 #2
0
        private void newContact(object sender, RoutedEventArgs e)
        {
            BandContact newContact = new BandContact();

            newContact.fName    = contactName.Text;
            newContact.lName    = ContactSurname.Text;
            newContact.function = contactFunction.Text;
            newContact.phone    = contactPhone.Text;
            newContact.email    = contactEmail.Text;
            newContact.bandId   = contactBandId;

            newContact.saveContactToDb(newContact);
            this.NavigationService.Navigate(new BandDetail(band));
        }