public
static
void
CreateDealerUserProfile(UserOfDealerEntity entity)
{
UserInfo ui =
new
UserInfo();
ui.FirstName = entity.FirstName;
ui.LastName = entity.LastName;
ui.DisplayName = ui.FirstName +
" "
+ ui.LastName;
ui.Email = entity.Email;
ui.Username = entity.UserName;
ui.PortalID = 0;
ui.Membership.Email = entity.Email;
ui.Membership.Approved =
true
;
ui.Membership.Password = entity.Password;
ui.Membership.UpdatePassword =
true
;
ui.Membership.Username = entity.UserName;
UserCreateStatus status = UserController.CreateUser(
ref
ui);
if
(status == UserCreateStatus.AddUser || status == UserCreateStatus.Success)
{
RoleController rc =
new
RoleController();
RoleInfo ri = rc.GetRoleByName(0,
"Dealer User"
);
rc.AddUserRole(0, ui.UserID, ri.RoleID, Null.NullDate);
UserInfo newui = UserController.GetUser(0, ui.UserID,
false
);
UserProfile up =
new
UserProfile();
newui.Profile.SetProfileProperty(
"DealerName"
, entity.Dealer.ToString());
newui.Profile.Telephone = entity.PhoneNumber;
newui.Profile.SetProfileProperty(
"Position"
, entity.Position);
UserController.UpdateUser(0, newui);
}
}