Exemplo n.º 1
0
        public void ParseXmlToAutoShow(string fileName, AutoCatalog autoCatalog)
        {
            XDocument doc = XDocument.Load(fileName);

            foreach (XElement el in doc.Root.Elements())
            {
                string brand = null, model = null;
                int    count = 0, price = 0;
                foreach (XElement element in el.Elements())
                {
                    switch (element.Name.ToString())
                    {
                    case "brand":
                        brand = element.Value;
                        break;

                    case "model":
                        model = element.Value;
                        break;

                    case "count":
                        count = int.Parse(element.Value);
                        break;

                    case "price":
                        price = int.Parse(element.Value);
                        break;
                    }
                }
                Auto currentAuto = new Auto(brand, model, count, price);
                Add  added       = new Add(autoCatalog, currentAuto);
                added.Execute();
            }
        }
Exemplo n.º 2
0
 public AveragePriceType(AutoCatalog autoCatalog, string brand)
 {
     this.autoCatalog = autoCatalog;
     this.brand       = brand;
 }
Exemplo n.º 3
0
 public CountAll(AutoCatalog autoCatalog)
 {
     this.autoCatalog = autoCatalog;
 }
Exemplo n.º 4
0
 public AveragePrice(AutoCatalog autoCatalog)
 {
     this.autoCatalog = autoCatalog;
 }
Exemplo n.º 5
0
 public CountType(AutoCatalog autoCatalog)
 {
     this.autoCatalog = autoCatalog;
 }