public static bool ValidateIt(AbstractRequestInfo infoRequest, string url) { var title = string.Format("[NESPE] {0} Newcomer Initial", infoRequest.Request_Id); return ValidateIt(infoRequest, url, title); }
public static bool ValidateIt(AbstractRequestInfo infoRequest, string url, string title) { try { WebClient wc = new WebClient(); wc.Credentials = System.Net.CredentialCache.DefaultCredentials; var fn = Nespe.Properties.Settings.Default.IT_VALIDATION_TEMP_FOLDER + "\\RequestInfo.ValideIt." + DateTime.Now.ToString("yyymmddHHMMss") + ".xml"; wc.DownloadFile(url, fn); XPathDocument doc = new XPathDocument(fn); XPathNavigator nav = doc.CreateNavigator(); var nsmgr = new XmlNamespaceManager(nav.NameTable); nsmgr.AddNamespace("n", "SM_x0020_Ticket_x0020_Detail_x0020_List"); var el = nav.SelectSingleNode(string.Format("/n:Report/n:tblMain/n:Detail_Collection/n:Detail[@txtTitle='{0}']", title), nsmgr); if (el == null || !el.HasAttributes) return false; var txtID = el.GetAttribute("txtID", ""); var txtCrtAssignee = el.GetAttribute("txtCrtAssignee", ""); if (string.IsNullOrWhiteSpace(txtID) || string.IsNullOrWhiteSpace(txtCrtAssignee)) return false; infoRequest.IsValidated = true; infoRequest.Executor = txtCrtAssignee; infoRequest.Name = txtID; return true; }catch(Exception){ return false;} }
// public static bool ValidateIt(AbstractRequestInfo infoRequest) { return ValidateIt(infoRequest, Nespe.Properties.Settings.Default.IT_VALIDATION_URL); }