· 7 years ago · Dec 14, 2018, 02:56 PM
1IF EXISTS ( SELECT [name] FROM sys.tables WHERE [name] = 'MenuMaster' )
2DROP TABLE MenuMaster
3GO
4
5CREATE TABLE MenuMaster
6(
7 MenuIdentity int identity(1,1),
8 MenuID VARCHAR(30) NOT NULL,
9 MenuName VARCHAR(30) NOT NULL,
10 Parent_MenuID VARCHAR(30) NOT NULL,
11 User_Roll [varchar](256) NOT NULL,
12 MenuFileName VARCHAR(100) NOT NULL,
13 MenuURL VARCHAR(500) NOT NULL,
14 USE_YN Char(1) DEFAULT 'Y',
15 CreatedDate datetime
16CONSTRAINT [PK_MenuMaster] PRIMARY KEY CLUSTERED
17(
18 [MenuIdentity] ASC ,
19 [MenuID] ASC,
20 [MenuName] ASC
21)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
22) ON [PRIMARY]
23
24select * from MenuMaster
25-- Insert Admin User Details
26Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
27 Values('AUSER','ADMIN Dashboard','*','ADMIN','INDEX','ADMINC','Y',getDate())
28 Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
29 Values('AAbout','About Admin','*','ADMIN','INDEX','ADMINAC','Y',getDate())
30Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
31 Values('LStock','Live Stock','AUSER','ADMIN','INDEX','StockC','Y',getDate())
32Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
33 Values('Profile','User Details','AUSER','ADMIN','INDEX','MemberC','Y',getDate())
34Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
35 Values('MUSER','Manager Dashboard','*','ADMIN','INDEX','ManagerC','Y',getDate())
36 Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
37 Values('MAbout','About Manager','*','ADMIN','INDEX','ManagerAC','Y',getDate())
38Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
39 Values('Accounts','Account Details','MUSER','ADMIN','INDEX','AccountC','Y',getDate())
40 Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
41 Values('Inventory','Inventory Details','MUSER','ADMIN','INDEX','InventoryC','Y',getDate())
42
43-- Insert Manager User Details
44Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
45 Values('MUSER','Manager Dashboard','*','Manager','INDEX','ManagerC','Y',getDate())
46 Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
47 Values('MAbout','About Manager','*','Manager','INDEX','ManagerAC','Y',getDate())
48Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
49 Values('Accounts','Account Details','MUSER','Manager','INDEX','AccountC','Y',getDate())
50Insert into MenuMaster(MenuID ,MenuName,Parent_MenuID,User_Roll,MenuFileName,MenuURL,USE_YN,CreatedDate)
51 Values('Inventory','Inventory Details','MUSER','Manager','INDEX','InventoryC','Y',getDate())
52
53
54select * from MenuMaster
55
56select * from AspnetUserRoles
57
58using System;
59using System.Collections.Generic;
60using System.Linq;
61using System.Threading.Tasks;
62
63namespace ContactManager.Models
64{
65 public class MenuMaster
66 {
67 public int MenuIdentity { get; set; }
68 public string MenuID { get; set; }
69 public string MenuName { get; set; }
70 public string Parent_MenuID { get; set; }
71 public string User_Roll { get; set; }
72 public string MenuFileName { get; set; }
73 public string MenuURL { get; set; }
74 public string USE_YN { get; set; }
75 public DateTime CreatedDate { get; set; }
76 }
77}