Good, I would like you to help me, I'm doing programming language asp.net c # and sql server roles and user permissions:
I have these following tables in Sql Server:
Table Roles
ID_Roles Rol_Cargo Rol_Estado
1 ADMINISTRADOR 1
2 LOGISTICA 1
3 LIMA 1
4 JOS 1
User Table
ID_Usuario Usu_Username Usu_Pass Usu_Estado
1 pflores 123456 1
2 CMARALLANO 123456 1
3 DCOLLANTES 123456 1
4 DYLLESCAS 123456 1
Table User_Roles
ID_Usuario_Roles ID_Usuario ID_Roles
1 1 1
2 2 2
3 3 3
4 4 4
Table Menu
ID_Menu Men_Nombres Men_Estado
1 Registrar Servicios Red Lima 1
2 Registrar Servicios Red Provincia 1
3 Registrar Nuevos Suministros 1
4 Reporte Todos los Meses 1
5 Pago Servicio Red Lima 1
6 Pago Servicio Red Provincia 1
Table Menu_Roles
ID_Menu_Roles ID_Menu ID_Roles
1 1 1
2 2 1
3 3 1
4 4 1
5 5 1
6 6 1
7 1 2
8 2 2
9 3 2
10 4 2
11 5 3
12 6 4
For what I am developing is according to the user who enters the menu should be shown according to the type of user.
For which I have this stored procedure that is entered.
ALTER procedure [dbo].[SP_ValidarUsuario]
@username varchar(350),
@llave varchar(350)
as
begin
SELECT a.Usu_Username,d.Men_Nombres FROM Usuario a
inner join Usuario_Roles b
on a.ID_Usuario=b.ID_Usuario
inner join Menu_Roles c
on b.ID_Roles=c.ID_Roles
inner join Menu d on c.ID_Menu=d.ID_Menu
WHERE a.Usu_Username=@username AND Usu_Pass=@llave --a.Usu_Username='pflores' and a.Usu_Pass='123456' --@username AND Usu_Pass=@llave
end
so when I login with the user I already capture what menu should go in this case for example I put the administrator and this is the result of the procedure in the image:
But when I do it in the asp.net c # in the menu I do not know how to make it visualize the truth I would like you to help me