public static OrdersManagementDataSet CreateLoaded()
        {
            OrdersManagementDataSet ds = new OrdersManagementDataSet();

            Assembly currentAssembly = Assembly.GetExecutingAssembly();
            using (Stream dataStream = currentAssembly.GetManifestResourceStream("OrdersRepository.Services.OrdersData.xml"))
            {
                ds.ReadXml(dataStream);
            }
            return ds;
        }
        public static OrdersManagementDataSet CreateLoaded()
        {
            OrdersManagementDataSet ds = new OrdersManagementDataSet();

            Assembly currentAssembly = Assembly.GetExecutingAssembly();

            using (Stream dataStream = currentAssembly.GetManifestResourceStream("OrdersRepository.Services.OrdersData.xml"))
            {
                ds.ReadXml(dataStream);
            }
            return(ds);
        }
 public ProductService(OrdersManagementDataSet repository)
 {
     this.repository = repository;
 }
 public OrdersService(OrdersManagementDataSet repository, IProductService productService)
 {
     this.repository = repository;
     _productService = productService;
 }
        private Order TranslateFromOrdersRowToOrderEntityWithDetails(OrdersManagementDataSet.OrdersRow ordersRow)
        {
            OrdersManagementDataSet.OrderDetailsRow[] detailRows = ordersRow.GetOrderDetailsRows();
            Order order = new Order();
            TranslateFromOrdersRowToOrderEntity(ordersRow, order);

            order.Details = new List<OrderDetail>(detailRows.Length);
            foreach (OrdersManagementDataSet.OrderDetailsRow detailRow in detailRows)
            {
                Product product = _productService.GetProductById(detailRow.ProductId);
                OrderDetail detail = new OrderDetail(detailRow.OrderId, detailRow.ProductId, detailRow.Quantity, product.UnitPrice.Value);
                order.Details.Add(detail);
            }
            return order;
        }
 private static void TranslateFromOrdersRowToOrderEntity(OrdersManagementDataSet.OrdersRow ordersRow, Order order)
 {
     order.OrderId = ordersRow.OrderId;
     order.CustomerId = ordersRow.IsCustomerIdNull() ? null : ordersRow.CustomerId;
     order.Description = ordersRow.IsDescriptionNull() ? null : ordersRow.Description;
     order.Approver = ordersRow.Approver;
     order.Creator = ordersRow.Creator;
     order.OrderName = ordersRow.IsOrderNameNull() ? null : ordersRow.OrderName;
     order.OrderStatus = ordersRow.OrderStatus;
     order.ShipAddress = ordersRow.IsShipAddressNull() ? null : ordersRow.ShipAddress;
     order.ShipCity = ordersRow.IsShipCityNull() ? null : ordersRow.ShipCity;
     order.ShipPostalCode = ordersRow.IsShipPostalCodeNull() ? null : ordersRow.ShipPostalCode;
     order.ShipRegion = ordersRow.IsShipRegionNull() ? null : ordersRow.ShipRegion;
 }
 private static void TranslateFromOrderEntityToOrdersRow(Order order, OrdersManagementDataSet.OrdersRow ordersRow)
 {
     ordersRow.CustomerId = order.CustomerId;
     ordersRow.Description = order.Description;
     ordersRow.Approver = order.Approver;
     ordersRow.Creator = order.Creator;
     ordersRow.OrderName = order.OrderName;
     ordersRow.OrderStatus = order.OrderStatus;
     ordersRow.ShipAddress = order.ShipAddress;
     ordersRow.ShipCity = order.ShipCity;
     ordersRow.ShipPostalCode = order.ShipPostalCode;
     ordersRow.ShipRegion = order.ShipRegion;
 }
 public EmployeeService(OrdersManagementDataSet repository)
 {
     this.repository = repository;
 }
 public OrdersService(OrdersManagementDataSet repository, IProductService productService)
 {
     this.repository = repository;
     _productService = productService;
 }
 public EmployeeService(OrdersManagementDataSet repository)
 {
     this.repository = repository;
 }
        private static Employee TranslateFromEmployeesRowToEmployeeEntity(OrdersManagementDataSet.EmployeesRow employeeRow)
        {
            Employee employee = new Employee();
            employee.EmployeeId = employeeRow.EmployeeId;
            employee.FirstName = employeeRow.FirstName;
            employee.LastName = employeeRow.LastName;

            return employee;
        }
Example #12
0
 public CustomerService(OrdersManagementDataSet repository)
 {
     this.repository = repository;
 }
 public CustomerService(OrdersManagementDataSet repository)
 {
     this.repository = repository;
 }
 private static Customer TranslateFromCustomerRowToCustomerEntity(OrdersManagementDataSet.CustomersRow customersRow)
 {
     Customer customer = new Customer();
     customer.Address = customersRow.IsAddressNull() ? null : customersRow.Address;
     customer.City = customersRow.IsCityNull() ? null : customersRow.City;
     customer.CompanyName = customersRow.CompanyName;
     customer.CustomerId = customersRow.CustomerId;
     customer.PostalCode = customersRow.IsPostalCodeNull() ? null : customersRow.PostalCode;
     customer.Region = customersRow.IsRegionNull() ? null : customersRow.Region;
     return customer;
 }
 public ProductService(OrdersManagementDataSet repository)
 {
     this.repository = repository;
 }
        private static Product TranslateFromProductsRowToProductEntity(OrdersManagementDataSet.ProductsRow productsRow)
        {
            Product product = new Product();
            product.ProductId = productsRow.ProductId;
            product.ProductSku = productsRow.ProductSKU;
            product.ProductName = productsRow.ProductName;
            product.Description = productsRow.Description;
            product.UnitPrice = productsRow.UnitPrice;

            return product;
        }