private void BtnSaveGenre_clidk(object sender, RoutedEventArgs e) { int bookID = 0; GenreLink gnl = new GenreLink(); foreach (CheckBox item in stkpnl.Children) { if (item.IsChecked == true) { gnl.BuchID = bookID; gnl.SachgruppeID = (Int32)item.Tag; MessageBox.Show(item.Tag.ToString() + " / " + item.Content.ToString()); } } }
private void BtnSave_click(object sender, RoutedEventArgs e) { //Änderung bei Personen speichern string cAutorSort = null; foreach (var item in cNameRolle) { var editAR = (from ar in Admin.conn.AutorBuchLink where ar.id == item.currNameRolleID select ar).FirstOrDefault(); editAR.BuchID = bookID; editAR.PersonID = item.currID; editAR.RolleID = item.currRolleID; cAutorSort += item.name + "; "; } //Änderung in GenereLink foreach (CheckBox item in ugridGenre.Children) { GenreLink gnl = new GenreLink(); try { if (item.IsChecked == true) { gnl.BuchID = bookID; gnl.SachgruppeID = (Int32)item.Tag; Admin.conn.GenreLink.InsertOnSubmit(gnl); Admin.conn.SubmitChanges(); //MessageBox.Show(item.Tag.ToString() + " / " + item.Content.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + "Genre/Sachgruppe evt. nicht übernommen!", "Fehler beim Speichern!"); } } //AutorSort eintragen cBook.AutorSort = cAutorSort.Substring(0, cAutorSort.Length - 2); //Und alle Änderungen speichern Admin.conn.SubmitChanges(); DialogResult = true; }
public void SaveNewBook() { //Int32 id = 0; newBook.Titel = txtTitel.Text.Trim(); newBook.TitelIndex = txtTitelIndex.Text.Trim(); newBook.AutorSort = txtAutorSort.Text.Trim(); newBook.Signatur = txtSignatur.Text.Trim(); newBook.Veroeffentlicht = txtJahr.Text.Trim(); newBook.CopyrightDatum = txtJahr.Text.Trim(); newBook.Untertitel = txtSubTitel.Text.Trim(); newBook.TitleSort = txtTitelSort.Text.Trim(); newBook.ISBN = txtISBN.Text.Trim(); newBook.DNB = txtDNB.Text.Trim(); newBook.DDC = txtDCC.Text.Trim(); //newBook.LCCN = //newBook.LCCallNum = [nvarchar = (50) NULL, //newBook.LandD = txtLanguage.Text.Trim(); //newBook.SprachenID = [int = NULL, //newBook.DruckereiID = [int = NULL, //newBook.BindungID = [int = NULL, //newBook.AuflageID = [int = NULL, newBook.Auiflage = txtAuflage.Text.Trim(); //newBook.DruckID = [int = NULL, //newBook.SerienID = [int = NULL, newBook.Seiten = txtSeiten.Text.Trim(); //newBook.Abschnitte = [smallint = NULL, newBook.OriginalTitel = txtOrigTitel.Text.Trim(); //newBook.OriginalUntertitel = txt //newBook.OriginaVerlagID = [int = NULL, //newBook.OriginalLandID = [int = NULL, //newBook.OriginalSpracheID = [int = NULL, //newBook.OriginalCopyright = [nvarchar = (8) NULL, //newBook.Preisangabe = [nvarchar = (255) NULL, //newBook.Value = [nvarchar = (255) NULL, newBook.Preis = txtPreis.Text.Trim(); //newBook.ZustandID = [int = NULL, //newBook.GutachterID = [int = NULL, //newBook.Versicherung = [int = NULL, //newBook.Registeriert = [nvarchar = (8) NULL, //newBook.StatusID = [int = NULL, //newBook.Erworben = [nvarchar = (8) NULL, //newBook.ErworbenVonID = [int = NULL, //newBook.PersonalRatingID = [int = NULL, //newBook.BesitzerID = [int = NULL, //newBook.StandortID = [int = NULL, //newBook.EntleiherID = [int = NULL, //newBook.DatumAusleihe = [nvarchar = (8) NULL, //newBook.RueckgabeDatum = [nvarchar = (8) NULL, //newBook // newBook.Anmerkungen_PlainText.Trim() = txtAddInfo.Text.Trim(); // newBook.Synopsis_PlainText.Trim() = txtIndex.Text.Trim(); //newBook.Reviews_PlainText.Trim() = [nvarchar = (max)NULL, //newBook.BarCode = [nvarchar = (50) NULL, //newBook.OriginalSerieID = [int = NULL, //newBook.zuletztGelesen = [nvarchar = (8) NULL, //newBook.AnzahlGelesen = [smallint = NULL, //newBook.ZustandSchutzumschlagID = [int = NULL, newBook.Dim_Width = txtDim.Text.Trim(); //newBook.Dim_Height = [nvarchar = (255) NULL, //newBook.Dim_Depth = [nvarchar = (255) NULL, //newBook.Verkaufspreis = [nvarchar = (255) NULL, //newBook.WaehrungID = [int = NULL, //newBook.VerlagsOrtID = [int = NULL, //newBook.ASIN = [nvarchar = (20) NULL, //newBook.LetzteAenderung = [smalldatetime = NULL, //newBook.FreigabeNr = [nvarchar = (255) NULL, //newBook.OriginalFreigabeNr = [nvarchar = (255) NULL, //newBook.KategorieID = [int = NULL, //newBook.UnterkategorieID = [int = NULL, //newBook.SachgruppeID = [int = NULL, newBook.Stichworte = txtStichworte.Text.Trim(); //speichern! Admin.conn.Buch.InsertOnSubmit(newBook); Admin.conn.SubmitChanges(); BuchID = newBook.ID; // AutorBuchLink ergänzen // gegeben ist die liste nr_list foreach (var autor in nr_list) { AutorBuchLink abl = new AutorBuchLink(); try { abl.BuchID = BuchID; abl.PersonID = autor.currID; abl.RolleID = autor.currRolleID; Admin.conn.AutorBuchLink.InsertOnSubmit(abl); Admin.conn.SubmitChanges(); } catch (Exception ex) { MessageBox.Show("Personen evt. nicht übernommen!", "Fehler beim Speichern!"); } } //GenreLing ergänzen foreach (CheckBox item in ugridGenre.Children) { GenreLink gnl = new GenreLink(); try { if (item.IsChecked == true) { gnl.BuchID = BuchID; gnl.SachgruppeID = (Int32)item.Tag; Admin.conn.GenreLink.InsertOnSubmit(gnl); Admin.conn.SubmitChanges(); //MessageBox.Show(item.Tag.ToString() + " / " + item.Content.ToString()); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n" + "Genre/Sachgruppe evt. nicht übernommen!", "Fehler beim Speichern!"); } } //speichern! // gegeben ist die liste nr_list if (cbSaveCover.IsChecked == true) { SaveCover(BuchID); } }