public Order(Client c, Book[] bs, DateTime dt) : base() { Date = dt; Client = c; Books = bs; }
static void displayBooks(Book[] books) { foreach (Book b in books) { if (null == b) continue; Console.WriteLine(b.bookToString()); } }
static void testBook() { Book[] books=new Book[2]; Book book; book = new Book("titre 1", "auteur 1", "1111111111111", 1); books[0] = book; books[1] = new Book("titre 2", "auteur 2", "2222222222222", 2); displayBooks(books); Order order = new Order( new Client("Launay", "Kevin", "7 rue du clos d'hel", "44810", "LA CHEVALLERAIS") ,books ); Console.WriteLine(order.Client.clientToString()); displayBooks(order.Books); }
/// <summary> /// /// </summary> static void testBook() { Book book = null; try { Console.WriteLine((book = new Editor.Book("my book", "my author", "1-234-5678-9012-3", 20)).bookToString()); } catch (Exception e) { Debug.WriteLine(e.Message, "EditorApp"); } book = null; try { Console.WriteLine((book = new Editor.Book("my book", "my author", "A-234-5678-9012-3", 200)).bookToString()); } catch (Exception e) { if (null == book) Debug.WriteLine("object book is null", "EditorApp"); Debug.WriteLine(e.Message, "EditorApp"); } try { Console.WriteLine((new Editor.Book("my book", "my author", "1-234-567", 60)).bookToString()); } catch (Exception e) { Debug.WriteLine(e.Message,"EditorApp"); } try { Console.WriteLine((new Editor.Book("my book", "my author", "0000000000000123456", 40)).bookToString()); } catch (Exception e) { Debug.WriteLine(e.Message,"EditorApp"); } }
public Order(Client c, Book[] bs) : this(c,bs,DateTime.Now) { }
public void addBook(Book book) { for(int i =0;i<this.Books.Length;++i) { if (null != this.Books[i]) continue; this.Books[i] = book; break; } }