Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //EditUser
- private ListItemCollection LoadProfession()
- {
- var items = new ListItemCollection
- {
- new ListItem("Välj"),
- new ListItem("Läkare", "läkare"),
- new ListItem("Sjuksköterska", "sjuksköterska"),
- new ListItem("Övrig hälso- och sjukvårdspersonal", "övrig personal"),
- new ListItem("Annat", "annat")
- };
- return items;
- }
- private void LoadUserSettings()
- {
- EPiServerProfile profile = EPiServerProfile.Get(Page.User.Identity.Name);
- txtEditName.Value = profile["RegisterUser.Name"] as string;
- txtEditAddress.Value = profile["RegisterUser.Address"] as string;
- txtEditPostalCode.Value = profile["RegisterUser.PostalCode"] as string;
- txtEditCity.Value = profile["RegisterUser.City"] as string;
- dropDownEditProfession.SelectedValue = profile["RegisterUser.Profession"] as string;
- }
- public void EditUser()
- {
- string newPassword = string.Empty;
- if (!string.IsNullOrEmpty(txtPassword.Value) && !string.IsNullOrEmpty(txtConfirmPassword.Value))
- {
- if (txtPassword.Value == txtConfirmPassword.Value)
- {
- newPassword = txtPassword.Value;
- }
- else
- {
- editMessages.AddError("De båda fälten för lösenord måste överrensstämma");
- }
- }
- EPiServerProfile profile = EPiServerProfile.Get(Page.User.Identity.Name);
- profile.SetPropertyValue("RegisterUser.AccountType", Request.Form["account-type"]);
- profile.SetPropertyValue("RegisterUser.Name", txtName.Value);
- profile.SetPropertyValue("RegisterUser.Address", txtAddress.Value);
- profile.SetPropertyValue("RegisterUser.PostalCode", txtPostalCode.Value);
- profile.SetPropertyValue("RegisterUser.City", txtCity.Value);
- profile.SetPropertyValue("RegisterUser.Profession", dropDownProfession.SelectedValue);
- if (!string.IsNullOrEmpty(newPassword))
- {
- MembershipUser user = Membership.GetUser(Page.User.Identity.Name);
- user.ChangePassword(user.ResetPassword(), newPassword);
- }
- editMessages.AddConfirmation("Ändringarna sparades");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement