Click here to Skip to main content
15,885,365 members
Articles / Web Development / ASP.NET

Using Silverlight in Enterprise: RAD of User Friendly Database Access

Rate me:
Please Sign up or sign in to vote.
4.81/5 (19 votes)
31 Jul 2009CPOL8 min read 58.1K   7K   81  
This article introduces FulcrumWeb RAD Framework - A Silverlight UI Engine to build user friendly database driven applications
if exists (select * 
             from dbo.sysobjects 
            where id = object_id(N'[dbo].[tr_Framework_Users_InsUpdDel]') 
              and objectproperty(id, N'IsTrigger') = 1)
  drop trigger [dbo].[tr_Framework_Users_InsUpdDel]
go

create trigger dbo.tr_Framework_Users_InsUpdDel
on dbo.Framework_Users
for insert, update, delete
as 
begin
  update Framework_Users
     set DeactivatedDate = getdate()
    from Framework_Users u
   inner join inserted i
      on u.UserId = i.UserId
   where isnull(u.IsDeactivated, 0) = 1
     and u.DeactivatedDate is null
    
  update Framework_Users
     set DeactivatedDate = null
    from Framework_Users u
   inner join inserted i
      on u.UserId = i.UserId
   where isnull(u.IsDeactivated, 0) = 0
     and u.DeactivatedDate is not null

  declare @InsCount int,
          @DelCount int
  
  select @InsCount = count(*)
    from inserted
  
  select @DelCount = count(*)
    from deleted
  
  if @InsCount > 0 and @DelCount = 0
  begin
    declare @EveryoneRoleId UDT_OBJID
    
    select @EveryoneRoleId = r.RoleId
      from Framework_Roles r
     where r.SpecialCategory = 'Everyone'

    if @EveryoneRoleId is not null
    begin
      insert into Framework_UserRoles (UserId, RoleId)
      select i.UserId,
             @EveryoneRoleId
        from inserted i
    end
  end
  
end
go

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions