Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 private static string FormatItem(CannedText ct)
 {
     return(string.Format("{0} ({1})", ct.Name, ct.Category));
 }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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;
        }
Пример #8
0
 private static string FormatItem(CannedText ct)
 {
     return string.Format("{0} ({1})", ct.Name, ct.Category);
 }