internal bool ValidateUsernameFormat()
        {
            bool success = true;
            webserviceUmObject dummyUser = new webserviceUmObject()
            {
                medewerkerUsername = "******"
            };

            try
            {
                ReplaceUserProperty(OutputFormatUsernameTeacher, dummyUser);
                //ReplaceUserProperty(OutputFormatFirstnameTeacher, dummyUser);
                //ReplaceUserProperty(OutputFormatLastnameTeacher, dummyUser);
            }
            catch (Exception ex)
            {
                success = false;
                eh.WriteLog(string.Format("OutputFormatUsernameTeacher onjuist: {0}", ex.Message), System.Diagnostics.EventLogEntryType.Error, 500);
            }

            try
            {
                ReplaceUserProperty(OutputFormatUsernameStudent, dummyUser);
                //ReplaceUserProperty(OutputFormatFirstnameStudent, dummyUser);
                //ReplaceUserProperty(OutputFormatLastnameStudent, dummyUser);
            }
            catch (Exception ex)
            {
                success = false;
                eh.WriteLog(string.Format("OutputFormatUsernameStudent onjuist: {0}", ex.Message), System.Diagnostics.EventLogEntryType.Error, 500);
            }
            return(success);
        }
 private static string ReplaceUserProperty(string value, webserviceUmObject userobj)
 {
     return(Regex.Replace(value, @"{(?<exp>[^}]+)}", match =>
     {
         var p = Expression.Parameter(typeof(webserviceUmObject), "user");
         var e = System.Linq.Dynamic.DynamicExpression.ParseLambda(new[] { p }, null, match.Groups["exp"].Value);
         return (e.Compile().DynamicInvoke(userobj) ?? "").ToString();
     }));
 }
 internal string ReplaceStudentProperty(string format, webserviceUmObject userobj)
 {
     return(ReplaceUserProperty(format, userobj));
 }