Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- DESCRIPTION Present a user from our user database with a picture in a nice format, a bit like a business card.
- USEDFROM Wiki
- CREATER Henning C. Nielsen
- CREATED 20110524
- */
- alter proc spDlt_UserCard
- @attributes varchar(max)
- as
- begin
- -- SET NOCOUNT ON added to prevent extra result sets from
- -- interfering with SELECT statements.
- set nocount on;
- -- Find the user id.
- declare @userID as int
- if isnumeric(@attributes) = 1
- set @userID = cast(@attributes as int)
- else
- set @userID = (select u.UserID from vwUser u where lower(u.Username) = lower(ltrim(rtrim(@attributes))))
- if not exists (select 1 from vwUser where UserID = @userID)
- raiserror('User was not found', 1, 1)
- -- Select the stylesheets used to represent active projects.
- select '<style type="text/css">'
- + ' div.usercard { float:right; font-size: 10pt; background-color: #EBF6FD; padding: 10px; width: 375px }'
- + ' div.usercard div.name { font-weight: bold; }'
- + ' div.usercard div.title { margin-bottom: 10px; white-space: nowrap; }'
- + ' div.usercard img { float: right; }'
- + '</style>'
- -- Select the HTML
- select '<div class="usercard"><img src="' + dbo.fnGravatar(u.Email, 110, default) + '" class="gravatar" />'
- + '<div class="info">'
- + '<div class="name">'
- + u.Name + '<br />'
- + '</div>'
- + '<div class="title">'
- + (select isnull(t.InfoString, '') from UserInfo t where t.InfoTypeID = 27 and t.UserID = @userID) + '<br />'
- -- + '</div>'
- -- + 'Mail: <a href="mailto:' + u.Email + '">' + u.Email + '</a><br />'
- -- + 'Phone: ' + (select isnull(p.InfoString, '') from UserInfo p where p.InfoTypeID = 1 and p.UserID = @userID) + '<br />'
- -- + 'Mobile: ' + (select isnull(m.InfoString, '') from UserInfo m where m.InfoTypeID = 3 and m.UserID = @userID)
- --+ '</div>'
- + '</div>' -- , u.Name
- from vwUser u
- left join tbUserData d on d.UserID = u.UserID
- where u.UserID = @userID
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement