示例#1
0
        public Order(Guid id, Customer customer, Employee employee, DateTime RequiredDate, string shipName, string shipAddress,
                     string shipCity, string shipPostalCode, string shipCountry, Guid shipVia)
        {
            if (_orderDetails == null)
            {
                _orderDetails = new List <OrderDetail>();
            }
            TypeDataCheck.IsNull(customer);
            TypeDataCheck.checkId(customer.Id);

            TypeDataCheck.IsNull(employee);
            TypeDataCheck.checkId(employee.Id);

            TypeDataCheck.checkId(shipVia);

            TypeDataCheck.IsNull(shipName);
            TypeDataCheck.IsNull(shipAddress);
            TypeDataCheck.IsNull(shipCity);
            TypeDataCheck.IsNull(shipCountry);

            SetId(id);
            CustomerID     = customer.Id;
            EmployeeID     = employee.Id;
            ShipName       = shipName;
            ShipAddress    = shipAddress;
            ShipCity       = shipCity;
            ShipPostalCode = shipPostalCode;
            ShipCountry    = shipCountry;
            ShipVia        = shipVia;
            SetOrderDate();
            setShippedDate();
            setRequiredDate(RequiredDate);
        }
示例#2
0
        public void AddOrderDetail(OrderDetail orderdetail)
        {
            TypeDataCheck.IsNull(orderdetail);
            TypeDataCheck.checkId(orderdetail.OrderID);
            TypeDataCheck.checkId(orderdetail.ProductId);

            var exitsOrderDetail = _orderDetails.Where(x => x.ProductId == orderdetail.ProductId && x.OrderID == orderdetail.OrderID).SingleOrDefault();

            if (exitsOrderDetail != null)
            {
                throw new OrderDetailAlreadyExistException();
            }

            _orderDetails.Add(orderdetail);
        }
示例#3
0
        public OrderDetail(Guid id, Product product, Order order, double unitPrice,
                           short quantity, double disCount = 0)
        {
            TypeDataCheck.checkId(id);
            Id = id;

            TypeDataCheck.IsNull(product);
            SetProductId(product.Id);

            TypeDataCheck.IsNull(order);
            SetOrderId(order.Id);

            SetUnitPrice(unitPrice);
            SetQuantity(quantity);
            SetDisCount(disCount);
        }
示例#4
0
        public Product(Guid Id, Category category, Supplier supplier, string productName,
                       string quantityPerUnit, decimal unitPrice, double unitsInStock)
        {
            // Model Control
            TypeDataCheck.IsNull(category);
            TypeDataCheck.IsNull(supplier);

            TypeDataCheck.IsNullOrEmpty(productName);
            TypeDataCheck.IsNullOrEmpty(quantityPerUnit);

            SetId(Id);
            ProductName     = productName;
            QuantityPerUnit = quantityPerUnit;
            SetCategoryId(category.Id);
            SetSupplierId(supplier.Id);
            SetUnitPrice(unitPrice);
            SetUnitsInStock(unitsInStock);
        }
        public Customer(Guid id, string companyName, string contactName,
                        string contactTitle, string email, string address, string city, string postalCode, string country, string phone)
        {
            TypeDataCheck.IsNull(companyName);
            TypeDataCheck.IsNull(contactName);
            TypeDataCheck.IsNull(contactTitle);
            TypeDataCheck.IsNull(address);
            TypeDataCheck.IsNull(city);
            TypeDataCheck.IsNull(postalCode);
            TypeDataCheck.IsNull(country);
            TypeDataCheck.IsNull(phone);

            this.SetId(id);
            this.SetEmail(email);
            CompanyName  = companyName;
            ContactName  = contactName;
            ContactTitle = contactTitle;
            Email        = email;
            Address      = address;
            City         = city;
            PostalCode   = postalCode;
            Country      = country;
            Phone        = phone;
        }
 public void AddOrder(Order order)
 {
     TypeDataCheck.IsNull(order);
     TypeDataCheck.checkId(order.Id);
     _orders.Add(order);
 }
示例#7
0
 public void AddProduct(Product product)
 {
     TypeDataCheck.IsNull(product);
     _products.Add(product);
 }