예제 #1
0
        public static Usuario GetUserById(int IdUser)
        {
            UsuarioTableAdapter localAdapter = new UsuarioTableAdapter();

            if (IdUser <= 0)
            {
                return(null);
            }

            Usuario theUser = null;

            try
            {
                UsuarioDS.UsuarioDataTable table = localAdapter.GetUsuarioById(IdUser);

                if (table != null && table.Rows.Count > 0)
                {
                    UsuarioDS.UsuarioRow row = table[0];
                    theUser = FillUserRecord(row);
                }
            }
            catch (Exception q)
            {
                log.Error("An error was ocurred while geting user data", q);
                return(null);
            }

            return(theUser);
        }
예제 #2
0
        public static Usuario GetUsuarioById(int idUsuario)
        {
            UsuarioTableAdapter adapter = new UsuarioTableAdapter();
            UsuarioDataTable    table   = adapter.GetUsuarioById(idUsuario);

            if (table.Rows.Count == 0)
            {
                return(null);
            }

            UsuarioRow row = table[0];
            Usuario    obj = new Usuario()
            {
                IdUsuario      = row.idUsuario,
                NombreCompleto = row.nombreCompleto,
                Email          = row.email,
                Password       = row.password,
                Telefono       = row.telefono,
                Direccion      = row.direccion
            };

            return(obj);
        }