/// <summary> /// Convert XML string into QueryDescriptionResult object /// </summary> /// <param name="response"></param> /// <returns></returns> internal static QueryDescriptionResult ParseQueryDescriptionResult(string response) { QueryDescriptionResult r = new QueryDescriptionResult(); try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(response); foreach (XmlNode xmlNode in xmlDoc.ChildNodes[1].ChildNodes) { switch (xmlNode.Name) { case "IsSuccesfull": r.IsSuccesfull = bool.Parse(xmlNode.InnerText); break; case "ReturnValue": r.Description = xmlNode.InnerText; break; } } xmlDoc = null; } catch (Exception ex) { Common.Logger.Create().Error(ex.ToString()); } return(r); }
/// <summary> /// Find specified problem description /// </summary> /// <param name="queryId">Problem identifier</param> /// <returns>If file description was found method returns full path to file, otherwise retutn null</returns> public static string GetStoredProblem(int queryId) { QueryDescriptionResult queryResult = new QueryDescriptionResult(); queryResult.QueryId = queryId; string file = queryResult.GetFileDescription(); if (string.IsNullOrEmpty(file)) { if (CommonData.IsWorkingOffline) { MessageBox.Show("You are working offline. \rCannot get data", "Error", MessageBoxButtons.OK); return(null); } BackgroundWorkerHelper bg = new BackgroundWorkerHelper(delegate(object obj) { CxWSResponseQueryDescription cxWSResponseQueryDescription = QueryDescriptionResult.GetById(queryResult.QueryId); queryResult = new QueryDescriptionResult(); queryResult.Description = cxWSResponseQueryDescription.QueryDescription; queryResult.IsSuccesfull = cxWSResponseQueryDescription.IsSuccesfull; queryResult.QueryId = queryId; }, 0, 0); if (!bg.DoWork("Downloading description...")) { return(null); } if (queryResult.IsSuccesfull && queryResult.Save()) { file = queryResult.GetFileDescription(); } } return(file); }