public string GetFullText(CannedText cannedText) { string fullText = null; try { Platform.GetService <ICannedTextService>( service => { var response = service.LoadCannedTextForEdit( new LoadCannedTextForEditRequest( cannedText.Name, cannedText.Category, cannedText.StaffId, cannedText.StaffGroupName)); fullText = response.CannedTextDetail.Text; }); } catch (Exception e) { ExceptionHandler.Report(e, _desktopWindow); } return(fullText); }
private static bool ResolveName(string query, out CannedText result) { result = null; CannedTextSummary cannedText = null; Platform.GetService <ICannedTextService>( service => { // Ask for maximum of 2 rows var request = new ListCannedTextForUserRequest { Name = query, Page = new SearchResultPage(-1, 2) }; var response = service.ListCannedTextForUser(request); // the name is resolved only if there is one match if (response.CannedTexts.Count == 1) { cannedText = CollectionUtils.FirstElement(response.CannedTexts); } }); if (cannedText != null) { result = new CannedText(cannedText); } return(result != null); }
private bool ResolveNameInteractive(string query, out CannedText result) { result = null; var cannedTextComponent = new CannedTextSummaryComponent(true, query); var exitCode = ApplicationComponent.LaunchAsDialog( _desktopWindow, cannedTextComponent, SR.TitleCannedText); if (exitCode == ApplicationComponentExitCode.Accepted) { var summary = (CannedTextSummary)cannedTextComponent.SummarySelection.Item; result = new CannedText(summary); } return(result != null); }
private static string FormatItem(CannedText ct) { return(string.Format("{0} ({1})", ct.Name, ct.Category)); }
private bool ResolveNameInteractive(string query, out CannedText result) { result = null; var cannedTextComponent = new CannedTextSummaryComponent(true, query); var exitCode = ApplicationComponent.LaunchAsDialog( _desktopWindow, cannedTextComponent, SR.TitleCannedText); if (exitCode == ApplicationComponentExitCode.Accepted) { var summary = (CannedTextSummary)cannedTextComponent.SummarySelection.Item; result = new CannedText(summary); } return (result != null); }
private static bool ResolveName(string query, out CannedText result) { result = null; CannedTextSummary cannedText = null; Platform.GetService<ICannedTextService>( service => { // Ask for maximum of 2 rows var request = new ListCannedTextForUserRequest {Name = query, Page = new SearchResultPage(-1, 2)}; var response = service.ListCannedTextForUser(request); // the name is resolved only if there is one match if (response.CannedTexts.Count == 1) cannedText = CollectionUtils.FirstElement(response.CannedTexts); }); if (cannedText != null) result = new CannedText(cannedText); return (result != null); }
public string GetFullText(CannedText cannedText) { string fullText = null; try { Platform.GetService<ICannedTextService>( service => { var response = service.LoadCannedTextForEdit( new LoadCannedTextForEditRequest( cannedText.Name, cannedText.Category, cannedText.StaffId, cannedText.StaffGroupName)); fullText = response.CannedTextDetail.Text; }); } catch (Exception e) { ExceptionHandler.Report(e, _desktopWindow); } return fullText; }
private static string FormatItem(CannedText ct) { return string.Format("{0} ({1})", ct.Name, ct.Category); }