コード例 #1
0
        private Order GenerateOrder()
        {
            double       price    = 10;
            Customer     Customer = new Customer("customer1", "customer1");
            Supplier     supplier = new Supplier("SUp1", "sup2");
            ProductClass product  = new ProductClass("P1");

            Order.OrderTypeEnum OrderType = Order.OrderTypeEnum.SupplierOrder;

            PriceTable        priceTable     = new PriceTable(product, amount, price);
            List <PriceTable> pricetableList = new List <PriceTable>()
            {
                priceTable
            };

            DateTime currentTime  = new DateTime(2017, 10, 10);
            DateTime deliveryTime = new DateTime(2017, 10, 10);

            string orderId = "orderID";

            order = new Order(supplier, OrderType, orderId, currentTime, deliveryTime, pricetableList);

            return(order);
        }
コード例 #2
0
ファイル: OrderParser.cs プロジェクト: eddiyur/FinalProject
        public static OrdersList Parse(XmlNodeList OrderNodeList, InitDataLoad initDataLoad, Order.OrderTypeEnum orderType)
        {
            ProductClassList productsList      = initDataLoad.MetaData.ProductsMetaData;
            SuppliersList    SuppliersMetaData = initDataLoad.MetaData.SuppliersMetaData;
            OrdersList       orderList         = new OrdersList();

            foreach (XmlNode customerOrderNode in OrderNodeList)//orders level
            {
                Order    order    = new Order(orderType);
                Customer customer = new Customer();

                foreach (XmlNode orderParameter in customerOrderNode)//order parts level
                {
                    XMLOrderFields XMLcustomerOrderField = (XMLOrderFields)Enum.Parse(typeof(XMLOrderFields), orderParameter.Name, true);

                    switch (XMLcustomerOrderField)
                    {
                    case XMLOrderFields.PersonName:
                        customer.Name = orderParameter.InnerText;
                        break;

                    case XMLOrderFields.PersonID:
                        customer.ID = orderParameter.InnerText;
                        break;

                    case XMLOrderFields.OrderID:
                        order.OrderID = orderParameter.InnerText;
                        break;

                    case XMLOrderFields.OrderDate:
                        order.OrderDate = DateTime.Parse(orderParameter.InnerText);
                        break;

                    case XMLOrderFields.OrderDeliveryDate:
                        order.OrderDeliveryDate = DateTime.Parse(orderParameter.InnerText);
                        break;

                    case XMLOrderFields.Order_Status:
                        order.OrderStatus = (Order.OrderStatusEnum)Enum.Parse(typeof(Order.OrderStatusEnum), orderParameter.InnerText, true);
                        break;

                    case XMLOrderFields.OrderProductsList:
                        order.OrderProductsList = getOrderProductsList(orderParameter, productsList);
                        break;

                    default:
                        break;
                    } //end switch
                }     // end order parts level
                if (orderType == Order.OrderTypeEnum.CustomerOrder)
                {
                    order.Person = customer;
                }
                else
                {
                    order.Person = SuppliersMetaData.GetSupplier(customer.ID);
                }

                orderList.AddOrder(order);
            }//end orders level



            return(orderList);
        }