protected override void InitializeComplexProperties(OrderItem model)
        {
            if (model.OrderItemShipToAddress == null)
            {
                throw new ArgumentException("OrderItemShipToAddress cannot be null");
            }

            OrderItemShipToAddress = new AddressWrapper(model.OrderItemShipToAddress);
            RegisterComplex(OrderItemShipToAddress);

            if (model.OrderItemBillToAddress == null)
            {
                throw new ArgumentException("OrderItemBillToAddress cannot be null");
            }

            OrderItemBillToAddress = new AddressWrapper(model.OrderItemBillToAddress);
            RegisterComplex(OrderItemBillToAddress);

            if (model.SalesRep == null)
            {
                throw new ArgumentException("SalesRep cannot be null");
            }

            SalesRep = new RepresentativeWrapper(model.SalesRep);
            RegisterComplex(SalesRep);

            if (model.AccountRep == null)
            {
                throw new ArgumentException("AccountRep cannot be null");
            }

            AccountRep = new RepresentativeWrapper(model.AccountRep);
            RegisterComplex(AccountRep);

            if (model.OrderItemStatusData == null)
            {
                throw new ArgumentException("OrderItemStatusData cannot be null");
            }

            OrderItemStatusData = new OrderItemStatusWrapper(model.OrderItemStatusData);
            RegisterComplex(OrderItemStatusData);

            if (model.OrderItemProduct == null)
            {
                throw new ArgumentException("OrderItemProduct cannot be null");
            }

            OrderItemProduct = new ProductWrapper(model.OrderItemProduct);
            RegisterComplex(OrderItemProduct);
        }
Esempio n. 2
0
        protected override void InitializeComplexProperties(Order model)
        {
            if (model.Account == null)
            {
                throw new ArgumentException("Account cannot be null");
            }

            Account = new AccountWrapper(model.Account);
            RegisterComplex(Account);

            if (model.OrderAccountContact == null)
            {
                throw new ArgumentException("OrderAccountContact cannot be null");
            }

            OrderAccountContact = new PersonBaseWrapper(model.OrderAccountContact);
            RegisterComplex(OrderAccountContact);

            if (model.SalesRep == null)
            {
                throw new ArgumentException("SalesRep cannot be null");
            }

            SalesRep = new RepresentativeWrapper(model.SalesRep);
            RegisterComplex(SalesRep);

            if (model.AccountRep == null)
            {
                throw new ArgumentException("AccountRep cannot be null");
            }

            AccountRep = new RepresentativeWrapper(model.AccountRep);
            RegisterComplex(AccountRep);

            if (model.OrderStatusData == null)
            {
                throw new ArgumentException("OrderStatusData cannot be null");
            }

            OrderStatusData = new OrderStatusWrapper(model.OrderStatusData);
            RegisterComplex(OrderStatusData);
        }