private static CorporateData ProcessCorporationSheetResponse(XElement results) { if (results == null) { return(null); // return null... no data. } var data = new CorporateData(); data.CorporationId = results.Element("corporationID").Value.ToInt32(); data.CorporationName = results.Element("corporationName").Value; data.Ticker = results.Element("ticker").Value; data.CeoId = results.Element("ceoID").Value.ToInt32(); data.CeoName = results.Element("ceoName").Value; data.StationId = results.Element("stationID").Value.ToInt32(); data.StationName = results.Element("stationName").Value; data.Description = results.Element("description").Value; data.Url = results.Element("url").Value; data.AllianceId = results.Element("allianceID").Value.ToInt32(); if (results.Element("allianceName") != null) { data.AllianceName = results.Element("allianceName").Value; } data.TaxRate = results.Element("taxRate").Value; data.MemberCount = results.Element("memberCount").Value.ToInt32(); data.MemberLimit = results.Element("memberLimit").Value.ToInt32(); data.Shares = results.Element("shares").Value.ToInt32(); data.Divisions = from rowsets in results.Elements("rowset") from rows in rowsets.Descendants() where rowsets.Attribute("name").Value == "divisions" select new CorporateDivision { AccountKey = rows.Attribute("accountKey").Value.ToInt32(), Description = rows.Attribute("description").Value }; data.WalletDivisions = from rowsets in results.Elements("rowset") from rows in rowsets.Descendants() where rowsets.Attribute("name").Value == "walletDivisions" select new CorporateDivision { AccountKey = rows.Attribute("accountKey").Value.ToInt32(), Description = rows.Attribute("description").Value }; XElement logoXml = results.Element("logo"); var logo = new CorporateLogo { GraphicId = logoXml.Element("graphicID").Value.ToInt32(), Color1 = logoXml.Element("color1").Value.ToInt32(), Color2 = logoXml.Element("color2").Value.ToInt32(), Color3 = logoXml.Element("color3").Value.ToInt32(), Shape1 = logoXml.Element("shape1").Value.ToInt32(), Shape2 = logoXml.Element("shape2").Value.ToInt32(), Shape3 = logoXml.Element("shape3").Value.ToInt32() }; data.Logo = logo; return(data); }
private static CorporateData ProcessCorporationSheetResponse(XElement results) { if (results == null) { return null; // return null... no data. } var data = new CorporateData(); data.CorporationId = results.Element("corporationID").Value.ToInt32(); data.CorporationName = results.Element("corporationName").Value; data.Ticker = results.Element("ticker").Value; data.CeoId = results.Element("ceoID").Value.ToInt32(); data.CeoName = results.Element("ceoName").Value; data.StationId = results.Element("stationID").Value.ToInt32(); data.StationName = results.Element("stationName").Value; data.Description = results.Element("description").Value; data.Url = results.Element("url").Value; data.AllianceId = results.Element("allianceID").Value.ToInt32(); if (results.Element("allianceName") != null) { data.AllianceName = results.Element("allianceName").Value; } data.TaxRate = results.Element("taxRate").Value; data.MemberCount = results.Element("memberCount").Value.ToInt32(); data.MemberLimit = results.Element("memberLimit").Value.ToInt32(); data.Shares = results.Element("shares").Value.ToInt32(); data.Divisions = from rowsets in results.Elements("rowset") from rows in rowsets.Descendants() where rowsets.Attribute("name").Value == "divisions" select new CorporateDivision { AccountKey = rows.Attribute("accountKey").Value.ToInt32(), Description = rows.Attribute("description").Value }; data.WalletDivisions = from rowsets in results.Elements("rowset") from rows in rowsets.Descendants() where rowsets.Attribute("name").Value == "walletDivisions" select new CorporateDivision { AccountKey = rows.Attribute("accountKey").Value.ToInt32(), Description = rows.Attribute("description").Value }; XElement logoXml = results.Element("logo"); var logo = new CorporateLogo { GraphicId = logoXml.Element("graphicID").Value.ToInt32(), Color1 = logoXml.Element("color1").Value.ToInt32(), Color2 = logoXml.Element("color2").Value.ToInt32(), Color3 = logoXml.Element("color3").Value.ToInt32(), Shape1 = logoXml.Element("shape1").Value.ToInt32(), Shape2 = logoXml.Element("shape2").Value.ToInt32(), Shape3 = logoXml.Element("shape3").Value.ToInt32() }; data.Logo = logo; return data; }