protected void btnGuardar_Click(object sender, EventArgs e) { try { EPARAMETROSGENERALES obj = new EPARAMETROSGENERALES(); obj.DOMINIO = Utiles.ConvertToString(this.txtDominio.Text); obj.PUERTO = Utiles.ConvertToString(this.txtPuerto.Text); obj.EMAIL = Utiles.ConvertToString(this.txtUsuario.Text); obj.PASSWORD = Utiles.ConvertToString(this.txtPassword.Text); obj.SMTP = Utiles.ConvertToString(this.txtSMTP.Text); obj.NOMBRE_CLASIFICADOR_1 = Utiles.ConvertToString(this.txtNombreClasificador1.Text); obj.NOMBRE_CLASIFICADOR_2 = Utiles.ConvertToString(this.txtNombreClasificador2.Text); obj.URL_PLATAFORMA = Utiles.ConvertToString(this.txtUrlPlataforma.Text); obj.IsPersisted = true; BFPARAMETROSGENERALES objBFPG = new BFPARAMETROSGENERALES(); objBFPG.Save(obj); ScriptManager.RegisterStartupScript(this, this.GetType(), "SessionUsuario", "alert('Los datos han sido ingresados exitosamente.');", true); } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }
protected void btnRecuperar_Click(object sender, EventArgs e) { if (this.txtRut.Text == "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "alerta", "alert('ATENCION: Debe ingresar el Rut del usuario');", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); return; } if (Utiles.ValidarRut(this.txtRut.Text) != true) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alerta", "alert('ATENCION: El Rut ingresado no es valido');", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); return; } if (this.txtCaptcha.Text == "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "alerta", "alert('ATENCION: Debe ingresar el texto de la imagen');", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); return; } BFUSUARIO objBFUS = new BFUSUARIO(); EUSUARIO objUS = objBFUS.GetUSUARIO(Utiles.RutUsrALng(this.txtRut.Text)); if (objUS.RUTUSUARIO != Utiles.RutUsrALng(this.txtRut.Text)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alerta", "alert('ATENCION: El Rut ingresado no se encuentra registrado en el sistema');", true); ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); return; } char separador = '/'; string[] arrTmp = imgCaptcha.ImageUrl.Split(separador); separador = '.'; string[] arrTmp2 = arrTmp[arrTmp.Length - 1].Split(separador); string strcaptcha = arrTmp2[0]; if (this.txtCaptcha.Text == strcaptcha) { string Asunto = "Recuperación de contraseña"; string Body = "Estimado " + objUS.NOMBRECOMPLETO + "<br /><br />Tus datos de acceso a la plataforma de evaluación del desempeño son:<br /><br />Usuario: " + objUS.RUTCOMPLETO + "<br />Clave: " + CCryptografia.Desencriptar(objUS.PASSWORD) + "<br /><br />Saludos cordiales."; BFPARAMETROSGENERALES objBFPA = new BFPARAMETROSGENERALES(); EPARAMETROSGENERALES objPA = objBFPA.GetPARAMETROSGENERALESAll()[0]; Utiles.EnviarCorreo(objPA.DOMINIO, objPA.SMTP, objPA.EMAIL, objPA.PASSWORD, objPA.PUERTO, objUS.EMAIL, Asunto, Body); this.txtRut.Text = ""; this.txtCaptcha.Text = ""; ScriptManager.RegisterStartupScript(this, this.GetType(), "alerta", "alert('ATENCION: La contraseña ha sido enviada a su correo');", true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alerta", "alert('ATENCION: El dato ingresado no coincide con el captcha');", true); } ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('1');", true); }
protected void Cargar() { try { BFPARAMETROSGENERALES objBFPG = new BFPARAMETROSGENERALES(); EPARAMETROSGENERALES obj = objBFPG.GetPARAMETROSGENERALESAll()[0]; this.txtDominio.Text = obj.DOMINIO; this.txtPuerto.Text = obj.PUERTO; this.txtUsuario.Text = obj.EMAIL; this.txtSMTP.Text = obj.SMTP; this.txtPassword.Text = obj.PASSWORD; this.txtNombreClasificador1.Text = obj.NOMBRE_CLASIFICADOR_1; this.txtNombreClasificador2.Text = obj.NOMBRE_CLASIFICADOR_2; this.txtUrlPlataforma.Text = obj.URL_PLATAFORMA; } catch (Exception ex) { Log log = new Log(); log.EscribirLog(ex); litCatchError.Visible = true; ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "Menu('0');", true); } }