private void CreatColorSetList() { airlinelist.Clear(); restairlinelist.Clear(); regionallist.Clear(); aircrafttypelist.Clear(); importtypelist.Clear(); aircraftagelist.Clear(); aircraftrendlist.Clear(); var xmlconfig = this.ViewXmlConfig.FirstOrDefault(p => p.ConfigType == "颜色配置"); if (xmlconfig != null) { XElement xelement = xmlconfig.XmlContent; if (xelement != null) { foreach (XElement type in xelement.Descendants("Type")) { if (type.Attribute("TypeName").Value == "航空公司") { foreach (XElement item in type.Descendants("Item")) { if (ValidName(item.Attribute("Name").Value))//判断是否为当前航空公司或其子公司 { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; airlinelist.Add(xmlItem); } else { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; restairlinelist.Add(xmlItem); } } AirLineList = airlinelist; RestAirLineList = restairlinelist; } else if (type.Attribute("TypeName").Value == "座级") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; regionallist.Add(xmlItem); } RegionalList = regionallist; } else if (type.Attribute("TypeName").Value == "机型") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; aircrafttypelist.Add(xmlItem); } AircraftTypeList = aircrafttypelist; } else if (type.Attribute("TypeName").Value == "引进方式") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; importtypelist.Add(xmlItem); } ImportTypeList = importtypelist; } else if (type.Attribute("TypeName").Value == "机龄") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; aircraftagelist.Add(xmlItem); } AircraftAgeList = aircraftagelist; } else if (type.Attribute("TypeName").Value == "运力变化") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; aircraftrendlist.Add(xmlItem); } AircraftTrendList = aircraftrendlist; } } } } }
private void CreatColorSetList() { airlinelist.Clear(); restairlinelist.Clear(); regionallist.Clear(); aircrafttypelist.Clear(); aircraftagelist.Clear(); aircrafttrendlist.Clear(); importtypelist.Clear(); supplierlist.Clear(); manufacturerlist.Clear(); var xmlconfig = this.ViewXmlConfig.FirstOrDefault(p => p.ConfigType == "颜色配置"); if (xmlconfig != null) { XElement xelement = xmlconfig.XmlContent; if (xelement != null) { foreach (XElement type in xelement.Descendants("Type")) { if (type.Attribute("TypeName").Value == "航空公司") { foreach (XElement item in type.Descendants("Item")) { if (ValidName(item.Attribute("Name").Value))//判断是否是当前需要上报的航空公司 { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; airlinelist.Add(xmlItem); } else//如果暂时不用上报则将其颜色配置保留,但不显示在界面 { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; restairlinelist.Add(xmlItem); } } AirLineList = airlinelist; RestAirLineList = restairlinelist; } else if (type.Attribute("TypeName").Value == "座级") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; regionallist.Add(xmlItem); } RegionalList = regionallist; } else if (type.Attribute("TypeName").Value == "机型") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; aircrafttypelist.Add(xmlItem); } AircraftTypeList = aircrafttypelist; } else if (type.Attribute("TypeName").Value == "机龄") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; aircraftagelist.Add(xmlItem); } AircraftAgeList = aircraftagelist; } else if (type.Attribute("TypeName").Value == "运力变化") { foreach (XElement item in type.Descendants("Item")) { if (!(item.Attribute("Name").Value.IndexOf("(子)") != -1)) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; aircrafttrendlist.Add(xmlItem); } } AircraftTrendList = aircrafttrendlist; } else if (type.Attribute("TypeName").Value == "引进方式") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; importtypelist.Add(xmlItem); } ImportTypeList = importtypelist; } else if (type.Attribute("TypeName").Value == "供应商") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; supplierlist.Add(xmlItem); } SupplierList = supplierlist; } else if (type.Attribute("TypeName").Value == "制造商") { foreach (XElement item in type.Descendants("Item")) { xmlItem xmlItem = new xmlItem(); xmlItem.Name = item.Attribute("Name").Value; xmlItem.Color = item.Attribute("Color").Value; ; manufacturerlist.Add(xmlItem); } ManufacturerList = manufacturerlist; } } } } }