private static void PreencheURLw(URLws wsItem, string tagName, string urls, string uf) { if (urls == "") { return; } string AppPath = Propriedade.PastaExecutavel + "\\"; XmlDocument doc = new XmlDocument(); doc.LoadXml(urls); XmlNodeList urlList = doc.ChildNodes; if (urlList == null) { return; } for (int i = 0; i < urlList.Count; ++i) { for (int j = 0; j < urlList[i].ChildNodes.Count; ++j) { System.Reflection.PropertyInfo ClassProperty = wsItem.GetType().GetProperty(urlList[i].ChildNodes[j].Name); if (ClassProperty != null) { string appPath = AppPath + urlList[i].ChildNodes[j].InnerText; if (!string.IsNullOrEmpty(urlList[i].ChildNodes[j].InnerText)) { if (urlList[i].ChildNodes[j].InnerText.ToLower().EndsWith("asmx?wsdl")) { appPath = urlList[i].ChildNodes[j].InnerText; } else { if (!File.Exists(appPath)) { appPath = ""; } } } else { appPath = ""; } if (appPath == "") { Console.WriteLine(urlList[i].ChildNodes[j].InnerText + "==>" + appPath); } ClassProperty.SetValue(wsItem, appPath, null); } else { Console.WriteLine("wsItem <" + urlList[i].ChildNodes[j].Name + "> nao encontrada na classe URLws"); } } } }
public webServices(int id, string nome, string uf) { LocalHomologacao = new URLws(); LocalProducao = new URLws(); ID = id; Nome = nome; UF = uf; }
private static void PreencheURLw(URLws wsItem, string tagName, string urls, string uf) { if (urls == "") return; string AppPath = Propriedade.PastaExecutavel + "\\"; XmlDocument doc = new XmlDocument(); doc.LoadXml(urls); XmlNodeList urlList = doc.ChildNodes; if (urlList == null) return; for (int i = 0; i < urlList.Count; ++i) { for (int j = 0; j < urlList[i].ChildNodes.Count; ++j) { System.Reflection.PropertyInfo ClassProperty = wsItem.GetType().GetProperty(urlList[i].ChildNodes[j].Name); if (ClassProperty != null) { string appPath = AppPath + urlList[i].ChildNodes[j].InnerText; if (!string.IsNullOrEmpty(urlList[i].ChildNodes[j].InnerText)) { if (urlList[i].ChildNodes[j].InnerText.ToLower().EndsWith("asmx?wsdl")) { appPath = urlList[i].ChildNodes[j].InnerText; } else { if (!File.Exists(appPath)) { appPath = ""; } } } else appPath = ""; if (appPath == "") Console.WriteLine(urlList[i].ChildNodes[j].InnerText + "==>" + appPath); ClassProperty.SetValue(wsItem, appPath, null); } else { Console.WriteLine("wsItem <" + urlList[i].ChildNodes[j].Name + "> nao encontrada na classe URLws"); } } } }