public static void AddUser(SBSUser user) { UserPrincipal userPrincipal = new UserPrincipal(Context); //if (lastName != null && lastName.Length > 0) userPrincipal.Surname = user.UserName; //if (firstName != null && firstName.Length > 0) userPrincipal.GivenName = user.UserName; //if (employeeID != null && employeeID.Length > 0) // userPrincipal.EmployeeId = employeeID; //if (emailAddress != null && emailAddress.Length > 0) userPrincipal.EmailAddress = user.Email; //if (telephone != null && telephone.Length > 0) // userPrincipal.VoiceTelephoneNumber = telephone; //if (userLogonName != null && userLogonName.Length > 0) userPrincipal.SamAccountName = user.UserName; string pwdOfNewlyCreatedUser = user.PassWord; userPrincipal.SetPassword(pwdOfNewlyCreatedUser); userPrincipal.Enabled = true; userPrincipal.ExpirePasswordNow(); userPrincipal.Save(); }
public static SBSUser CreateUser(string UserName, string PassWord, string Email) { Logger.WriteLine("Creat user with UserName: "******"publishing SBSUserAddedEvent"); //SBSEventProvider.FireSBSUserAddedEvent(newUser.userId); //SBSUserAddedEvent.Publish(newUser.userId); Logger.WriteLine("publishedddd SBSUserAddedEvent"); } catch (Exception e) { Logger.WriteLine(e.ToString()); } Logger.WriteLine("Created user with UserName: " + UserName); return(newUser); }
public static SBSUser CreateUser(string UserName,string PassWord,string Email) { Logger.WriteLine("Creat user with UserName: "******"publishing SBSUserAddedEvent"); SBSEventProvider.FireSBSUserAddedEvent(newUser.userId); //SBSUserAddedEvent.Publish(newUser.userId); Logger.WriteLine("publishedddd SBSUserAddedEvent"); } catch (Exception e) { Logger.WriteLine(e.ToString()); } Logger.WriteLine("Created user with UserName: " + UserName); return newUser; }