/// <summary> /// Fügt einen Eintrag zur Buchausleih-Liste hinzu /// </summary> public void AddToAusleihList() { try { DataRow relation; string[] exemlarDetails = new string[2]; exemlarDetails[0] = Copy.CopyId.ToString(); exemlarDetails[1] = ReturnDate.ToShortDateString(); if (BorrowTable.Columns.Count != 2) { BorrowTable.Columns.Add(); BorrowTable.Columns.Add(); } relation = BorrowTable.NewRow(); relation.ItemArray = exemlarDetails; BorrowTable.Rows.Add(relation); } catch { MessageBox.Show("Beim Hinzufügen dieses Buches zur Buchausleihliste ist ein Fehler aufgetreten.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Übernimmt eine vorgefertigte Liste in die Buchausleihliste /// </summary> public void FillAusleihListe(string[] inputList) { try { ClearBorrowTable(); DataRow relation; string[] exemlarDetails = new string[2]; List <string> newList = new List <string>(); foreach (string s in inputList) { Copy ex = new Copy(int.Parse(s)); if (ex.IsAvailable()) { newList.Add(s); } } inputList = newList.ToArray(); if (BorrowTable.Columns.Count != 2) { BorrowTable.Columns.Add(); BorrowTable.Columns.Add(); } for (int i = 0; i <= inputList.Length - 1; i++) { exemlarDetails[0] = inputList[i]; exemlarDetails[1] = DateTime.Now.Date.ToShortDateString(); relation = BorrowTable.NewRow(); relation.ItemArray = exemlarDetails; BorrowTable.Rows.Add(relation); } } catch { MessageBox.Show("Beim Laden der Liste in die Buchausleihliste ist ein Fehler aufgetreten.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }