示例#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);
 }