Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- =============================================
  2. -- Author:      <Author,,Name>
  3. -- Create date: <Create Date,,>
  4. -- Description: <Description,,>
  5. -- =============================================
  6. ALTER PROCEDURE [dbo].[GNN_GetParametrizacionUsuarios]
  7.     -- Add the parameters for the stored procedure here
  8.     @Username nvarchar(max) = null,
  9.     @NonBlocked int = 0 --1 para traer los no bloqueados
  10. AS
  11. BEGIN
  12.  
  13. /*
  14. if(@Username is null)
  15. begin
  16.     SELECT    u.Username
  17.             ,u.FirstName
  18.             ,u.LastName
  19.             ,dbo.GNN_RolesXUsuarios(u.Username) as Roles
  20.             ,'False' as RamoGenerales
  21.             , 'False' as RamoVida
  22.             , 'False' as RamoAutos
  23.             ,'False' as TipoSolicitudNegocioNuevo
  24.             , 'False' as TipoSolicitudAnexos
  25.             , 'False' as TipoSolicitudCorreciones
  26.             , 'False' as TipoSolicitudRenovaciones
  27.             , 'False' as PrioridadUrgente
  28.             , 'False' as PrioridadNormal
  29.             ,'False' as SolicitudMultipleSi
  30.             , 'False' as SolicitudMultipleNo
  31.             ,'False' as TiposAnexoCorrecion
  32.             , 'False' as TiposAnexoActualizacion
  33.             ,'False' as TiposAnexoModificacionConValor
  34.             ,'False' as TiposAnexoModificacionSinValor
  35.             ,'False' as TiposAnexoCancelacionAnulacion
  36.             , 'False' as TiposCorrecionExterna
  37.             ,'False' as TiposCorrecionInterna
  38. FROM         DNN_Users u
  39. Inner Join DNN_UserRoles UR
  40. ON u.UserID = UR.UserID
  41.  Inner Join DNN_Roles R
  42.             ON UR.RoleID = R.RoleID
  43.             AND R.RoleName = 'CentroExpedicion'
  44.            
  45. order by username
  46. end
  47. else
  48. begin
  49. */
  50.     SELECT    u.Username
  51.             ,u.FirstName
  52.             ,u.LastName
  53.             ,dbo.GNN_RolesXUsuarios(u.Username) as Roles
  54.             ,Coalesce(Min(Case PropertyName When 'RamoGenerales' Then PropertyValue  End), 'False') as RamoGenerales
  55.             ,Coalesce(Min(Case PropertyName When 'RamoVida' Then PropertyValue End), 'False') as RamoVida
  56.             ,Coalesce(Min(Case PropertyName When 'RamoAutos' Then PropertyValue End), 'False') as RamoAutos
  57.             ,Coalesce(Min(Case PropertyName When 'TipoSolicitudNegocioNuevo' Then PropertyValue End), 'False') as TipoSolicitudNegocioNuevo
  58.             ,Coalesce(Min(Case PropertyName When 'TipoSolicitudAnexos' Then PropertyValue End), 'False') as TipoSolicitudAnexos
  59.             ,Coalesce(Min(Case PropertyName When 'TipoSolicitudCorreciones' Then PropertyValue End), 'False') as TipoSolicitudCorreciones
  60.             ,Coalesce(Min(Case PropertyName When 'TipoSolicitudRenovaciones' Then PropertyValue End), 'False') as TipoSolicitudRenovaciones
  61.             ,Coalesce(Min(Case PropertyName When 'PrioridadUrgente' Then PropertyValue End), 'False') as PrioridadUrgente
  62.             ,Coalesce(Min(Case PropertyName When 'PrioridadNormal' Then PropertyValue End), 'False') as PrioridadNormal
  63.             ,Coalesce(Min(Case PropertyName When 'SolicitudMultipleSi' Then PropertyValue End), 'False') as SolicitudMultipleSi
  64.             ,Coalesce(Min(Case PropertyName When 'SolicitudMultipleNo' Then PropertyValue End), 'False') as SolicitudMultipleNo
  65.             ,Coalesce(Min(Case PropertyName When 'TiposAnexoCorrecion' Then PropertyValue End), 'False') as TiposAnexoCorrecion
  66.             ,Coalesce(Min(Case PropertyName When 'TiposAnexoActualizacion' Then PropertyValue End), 'False') as TiposAnexoActualizacion
  67.             ,Coalesce(Min(Case PropertyName When 'TiposAnexoModificacionConValor' Then PropertyValue End), 'False') as TiposAnexoModificacionConValor
  68.             ,Coalesce(Min(Case PropertyName When 'TiposAnexoModificacionSinValor' Then PropertyValue End), 'False') as TiposAnexoModificacionSinValor
  69.             ,Coalesce(Min(Case PropertyName When 'TiposAnexoCancelacionAnulacion' Then PropertyValue End), 'False') as TiposAnexoCancelacionAnulacion
  70.             ,Coalesce(Min(Case PropertyName When 'TiposCorrecionExterna' Then PropertyValue End), 'False') as TiposCorrecionExterna
  71.             ,Coalesce(Min(Case PropertyName When 'TiposCorrecionInterna' Then PropertyValue End), 'False') as TiposCorrecionInterna
  72.            
  73. FROM         DNN_Users u INNER JOIN
  74.                       DNN_UserProfile ON u.UserID = DNN_UserProfile.UserID INNER JOIN
  75.                       DNN_ProfilePropertyDefinition ON DNN_UserProfile.PropertyDefinitionID = DNN_ProfilePropertyDefinition.PropertyDefinitionID
  76.                      
  77. Inner Join DNN_UserRoles UR
  78. ON u.UserID = UR.UserID
  79.                       Inner Join DNN_Roles R
  80.             ON UR.RoleID = R.RoleID
  81.             AND R.RoleName = 'CentroExpedicion'
  82. Inner Join vw_aspnet_MembershipUsers m
  83. ON u.UserName = m.UserName
  84. AND (m.IsLockedOut = 0 or @NonBlocked = 0)
  85. AND (lower(IsNull(dbo.GetPropertyValueForUser(u.UserID, 'TieneInstancias'), 'false')) = 'false' or @NonBlocked = 0)
  86. where u.UserName = @Username or @Username is null
  87.  
  88.  
  89. group by u.Username,
  90.             u.FirstName,
  91.             u.LastName
  92.            
  93. --end
  94. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement