Esempio n. 1
0
        public Order CreateOrder(Dictionary <string, string> orderInfo)
        {
            Baguette baguette;

            if (orderInfo["Baguette_type:"].Equals("Farinee"))
            {
                baguette = new BaguetteFarinee(Convert.ToInt32(orderInfo["Width:"]), Convert.ToInt32(orderInfo["Height:"]), orderInfo["Baguette_type:"]);
            }
            else if (orderInfo["Baguette_type:"].Equals("Moulee"))
            {
                baguette = new BaguetteMoulee(Convert.ToInt32(orderInfo["Amount_of_coats:"]), Convert.ToInt32(orderInfo["Width:"]), Convert.ToInt32(orderInfo["Height:"]), orderInfo["Baguette_type:"]);
            }
            else
            {
                throw new ArgumentException("Wrong Baguette Type");
            }
            return(new Order(Convert.ToInt32(orderInfo["Count:"]), baguette, orderInfo["Surname:"]));
        }
Esempio n. 2
0
        public static void ReadOrder(string path, Shop shop)
        {
            Baguette baguette = null;
            List <Dictionary <string, string> > listArr = ReadFile(path);
            Dictionary <string, string>         array   = new Dictionary <string, string>();

            for (int i = 0; i < listArr.Count; i++)
            {
                array = listArr[i];
                if (array["Baguette_type:"].Equals("Farinee"))
                {
                    baguette = new BaguetteFarinee(Convert.ToInt32(array["Width:"]), Convert.ToInt32(array["Height:"]), array["Baguette_type:"]);
                }
                else if (array["Baguette_type:"].Equals("Moulee"))
                {
                    baguette = new BaguetteMoulee(Convert.ToInt32(array["Amount_of_coats:"]), Convert.ToInt32(array["Width:"]), Convert.ToInt32(array["Height:"]), array["Baguette_type:"]);
                }
                shop.AddNewOrder(new Order(Convert.ToInt32(array["Count:"]), baguette, array["Surname:"]));
            }
        }