예제 #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();
            }
        }
예제 #2
0
 public AveragePriceType(AutoCatalog autoCatalog, string brand)
 {
     this.autoCatalog = autoCatalog;
     this.brand       = brand;
 }
예제 #3
0
 public CountAll(AutoCatalog autoCatalog)
 {
     this.autoCatalog = autoCatalog;
 }
예제 #4
0
 public AveragePrice(AutoCatalog autoCatalog)
 {
     this.autoCatalog = autoCatalog;
 }
예제 #5
0
 public CountType(AutoCatalog autoCatalog)
 {
     this.autoCatalog = autoCatalog;
 }