Esempio n. 1
0
        protected void btnCambiaContrasena_Click(object sender, EventArgs e)
        {
            svcSCPP.SCPPClient svc         = new svcSCPP.SCPPClient();
            string             User        = NomUsuario.Text;
            string             ContraAnt   = ContrasenaAnt.Text;
            string             ContraNueva = ContrasenaNueva.Text;



            LAMOSA.SCPP.Server.BusinessEntity.ContrasenaL C = new LAMOSA.SCPP.Server.BusinessEntity.ContrasenaL();

            try
            {
                C.Usuario         = User;
                C.Contrasena      = ContraAnt;
                C.ContrasenaNueva = ContraNueva;
                C = svc.CambiarContrasenaLogin(C);
                string msj = C.ExceptionMessage;
                if (C.ExceptionMessage != null && C.ExceptionMessage.Length > 30)
                {
                    CallBackManager.AddScriptBlock(this.Page, WebAsyncRefreshPanel1, "<script type='text/javascript'>alert('" + C.ExceptionMessage + "');</script>");
                }
                else
                {
                    CallBackManager.AddScriptBlock(this.Page, WebAsyncRefreshPanel1, "<script type='text/javascript'>alert('" + C.ExceptionMessage + "');</script>");
                }
            }
            catch (Exception err)
            {
                CallBackManager.AddScriptBlock(this.Page, WebAsyncRefreshPanel1, "<script type='text/javascript'>alert('" + err.Message + "');</script>");
            }
        }
Esempio n. 2
0
 private bool CambiarContrasena()
 {
     svcSCPP.SCPPClient svc = null;
     LAMOSA.SCPP.Server.BusinessEntity.ContrasenaL contrasena = new LAMOSA.SCPP.Server.BusinessEntity.ContrasenaL();
     try
     {
         svc = new svcSCPP.SCPPClient();
         contrasena.Usuario         = this.txtUsuario.Text.Trim();
         contrasena.Contrasena      = this.txtPassword.Text.Trim();
         contrasena.ContrasenaNueva = this.tbContrasenaUsuarioNueva.Text.Trim();
         contrasena = svc.CambiarContrasenaLogin(contrasena);
         if (contrasena.ExceptionMessage == "La contraseña ha sido cambiada exitosamente")
         {
             Page.RegisterStartupScript("MensajeAviso", "<script>alert('" + contrasena.ExceptionMessage + "');</script>");
             return(true);
         }
         if (contrasena.ExceptionMessage != null && contrasena.ExceptionMessage.Length > 30)
         {
             Page.RegisterStartupScript("MensajeAviso", "<script>alert('" + contrasena.ExceptionMessage + "');</script>");
             return(false);
         }
         else
         {
             Page.RegisterStartupScript("MensajeAviso", "<script>alert('" + contrasena.ExceptionMessage + "');</script>");
             return(false);
         }
     }
     catch (Exception err)
     {
         Page.RegisterStartupScript("MensajeAviso", "<script>alert('" + err.Message + "');</script>");
         return(false);
     }
     finally
     {
         svc = null;
     }
 }