protected void btnLogin_Click(object sender, EventArgs e) { Boolean bOk = true; string sCod_Usuario = txtsCod_Usuario.Text.Trim(); string sPSW = txtsPSW.Text.Trim(); //sCod_Usuario = "edeortuzar"; //sPSW = "INIT"; if (sCod_Usuario.Length == 0 || sPSW.Length == 0) { LbMensaje.Text = "Debe completar el campo Usuario y el campo Constraseña."; bOk = false; } if (bOk) { TuCuento.Entidades.Usuario oUsuario = new TuCuento.Entidades.Usuario(); TuCuento.Negocio.Usuario_NEG oNegocio = new TuCuento.Negocio.Usuario_NEG(); oUsuario = oNegocio.ValidarUsuario(sCod_Usuario, sPSW); if (oUsuario.sCod_Usuario != null) { Session["oUsuario"] = oUsuario; Response.Redirect("default.aspx"); } else { Session["oUsuario"] = null; LbMensaje.Text = "El usuario y/o la contraseña son incorrectos."; } } }
protected void btnAceptar_Click(object sender, EventArgs e) { Master.MensajeError = ""; if (Validar()) { TuCuento.Entidades.Usuario oUsuario = new TuCuento.Entidades.Usuario(); TuCuento.Negocio.Usuario_NEG oNegocio = new TuCuento.Negocio.Usuario_NEG(); oUsuario = oNegocio.ValidarUsuario(Master.sCod_Usuario, txtPswOLD.Text.Trim()); if (oUsuario.sCod_Usuario != null) { //Actualizo la contraseña a la nueva contraseña oUsuario.sPSW = txtPsw.Text.Trim(); } else { LbMensaje.Text = "La contraseña actual especificada es incorrecta."; return; } if (TuCuento.Negocio.Usuario_NEG.ActualizarPSW(oUsuario)) { pnlRegistro.Visible = false; pnlResultado.Visible = true; LbMensajeFinal.Text = "La contraseña se modifico correctamente."; } else LbMensaje.Text = "Ocurrio un error al actualizar los datos"; } }
protected void btnAceptar_Click(object sender, EventArgs e) { Master.MensajeError = ""; if (Validar()) { TuCuento.Entidades.Usuario oUsuario = new TuCuento.Entidades.Usuario(); TuCuento.Negocio.Usuario_NEG oNegocio = new TuCuento.Negocio.Usuario_NEG(); oUsuario = oNegocio.ValidarUsuario(Master.sCod_Usuario, txtPswOLD.Text.Trim()); if (oUsuario.sCod_Usuario != null) { //Actualizo la contraseña a la nueva contraseña oUsuario.sPSW = txtPsw.Text.Trim(); } else { LbMensaje.Text = "La contraseña actual especificada es incorrecta."; return; } if (TuCuento.Negocio.Usuario_NEG.ActualizarPSW(oUsuario)) { pnlRegistro.Visible = false; pnlResultado.Visible = true; //Envio el mail de que se modifico la contraseña string bodyHTML = string.Empty; string sCod_Usuario = Master.sCod_Usuario; Funciones oFunc = new Funciones(); bodyHTML = @"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'> <html lang='es'> <head> </head> <body> <table style='width:800px; border:1px solid #000;' cellpadding='10' cellspacing='0' align='center'> <tr> <td style='background-color:#3399FF; border-bottom:1px solid #000;'> <h1 style='text-align:center; color:#ffffff;'>TuCuento.com.ar</h1></td> </tr> <tr> <td style='border-right:1px solid #000; vertical-align:top; background-color:#FFFFFF;'> <h4 style='font-family:Arial, Helvetica, sans-serif;color:#000;'>Se ha cambiado su contraseña. La nueva contraseña es"; bodyHTML = bodyHTML + oUsuario.sPSW + @"</h4> </td> </tr> <tr> <td colspan='2' style='background-color:#3399FF; color:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-size:.8em; border-top:1px solid #000;'>Copyright (c) 2010. TuCuento.com.ar</td> </tr> </body> </html>"; if (oFunc.EnviarMail(oUsuario.sEmail, "*****@*****.**", bodyHTML, "TuCuento - Cambio de contraseña")) { LbMensajeFinal.Text = "La contraseña se modifico correctamente."; } else { LbMensajeFinal.Text = "La contraseña se modifico correctamente."; } } else LbMensaje.Text = "Ocurrio un error al actualizar los datos"; } }