private Shipper UnproxyShipper(Shipper proxyShipper)
        {
            var shipper = new Shipper();

            PropertyCloner.CopyProperties(proxyShipper, shipper);
            shipper.Orders = new List <Order>();
            return(shipper);
        }
        private Customer UnproxyCustomer(Customer proxyCustomer)
        {
            var customer = new Customer();

            PropertyCloner.CopyProperties(proxyCustomer, customer);
            customer.Orders = new List <Order>();
            customer.CustomerDemographics = UnproxyCustomerDemographics(customer.CustomerDemographics);
            return(customer);
        }
        private Product UnproxyProduct(Product proxyProduct)
        {
            var product = new Product();

            PropertyCloner.CopyProperties(proxyProduct, product);
            product.Order_Details = new List <Order_Detail>();
            product.Category      = null;
            product.Supplier      = null;
            return(product);
        }
        private Order UnproxyOrder(Order proxyOrder)
        {
            var order = new Order();

            PropertyCloner.CopyProperties(proxyOrder, order);
            order.Order_Details = UnproxyOrder_Details(order.Order_Details);
            order.Customer      = UnproxyCustomer(order.Customer);
            order.Employee      = UnproxyEmployee(order.Employee);
            order.Shipper       = UnproxyShipper(order.Shipper);
            return(order);
        }
        private Employee UnproxyEmployee(Employee proxyEmployee)
        {
            var employee = new Employee();

            PropertyCloner.CopyProperties(proxyEmployee, employee);
            employee.Orders      = new List <Order>();
            employee.Employee1   = null;
            employee.Employees1  = new List <Employee>();
            employee.Territories = new List <Territory>();
            return(employee);
        }
        private ICollection <Order_Detail> UnproxyOrder_Details(IEnumerable <Order_Detail> proxyOrderDetails)
        {
            var orderDetails = new List <Order_Detail>();

            foreach (var proxyorderDetail in proxyOrderDetails)
            {
                var orderDetail = new Order_Detail();
                PropertyCloner.CopyProperties(proxyorderDetail, orderDetail);
                orderDetail.Order   = null;
                orderDetail.Product = UnproxyProduct(orderDetail.Product);
                orderDetails.Add(orderDetail);
            }

            return(orderDetails);
        }
        private ICollection <CustomerDemographic> UnproxyCustomerDemographics(
            IEnumerable <CustomerDemographic> proxyCustomerDemographics)
        {
            var customerDemographics = new List <CustomerDemographic>();

            foreach (var proxyCustomerDemographic in proxyCustomerDemographics)
            {
                var customerDemographic = new CustomerDemographic();
                PropertyCloner.CopyProperties(proxyCustomerDemographic, customerDemographic);
                customerDemographic.Customers = new List <Customer>();
                customerDemographics.Add(customerDemographic);
            }

            return(customerDemographics);
        }
        public void GetObjectData(object obj, SerializationInfo info, StreamingContext context)
        {
            var orderDetail = (Order_Detail)obj;
            var order       = new Order();

            PropertyCloner.CopyProperties(orderDetail.Order, order);
            order.Order_Details = new List <Order_Detail>();
            order.Customer      = null;
            order.Employee      = null;
            order.Shipper       = null;
            var product = new Product();

            PropertyCloner.CopyProperties(orderDetail.Product, product);
            product.Order_Details = new List <Order_Detail>();
            product.Category      = null;
            product.Supplier      = null;
            info.AddValue(nameof(Order_Detail.Discount), orderDetail.Discount);
            info.AddValue(nameof(Order_Detail.Order), order);
            info.AddValue(nameof(Order_Detail.OrderID), orderDetail.OrderID);
            info.AddValue(nameof(Order_Detail.Product), product);
            info.AddValue(nameof(Order_Detail.ProductID), orderDetail.ProductID);
            info.AddValue(nameof(Order_Detail.Quantity), orderDetail.Quantity);
            info.AddValue(nameof(Order_Detail.UnitPrice), orderDetail.UnitPrice);
        }