Beispiel #1
0
 /// <summary>
 /// instancie une commande afin de la serialiser par la suite pour les services de traitement.
 /// </summary>
 /// <param name="shipping"></param>
 /// <param name="facturation"></param>
 /// <param name="creditcard"></param>
 /// <param name="books"></param>
 public Order(ContactDetails shipping, ContactDetails invoicing, string creditcard, Book[] books)
 {
     this.shipping = shipping;
     this.invoicing = invoicing;
     this.creditcard = creditcard;
     this.books = books;
     this.ordernumber = Guid.NewGuid().ToString();
     database = new DataBaseConnect();
 }
 public string RegisterOrder(string username, Book[] books, string creditcard, ContactDetails shipping, ContactDetails invoicing)
 {
     string guid = null;
     if (Order.VerifyCreditCard(creditcard) == true)
     {
         int i = 0;
         bool verifybook = true;
         Library lib = new Library();
         lib.UpdateDB();
         while (i < books.Length && verifybook == true)
         {
             verifybook = lib.Contains(books[i++]);
         }
         if (verifybook == true)
         {
             Order toregister = new Order(shipping, invoicing, creditcard, books);
             toregister.OrderSerializer();
             toregister.OrderStorage(username);
             guid = toregister.Ordernumber;
         }
     }
     return guid;
 }