public ServiceResult GetSugestion(String listTexsegment) { ServiceResult sResult = new ServiceResult(); try { var user = HttpContext.Current.User; if (user.Identity.IsAuthenticated) { TranslateModel translateModel = new TranslateModel(); List <TextSegment> lstTextSegment = JsonConvert.DeserializeObject <List <TextSegment> >(listTexsegment); if (lstTextSegment.Count > 0) { var projectId = lstTextSegment[0].ProjectId; List <ReferenceDB> lstReferenceDB = new List <ReferenceDB>(); lstReferenceDB = translateModel.GetConditionData(projectId); List <Int32> lstProjectIDRef = new List <int>(); foreach (ReferenceDB itReferenceDB in lstReferenceDB) { lstProjectIDRef.Add(itReferenceDB.ProjectReferID); } lstProjectIDRef.Add(projectId); TextSuggestion oTextSuggestion = new TextSuggestion(); foreach (var item in lstTextSegment) { oTextSuggestion = translateModel.GetSuggestion(item.TextSegment1, lstProjectIDRef); if (oTextSuggestion != null) { item.Suggestion = oTextSuggestion.TextSegment2; } } } sResult.Value = lstTextSegment; } } catch (Exception ex) { sResult.IsSuccess = false; sResult.Message = "Some word can't get suggestion !"; } return(sResult); }
private void suggestedText_SelectedIndexChanged(object sender, EventArgs e) { TextSuggestion ft1 = suggestedText.SelectedItem as TextSuggestion; FeedbackText.Text += ft1.shortCutText; }