protected void ibtnSubmit_Click(object sender, EventArgs e) { try { string sQuestion; if(!string.IsNullOrEmpty(ddlSecurityQuestion.SelectedValue)) { sQuestion = ddlSecurityQuestion.SelectedValue; } else { sQuestion = txtOtherSecurityQuestion.Text; } string sAnswer = txtAnswer.Text; if (sAnswer.Trim().Length == 0) { lblMessage.Text = "Debe ingresar una respuesta"; return; } // Comprobar la contraseña con el usuario logueado AdamHelper MemberProv = new AdamHelper(); string sUser; sUser = SPContext.Current.Web.CurrentUser.LoginName; string sPassword = txtPwd.Text.Trim(); if (MemberProv.ValidateUser(sUser.Substring(sUser.IndexOf(":") + 1), sPassword)) { // Update in Profile!! BLL.UserBLL MyUserBLL = new BLL.UserBLL(SPContext.Current.Web); Entities.User MyUser = MyUserBLL.GetUser(sUser); MyUser.SecurityQuestion = sQuestion; MyUser.SecurityAnswer = sAnswer; MyUserBLL.ModifyUser(MyUser); ibtnSubmit.Enabled = false; lblMessage.Text = "La pregunta de seguridad se ha actualizado correctamente"; } else { lblMessage.Text = "Uno o más datos requeridos no han sido diligenciados correctamente"; // "La contraseña no es correcta"; } } catch (Exception Ex) { CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(Ex, ref lblMessage, ConfigurationSettings.AppSettings["LogInEventViewer"]); } }
protected void btnModify_Click(object sender, EventArgs e) { try { SPWeb web = SPContext.Current.Web; AssignDataToEntity(); BLL.UserBLL userBLL = new BLL.UserBLL(web); userBLL.ModifyUser(UserEntity); lblError.Text = "Los cambios fueron guardados con éxito. "; lblError.Visible = true; lnkGoHome.Visible = true; } catch (Exception ex) { CAFAM.WebPortal.ErrorLogger.ErrorLogger.Log(ex, ref lblError, ConfigurationSettings.AppSettings["LogInEventViewer"]); } }