Esempio n. 1
0
        public string ReplaceProperty(string propertyName, string format, object context)
        {
            if (String.IsNullOrEmpty(propertyName))
            {
                return(propertyName);
            }

            switch (propertyName)
            {
            case "APPLICATION_NAME":
                return(ChoObject.Format(ChoGlobalApplicationSettings.Me.ApplicationName, format));

            case "PROCESS_ID":
                return(ChoObject.Format(ChoApplication.ProcessId, format));

            case "THREAD_ID":
                return(ChoObject.Format(ChoApplication.GetThreadId(), format));

            case "THREAD_NAME":
                return(ChoObject.Format(ChoApplication.GetThreadName(), format));

            case "RANDOM_NO":
                return(ChoObject.Format(ChoRandom.NextRandom(), format));

            case "TODAY":
                if (String.IsNullOrEmpty(format))
                {
                    return(System.DateTime.Today.ToShortDateString());
                }
                else
                {
                    return(ChoObject.Format(System.DateTime.Today, format));
                }

            case "NOW":
                if (String.IsNullOrEmpty(format))
                {
                    return(System.DateTime.Now.ToShortTimeString());
                }
                else
                {
                    return(ChoObject.Format(System.DateTime.Now, format));
                }

            case "SEQ_NO":
                return(ChoObject.Format(_sequenceGeneratorSettings.Value.Next(), format));

            default:
                return(ChoObject.Format(propertyName, format));
            }
        }