Пример #1
0
        public static string GetField(string fieldName)
        {
            string fieldFile       = TfSettings.Configuration().GetSection("SystemResources").GetSection("FieldMessages").Value;
            string systemFieldName = TfSettings.Configuration(fieldFile).GetSection(fieldName).Value;

            return
                (systemFieldName.IsEmpty() ?
                 fieldName :
                 systemFieldName);
        }
Пример #2
0
        public static string GetField(string fieldName)
        {
            string fieldFile       = TfSettings.GetSettings("SystemResources", "FieldMessages");
            string systemFieldName = TfSettings.GetSettingsWithFile(fieldFile, fieldName);

            return
                (systemFieldName.IsEmpty() ?
                 fieldName :
                 systemFieldName);
        }
Пример #3
0
        public static string GetMessage(string message, params string[] values)
        {
            if (message.IsEmpty())
            {
                return(null);
            }

            string messageFile    = TfSettings.Configuration().GetSection("SystemResources").GetSection("SystemMessages").Value;
            string defaultMessage = TfSettings.Configuration(messageFile).GetSection(message).Value;

            if (values != null && values.Count() > 0)
            {
                var fields = new List <string>();

                foreach (var value in values)
                {
                    if (value.IsEmpty())
                    {
                        continue;
                    }

                    string fieldName = GetField(value);

                    if (fieldName.IsEmpty())
                    {
                        fields.Add(value);
                    }

                    fields.Add(fieldName);
                }

                return(string.Format(defaultMessage, fields.ToArray()));
            }

            return
                (defaultMessage.IsEmpty() ?
                 message :
                 defaultMessage);
        }