void ICardHolderService.CreateSystemAdmin(String UserName, String Password, String SecondPassword) { MembershipCreateStatus status; if (String.IsNullOrEmpty(UserName)) { throw new ArgumentException("Value cannot be null or empty.", "userName"); } if (String.IsNullOrEmpty(Password)) { throw new ArgumentException("Value cannot be null or empty.", "password"); } if (String.IsNullOrEmpty(SecondPassword)) { throw new ArgumentException("Value cannot be null or empty.", "email"); } // first make sure that super user role exists IRolesDAO RoleService = new RolesDAO(); RoleService.InsureSuperUserRoleExists(_provider.ApplicationName); // then add the super user to the list of users MembershipUser user = _provider.CreateUser(UserName, Password, UserName + "@system", null, null, true, null, out status); if (user == null) { throw new Exception("Problems in creating user"); } // then add super user to users in roles IUserInRolesDAO UserInRoleRepository = new UserInRolesDAO(); UserInRoleRepository.AddUserToRole(UserName, "SystemAdministrator", _provider.ApplicationName); // then save the second password by creating a new user with name "secondPassword" user = _provider.CreateUser(UserName + "SecondPassword", SecondPassword, UserName + "*****@*****.**", "", //WebData.passwordQuestion, "", //WebData.passwordAnswer, true, //WebData.isApproved, null, //WebData.providerUserKey, out status); }