Esempio n. 1
0
        public static IdText[] ReturnArrayWithIdText(string fileNameFullPathToConfigFile, out string errorMessage)
        {
            List <AdhocTemplate> listWithAdhocTemplates;

            IdText[] arrayWithIdText;

            errorMessage = null;

            try
            {
                listWithAdhocTemplates = ReturnListWithAdhocTemplates(fileNameFullPathToConfigFile, out errorMessage);

                if (errorMessage != null)
                {
                    return(null);
                }

                arrayWithIdText = new IdText[listWithAdhocTemplates.Count];

                for (int i = 0; i < listWithAdhocTemplates.Count; i++)
                {
                    arrayWithIdText[i] = new IdText(listWithAdhocTemplates[i].Id, listWithAdhocTemplates[i].Name);
                }
            }
            catch (Exception e)
            {
                errorMessage = string.Format("ERROR!! An Exception occured in method AdhocTemplateUtility.ReturnArrayWithIdText! e.Message:\r\n{0}", e.Message);
                return(null);
            }

            return(arrayWithIdText);
        }
Esempio n. 2
0
        public static IdText[] ReturnArrayWithKeyWords(out string errorMessage)
        {
            List <KeyWord> listWithKeyWords;

            IdText[] idText;

            errorMessage = null;

            try
            {
                listWithKeyWords = GetKeyWords().OrderBy(x => x.Phrase).ToList();
                idText           = new IdText[listWithKeyWords.Count];

                for (int i = 0; i < listWithKeyWords.Count; i++)
                {
                    idText[i] = new IdText(listWithKeyWords[i].Id.Value, listWithKeyWords[i].Phrase);
                }
            }
            catch (Exception e)
            {
                errorMessage = string.Format("ERROR!! An Exception occured in method ReturnArrayWithKeyWords! e.Message:\r\n{0}", e.Message);
                return(null);
            }

            return(idText);
        }