//protected void CreateUserWizard1_ActiveStepChanged(object sender, EventArgs e) //{ // // Have we JUST reached the Complete step? // if (CreateUserWizard1.ActiveStep.Title == "Completar") // { // // Reference the SpecifyRolesStep WizardStep // WizardStep SpecifyRolesStep = CreateUserWizard1.FindControl("SpecifyRolesStep") as WizardStep; // // Reference the RoleList CheckBoxList // RadioButtonList RoleList = SpecifyRolesStep.FindControl("RoleList") as RadioButtonList; // // Add the checked roles to the just-added user // foreach (ListItem li in RoleList.Items) // { // if (li.Selected) // Roles.AddUserToRole(CreateUserWizard1.UserName, li.Text); // } // } //} protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e) { Repositorio repo = new Repositorio(); DataSet dset = new DataSet(); dset.Tables.Add(); dset.Tables[0].Rows.Add(); dset.Tables[0].Columns.Add("username"); dset.Tables[0].Columns.Add("usuario"); dset.Tables[0].Columns.Add("id_institucion"); dset.Tables[0].Rows[0]["usuario"] = CreateUserWizard1.UserName; dset.Tables[0].Rows[0]["username"] = User.Identity.Name; CreateUserWizardStep wizardStep = CreateUserWizard1.FindControl("CreateUserWizardStep1") as CreateUserWizardStep; if (Roles.IsUserInRole("administrador") || Roles.IsUserInRole("admin_regional")) { HiddenField institucionHidden = wizardStep.ContentTemplateContainer.FindControl("HiddenInstalacionId") as HiddenField; dset.Tables[0].Rows[0]["id_institucion"] = institucionHidden.Value; } else { //obtener institucion de usuario actual dset.Tables[0].Rows[0]["id_institucion"] = repo.ObtenerIdInstalacionPorNombreUsuario(User.Identity.Name).Tables[0].Rows[0].ItemArray[0]; } repo.InsertarInstalacionUsuario(dset); TextBox nombre = wizardStep.ContentTemplateContainer.FindControl("Nombre") as TextBox; TextBox apellido = wizardStep.ContentTemplateContainer.FindControl("Apellido") as TextBox; ProfileUser pc = ProfileUser.GetUserProfile(CreateUserWizard1.UserName); //ProfileBase pc = ProfileCommon.Create(CreateUserWizard1.UserName, true); pc.FirstName = nombre.Text; pc.LastName = apellido.Text; pc.Save(); }
void populateUsersGridView() { /* UsersGridView.DataSource = null; UsersGridView.DataBind();*/ Repositorio repo = new Repositorio(); if (!(Roles.IsUserInRole("administrador")) && !(Roles.IsUserInRole("admin_regional"))) UsersGridView.DataSource = repo.UsuarioPorRolEInstalacion(RolesDropDown.SelectedValue, Convert.ToInt32(repo.ObtenerIdInstalacionPorNombreUsuario(User.Identity.Name).Tables[0].Rows[0].ItemArray[0])); else UsersGridView.DataSource = repo.UsuarioPorRolEInstalacion(RolesDropDown.SelectedValue, Convert.ToInt32 (instalacionDropDown.SelectedValue) ); //UsersGridView.DataSource = Roles.GetUsersInRole(RolesDropDown.SelectedValue); UsersGridView.DataBind(); }