public CxWSResponseQueryDescription GetQueryDescription(string sessionId, int cweId) { CxWSResponseQueryDescription result = _web_Service.GetQueryDescription(sessionId, cweId); result.IsSuccesfull = true; new CxTeamMentor().TMFilterFor_CxWSResponseQueryDescription(cweId, result); return(result); }
public void TMFilterFor_CxWSResponseQueryDescription(int cweId,CxWSResponseQueryDescription cxWsResponseQueryDescription) { if (cxWsResponseQueryDescription.IsSuccesfull && cweId > TeamMentorIdentifier) { cxWsResponseQueryDescription.QueryDescription = !CxTeamMentor_Mappings.Tm_QueryId_Mappings.ContainsKey(cweId) ? String.Format("The TeamMentor article with Id {0} could not be found",cweId) : String.Format(CxTeamMentor_Mappings.HtmlRedirectTemplate, CxTeamMentor_Mappings.Tm_QueryId_Mappings[cweId]); } }
public void TMFilterFor_CxWSResponseQueryDescription(int cweId, CxWSResponseQueryDescription cxWsResponseQueryDescription) { if (cxWsResponseQueryDescription.IsSuccesfull && cweId > TeamMentorIdentifier) { cxWsResponseQueryDescription.QueryDescription = !CxTeamMentor_Mappings.Tm_QueryId_Mappings.ContainsKey(cweId) ? String.Format("The TeamMentor article with Id {0} could not be found", cweId) : String.Format(CxTeamMentor_Mappings.HtmlRedirectTemplate, CxTeamMentor_Mappings.Tm_QueryId_Mappings[cweId]); } }
/// <summary> /// Return selected problem description /// </summary> /// <param name="queryId">Problem identifier</param> /// <returns></returns> public static CxWSResponseQueryDescription GetQueryDesription(int queryId) { LoginData login = LoginHelper.Load(0); CxWebServiceClient client = null; if (login != null) { client = new CxWebServiceClient(login); } if (client == null || client.ServiceClient == null) { return(null); } CxWSResponseQueryDescription cxWSResponseQueryDescription = client.ServiceClient.GetQueryDescriptionByQueryId("", queryId); client.Close(); return(cxWSResponseQueryDescription); }
public void TMFilterFor_CxWSResponseQueryDescription(int cweId,CxWSResponseQueryDescription cxWsResponseQueryDescription) { log.Debug("Inside TMFilterFor_CxWSResponseQueryDescription method..."); log.Debug(String.Format("Getting QueryDescription for CWE {0} ",cweId)); if (cweId > TeamMentorIdentifier && cweId < TopIdentifier) { cxWsResponseQueryDescription.QueryDescription = !CxTeamMentor_Mappings.Tm_QueryId_Mappings.ContainsKey(cweId) ? String.Format("The TeamMentor article with Id {0} could not be found",cweId) : String.Format(CxTeamMentor_Mappings.HtmlRedirectTemplate, CxTeamMentor_Mappings.Tm_QueryId_Mappings[cweId]); } else { if (cweId > TopIdentifier) { cweId = (int) ((cweId - TopIdentifier) + TeamMentorIdentifier); log.Debug(String.Format("Fixed CWE {0} ", cweId)); var description = !CxTeamMentor_Mappings.Tm_QueryId_Mappings.ContainsKey(cweId)? string.Empty : String.Format(CxTeamMentor_Mappings.HtmlRedirectTemplate, CxTeamMentor_Mappings.Tm_QueryId_Mappings[cweId]); if (!String.IsNullOrEmpty(description)) { var url = description.Substring(54, 76); log.Debug("URL is "+ url); WebRequest req = HttpWebRequest.Create(url); req.Method = "GET"; string source; using (StreamReader reader = new StreamReader(req.GetResponse().GetResponseStream())) { source = reader.ReadToEnd(); } cxWsResponseQueryDescription.QueryDescription = source; } } } log.Debug("HTML reponse " + cxWsResponseQueryDescription.QueryDescription); }
/// <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); }