public MensajeResultado getCambio_PasswordUsuario(Usuario_PasswordDTO USUARIO)
        {
            MensajeResultado MensajeResultado = new MensajeResultado();
            //ListaUsuarioEmpresaDTO = null;
            string        cnxString = _appDBContext.Database.GetConnectionString();
            SqlConnection cnx       = new SqlConnection(cnxString);

            try
            {
                cnx.Open();
                using (SqlCommand Sqlcmd = new SqlCommand())
                {
                    Sqlcmd.Connection  = cnx;
                    Sqlcmd.CommandType = CommandType.StoredProcedure;
                    Sqlcmd.CommandText = "SP_TX_Usuario_Cambio_password_21";
                    Sqlcmd.Parameters.Clear();
                    Sqlcmd.Parameters.Add("@CodUsuario", SqlDbType.VarChar, 20).Value   = USUARIO.cod_usuario;
                    Sqlcmd.Parameters.Add("@Des_Password", SqlDbType.VarChar, 15).Value = USUARIO.des_Password;
                    Sqlcmd.Parameters.Add("@Old_Password", SqlDbType.VarChar, 15).Value = USUARIO.old_Password;


                    SqlDataReader oDataReader = Sqlcmd.ExecuteReader();
                    while (oDataReader.Read())
                    {
                        MensajeResultado.mensaje   = oDataReader["mensaje"].ToString();
                        MensajeResultado.resultado = int.Parse(oDataReader["resultado"].ToString());
                    }
                }
            }
            catch (SqlException sex)
            {
                eErrorLog mensajeLogError = new eErrorLog(
                    sex.Message, "UsuarioRepository/getCambio_PasswordUsuario(). SQL." + sex, "Error Sql");
                mensajeLogError.RegisterLog();
            }
            catch (Exception ex)
            {
                eErrorLog mensajeLogError = new eErrorLog(ex.Message, "UsuarioRepository/getCambio_PasswordUsuario() EX." + ex, "Error");
                mensajeLogError.RegisterLog();
            }
            finally
            {
                if (cnx.State == System.Data.ConnectionState.Open)
                {
                    cnx.Close();
                }
            }


            return(MensajeResultado);
        }
Пример #2
0
        /// [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
        public async Task <IActionResult> GETCambioNuevoUsuario(Usuario_PasswordDTO USUARIO)
        {
            try
            {
                {
                    //var identity = HttpContext.User.Identity as ClaimsIdentity;
                    //int idUsuario = JwtConfigurator.GetTokenIdUsuario(identity);

                    var MENSAJE = await _usuarioService.Cambio_PasswordUsuario(USUARIO);

                    return(Ok(MENSAJE));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <MensajeResultado> Cambio_PasswordUsuario(Usuario_PasswordDTO USUARIO)
        {
            var mensaje = getCambio_PasswordUsuario(USUARIO);

            return(mensaje);
        }
 public async Task <MensajeResultado> Cambio_PasswordUsuario(Usuario_PasswordDTO USUARIO)
 {
     return(await _usuarioRepository.Cambio_PasswordUsuario(USUARIO));
 }