예제 #1
0
        private static Signup_Result ValidationFailed(TMConfig config, NewUser newUser)
        {
            var sigupResponse  = new Signup_Result();
            var validationList = newUser.validate();

            sigupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
            sigupResponse.UserCreated   = 0;
            if (config.showDetailedErrorMessages())
            {
                foreach (var validation in validationList)
                {
                    var field = validation.MemberNames.FirstOrDefault();

                    sigupResponse.Validation_Results.Add(new Validation_Results
                    {
                        Field   = field,
                        Message = validation.ErrorMessage
                    });
                }
            }
            else
            {
                sigupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            }
            return(sigupResponse);
        }
예제 #2
0
        private static Signup_Result ValidateUserName(TMConfig config)
        {
            var signupResponse = new Signup_Result
            {
                Signup_Status = Signup_Result.SignupStatus.Validation_Failed,
                UserCreated   = 0
            };

            if (config.showDetailedErrorMessages())
            {
                signupResponse.Validation_Results.Add(new Validation_Results {
                    Field = "Username", Message = TMConfig.Current.TMErrorMessages.SignUpUsernameAlreadyExist
                });
            }
            else
            {
                signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            }

            return(signupResponse);
        }
예제 #3
0
        private static Signup_Result UserTags_Validation(TMConfig config, UserTag tag)
        {
            var signupResponse = new Signup_Result();
            var validationList = tag.validate();

            signupResponse.Signup_Status = Signup_Result.SignupStatus.Validation_Failed;
            signupResponse.UserCreated   = 0;
            if (!config.showDetailedErrorMessages())
            {
                signupResponse.Simple_Error_Message = config.TMErrorMessages.General_SignUp_Error_Message;
            }
            else
            {
                foreach (var validation in validationList)
                {
                    signupResponse.Validation_Results.Add(new Validation_Results {
                        Field = validation.ToString(), Message = validation.ErrorMessage
                    });
                }
            }
            return(signupResponse);
        }