public static void Run()
        {
            do
            {
                Console.WriteLine("\nWhat do you want to do?");
                Console.WriteLine("1) Fetch all orders with status IN_PROGRESS ");
                Console.WriteLine("2) Return a list of the top 5 products sold (name, EAN and total quantity), ordered by the total quantity sold in descending order, based on the API-response.");
                if (int.TryParse(Console.ReadLine().ToString(), out int val))
                {
                    switch (val)
                    {
                    case 1:
                        List <Order> Orders = BusinessControl.GetOrdersInProgAsync().GetAwaiter().GetResult();
                        foreach (Order Element in Orders)
                        {
                            Console.WriteLine("Order N" + Element.ChannelOrderNo + "\t| from channel " + Element.ChannelName + "\t| SubTotalInclVat " + Element.SubTotalInclVat);
                        }
                        break;

                    case 2:
                        List <Product> Products = BusinessControl.GetTop5ProductsAsync().GetAwaiter().GetResult();
                        foreach (Product Element in Products)
                        {
                            //name, EAN and total quantity
                            Console.WriteLine("Product Name" + Element.Name + "\t| EAN " + Element.Ean + "\t| Total quantity [TEST]===>" + Element.ToString());
                        }
                        break;
                    }
                }
                else
                {
                    Console.WriteLine("Invalid key");
                }
            } while (true);
        }
Exemple #2
0
        public void TestConvertTemperaturetoFahrenheit()
        {
            double celsius        = 25;
            double result         = BusinessControl.ConvertFromCelsiustoFahrenheit(celsius);
            double expectedResult = 77;

            Assert.AreEqual(result, expectedResult);
        }
Exemple #3
0
        public void TestConvertBarometricPressureToMillibars()
        {
            double pascal         = 1000;
            double result         = BusinessControl.ConvertToMillibars(pascal);
            double expectedResult = 10;

            Assert.AreEqual(result, expectedResult);
        }
Exemple #4
0
        public StackTrayBusiness(LineDevice lineDevice, BusinessControl businessControl)
        {
            //PrintInfo.DottedLine();
            this.stackNumber     = int.Parse(ConfigurationManager.AppSettings["stackNumber"]);
            this.trayNumber      = int.Parse(ConfigurationManager.AppSettings["trayNumber"]);
            this.isBatchValid    = int.Parse(ConfigurationManager.AppSettings["isBatchValid"]) == 1;
            this.isTrayCodeValid = int.Parse(ConfigurationManager.AppSettings["isTrayCodeValid"]) == 1;
            this.lineDevice      = lineDevice;
            this.businessControl = businessControl;
            //创建表
            this.lineDevice.PrefixTable = ConfigurationManager.AppSettings["prefixTable"];
            CreateTableBusiness.CreateTable(this.lineDevice.PrefixTable);

            InitTrayCodeList();
            DeviceInit();
        }