Пример #1
0
 public Order(int id, Book book, string name, string address, string email, int quantity, Order.OrderState state)
 {
     this.id = id;
     this.book = book;
     this.name = name;
     this.address = address;
     this.email = email;
     this.quantity = quantity;
     this.state = state;
 }
Пример #2
0
        void IStoreService.sell(string name, string address, string email, int quantity, string title)
        {
            Book b = books[title];
            if (b != null)
            {

                if (books[title].quantity >= quantity)
                {
                    books[title].quantity -= quantity;
                    storeGUI.setStock(title, books[title].quantity);
                    printer.print(name, title, quantity, quantity*books[title].price);
                }
                else
                {

                    Order newOrder = new Order(++idOrder, b, name, address, email, quantity, Order.OrderState.FutureDispatch);
                    warehouse.addOrder(title, quantity*10, newOrder.id);
                    orders.Add(newOrder.id, newOrder);
                    storeGUI.addOrder(newOrder);
                }

            }
        }
Пример #3
0
 void IStoreService.setOrderState(int id, Order.OrderState newState)
 {
     orders[id].state = newState;
     storeGUI.setOrder(orders[id]);
 }
Пример #4
0
 void IStoreService.order(string name, string address, string email, int quantity, string title)
 {
     Book b = books[title];
     if (b != null)
     {
         Order newOrder = new Order(++idOrder, b, name, address, email, quantity, Order.OrderState.FutureDispatch);
         if (books[title].quantity >= quantity)
         {
             books[title].quantity -= quantity;
             storeGUI.setStock(title, books[title].quantity);
             MailMessage mail = new MailMessage("*****@*****.**", email);
             mail.Subject = "Order";
             DateTime data = DateTime.Now;
             mail.Body = "Details:\n Name: " + name + "\nTitle: " + title + "\nQuantity: " + quantity.ToString() + "\nTotal Price:" + (quantity * b.price).ToString() + "\nDespached: Dispatched at" + data.AddDays(1).ToShortDateString();
             clientEmail.Send(mail);
             newOrder.state = Order.OrderState.Dispatched;
         }
         else
         {
             warehouse.addOrder(title, quantity*10, newOrder.id);
         }
         orders.Add(newOrder.id, newOrder);
         storeGUI.addOrder(newOrder);
     }
 }