public XmlNode GetAuthorsAsXml() { AuthorSet aus = new AuthorSet(); sqlDataAdapter1.Fill(aus); return(new XmlDataDocument(aus)); }
public AuthorSet GetAuthorsAsTypedDataSet() { AuthorSet aus = new AuthorSet(); sqlDataAdapter1.Fill(aus); return(aus); }
public override DataSet Clone() { AuthorSet cln = ((AuthorSet)(base.Clone())); cln.InitVars(); return(cln); }
private void RemoveAuthorBtn_Click(object sender, RoutedEventArgs e) { AuthorSet author = (AuthorSet)authorListView.SelectedItem; RepositoryWorkUnit.Instance.Authors.Delete(author); RepositoryWorkUnit.Instance.Complete(); authorListView.ItemsSource = RepositoryWorkUnit.Instance.Authors.Get(); }
private void EditAuthorBtn_Click(object sender, RoutedEventArgs e) { AuthorSet author = (AuthorSet)authorListView.SelectedItem; CreateWindow creationWindow = new CreateWindow(1, author); creationWindow.ShowDialog(); authorListView.ItemsSource = RepositoryWorkUnit.Instance.Authors.Get(); CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(authorListView.ItemsSource); view.Filter = Filter; }
public CreateAuthorPage(Window context, AuthorSet author = null) { InitializeComponent(); _context = context; if (author != null) { AuthorNameBox.Text = author.Name; AuthorBirthDate.Text = author.Date; isEdit = true; _author = author; authorTopLabel.Content = "Edytuj autora"; AddAuthorButton.Content = "Edytuj"; } }
private void AddAuthorButton_Click(object sender, RoutedEventArgs e) { string authorname = AuthorNameBox.Text.ToString(); string authorBirth = AuthorBirthDate.Text.ToString(); var message = ValidationClass.validateStringTextbox(authorname); if (!message.Item1) { MessageBox.Show(message.Item2); return; } message = ValidationClass.validateDateTextbox(authorBirth); if (!message.Item1) { MessageBox.Show(message.Item2); return; } if (isEdit) { var author = RepositoryWorkUnit.Instance.Authors.Get().FirstOrDefault(x => x.Id == _author.Id); author.Name = authorname; author.Date = authorBirth; RepositoryWorkUnit.Instance.Authors.Update(author, author.Id); } else { AuthorSet author = new AuthorSet(); author.Name = authorname; author.Date = authorBirth; RepositoryWorkUnit.Instance.Authors.Insert(author); } _context.Close(); }
private void AddAlbumButton_Click(object sender, RoutedEventArgs e) { string albumname = albumNameTextBox.Text.ToString(); string albumdesc = albumDescriptionBox.Text.ToString(); string albumrealase = albumRealaseDateBox.Text.ToString(); var message = ValidationClass.validateStringTextbox(albumname); if (!message.Item1) { System.Windows.MessageBox.Show(message.Item2); return; } message = ValidationClass.validateStringTextbox(albumdesc); if (!message.Item1) { System.Windows.MessageBox.Show(message.Item2); return; } message = ValidationClass.validateDateTextbox(albumrealase); if (!message.Item1) { System.Windows.MessageBox.Show(message.Item2); return; } if (albumAuthorsComboBox.SelectedItems.Count < 1 || albumGenresComboBox.SelectedItems.Count < 1) { System.Windows.MessageBox.Show("Album musi posiadać autorów lub gatunki !!!"); return; } if (isEdit) { var album = RepositoryWorkUnit.Instance.Albums.Get().FirstOrDefault(x => x.Id == _album.Id); album.Name = albumname; album.Description = albumdesc; album.ReleaseDate = albumrealase; album.AuthorSets.Clear(); album.GenreSets.Clear(); foreach (var author in albumAuthorsComboBox.SelectedItems) { AuthorSet _author = (AuthorSet)author; album.AuthorSets.Add(_author); } foreach (var genre in albumGenresComboBox.SelectedItems) { GenreSet _genre = (GenreSet)genre; album.GenreSets.Add(_genre); } RepositoryWorkUnit.Instance.Albums.Update(album, album.Id); } else { AlbumSet album = new AlbumSet(); album.Name = albumname; album.Description = albumdesc; album.ReleaseDate = albumrealase; //narazie nie mamy url i chyba nie będziemy mieli album.ImgUrl = " "; foreach (var author in albumAuthorsComboBox.SelectedItems) { AuthorSet _author = (AuthorSet)author; album.AuthorSets.Add(_author); } foreach (var genre in albumGenresComboBox.SelectedItems) { GenreSet _genre = (GenreSet)genre; album.GenreSets.Add(_genre); } RepositoryWorkUnit.Instance.Albums.Insert(album); } _context.Close(); }