public void DeleteLineUpArtiest() { if (SelectedLineUp != null) { try { string sql = "DELETE FROM LineUp WHERE ID=@id"; DbParameter parID = Database.AddParameter("@id", SelectedLineUp.ID); Database.ModifyData(sql, parID); string sql2 = "DELETE FROM Bands WHERE ID=@id2"; DbParameter parID2 = Database.AddParameter("@id2", SelectedLineUp.Band.ID); Database.ModifyData(sql2, parID2); string sql3 = "DELETE FROM Band_Genre WHERE ID=@bandid"; DbParameter parBandID = Database.AddParameter("@ibandid", SelectedLineUp.Band.ID); Database.ModifyData(sql3, parBandID); BandList.Remove(SelectedLineUp.Band); LineUpList.Remove(SelectedLineUp); NewLineUp(); MessageBox.Show("Line up en artiest werden succesvol verwijderd"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public EqualizerViewModel(Mediator mediator) { _mediator = mediator; _equalizers = DependencyService.Get <IEqualizerSevice>(); BandSelected = "Normal"; Equalizers = new BandList(); LoadCommands(); }
/// <summary> /// default constructor /// </summary> public BandViewModel() { Tid = new DateTime(); Bandliste = new BandList(); selectedBand = new Band(); AddBandCommand = new AddBandCommand(AddNewBand); DeleteBandCommand = new RelayCommand(DeleteBand); SaveBandCommand = new RelayCommand(GemDataTilDiskAsync); //bruger en anonym metode i min relaycommand DeleteAllBandCommand = new RelayCommand(() => this.Bandliste.Clear()); HentDataCommand = new RelayCommand(HentdataFraDiskAsync); localfolder = ApplicationData.Current.LocalFolder; }
/// <summary> /// default constructor /// </summary> public BandViewModel() { Tid = new DateTime(); Bandliste = new BandList(); selectedBand = new Band(); AddBandCommand = new RelayCommand(AddNewBand, AddBandCanExecute); DeleteBandCommand = new RelayCommand(DeleteBand, DeleteBanCanExecute); SaveBandCommand = new RelayCommand(GemDataTilDiskAsync); //bruger en anonym metode i min relaycommand DeleteAllBandCommand DeleteAllBandCommand = new RelayCommand(() => this.Bandliste.Clear(), () => this.Bandliste.Count > 0); HentDataCommand = new RelayCommand(HentdataFraDiskAsync); localfolder = ApplicationData.Current.LocalFolder; this.JsonTexts = new ObservableCollection <string>(); VisJson(); }
public void SaveBand() { try { string sql = "INSERT INTO Bands(Name,Picture,Description,Facebook,Twitter) VALUES (@Name,@Picture,@Description,@Facebook,@Twitter);"; DbParameter parName = Database.AddParameter("@Name", NewBand.Name); DbParameter parPicture = Database.AddParameter("@Picture", NewBand.Picture); DbParameter parDescription = Database.AddParameter("@Description", NewBand.Description); DbParameter parFacebook = Database.AddParameter("@Facebook", NewBand.Facebook); DbParameter parTwitter = Database.AddParameter("@Twitter", NewBand.Twitter); Database.ModifyData(sql, parName, parPicture, parDescription, parFacebook, parTwitter); BandList.Add(NewBand); BandList = Band.GetBands(); MessageBox.Show("Artiest werd succesvol toegevoegd"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Load() { if (loadBands) { bands = loadJson <BandList>(jsonPath + "/bands.json"); bands.PrepareData(); Debug.Log("MJA Bands loaded: " + bands.items.Length); } if (loadPersons) { persons = loadJson <PersonList>(jsonPath + "/persons.json"); persons.PrepareData(); Debug.Log("MJA Persons loaded: " + persons.items.Length); } if (loadConcerts) { concerts = loadJson <ConcertList>(jsonPath + "/concerts.json"); concerts.PrepareData(); int ce = 0; int cs = 0; for (int n = concerts.items.Length - 1; n >= 0; n--) { ce += concerts.items[n].eventIds.Length; for (int m = concerts.items[n].events.Length - 1; m >= 0; m--) { if (concerts.items[n].events[m].type == "song") { cs++; } } } Debug.Log("MJA Concerts loaded: " + concerts.items.Length + " (with " + ce + " events, " + cs + " songs)"); } if (loadConcertGroups) { concertGroups = loadJson <ConcertGroupList>(jsonPath + "/concertgroups.json"); concertGroups.PrepareData(); Debug.Log("MJA ConcertGroups loaded: " + concertGroups.items.Length); } if (loadImages) { images = loadJson <ImageList>(jsonPath + "/images.json"); images.PrepareData(); Debug.Log("MJA Images loaded: " + images.items.Length); } if (loadImageTags) { imageTags = loadJson <ImageTagList>(jsonPath + "/imagetags.json"); imageTags.PrepareData(); Debug.Log("MJA ImageTags loaded: " + imageTags.items.Length); } if (loadLocations) { locations = loadJson <LocationList>(jsonPath + "/locations.json"); locations.PrepareData(); Debug.Log("MJA locations loaded: " + locations.items.Length); } // generate missing relations if (loadLocations && loadImages) { for (int n = 0; n < images.images.Length; n++) { for (int m = 0; m < images.images[n].locations.Length; m++) { if (images.images[n].locations != null && locations[images.images[n].locations[m]] != null) { if (locations[images.images[n].locations[m]].images == null) { locations[images.images[n].locations[m]].images = new int[1]; locations[images.images[n].locations[m]].images[0] = images.images[n].id; } else { List <int> list = locations[images.images[n].locations[m]].images.ToList(); list.Add(images.images[n].id); locations[images.images[n].locations[m]].images = list.ToArray(); } } } } } if (loadLocations && loadConcerts) { for (int n = 0; n < concerts.concerts.Length; n++) { if (concerts.concerts[n].location > 0 && locations[concerts.concerts[n].location] != null) { if (locations[concerts.concerts[n].location].concerts == null) { locations[concerts.concerts[n].location].concerts = new int[1]; locations[concerts.concerts[n].location].concerts[0] = concerts.concerts[n].id; } else { List <int> list = locations[concerts.concerts[n].location].concerts.ToList(); list.Add(concerts.concerts[n].id); locations[concerts.concerts[n].location].concerts = list.ToArray(); } } } } dataLoaded = true; }