public static List <MenuRole> GetMenuByUser(string username) { using (BanHangContext db = new BanHangContext()) { var aRoleMenu = (from l in db.TBL_LOGINs join lg in db.TBL_GROUP_LOGINs on l.USERNAME equals lg.USERNAME join g in db.TBL_GROUPs on lg.ID_GROUP equals g.ID join rg in db.TBL_GROUP_ROLEs on g.ID equals rg.ID_GROUP join r in db.TBL_ROLEs on rg.ID_ROLE equals r.ID join m in db.TBL_MENUs on r.ID equals m.ID_ROLE where l.ACTIVATE == true && l.USERNAME == username && lg.ACTIVATE == true && g.ACTIVATE == true && rg.ACTIVATE == true && r.ACTIVATE == true && m.ACTIVATE == true select new { m, r }).Distinct(); var aUserMenus = new List <MenuRole>(); foreach (var aMenu in aRoleMenu) { var aMN = new MenuRole(); aMN.ID = aMenu.m.ID; aMN.ID_ROLE = aMenu.m.ID_ROLE; aMN.MENU_NAME = aMenu.m.MENU_NAME; aMN.MENU_PARENT = aMenu.m.MENU_PARENT; aMN.MENU_SEQ = aMenu.m.MENU_SEQ; aMN.RouterLink = aMenu.r.ROLE_LINK; aMN.MENU_ICON = aMenu.m.MENU_ICON; if (aUserMenus.Count(x => x.ID == aMN.ID) == 0) { aUserMenus.Add(aMN); } } return(aUserMenus); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); //add config WebAPI before MVC GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var context = new BanHangContext(); var initializeMigrations = new MigrateDatabaseToLatestVersion <BanHangContext, Migrations.Configuration>(); initializeMigrations.InitializeDatabase(context); }
public LoaiSPService() { context = new BanHangContext(); }
public PhanNhomNVService() { context = new BanHangContext(); }
public PhieuNhapHang_NCCService() { context = new BanHangContext(); }
public MobileService() { context = new BanHangContext(); }
public LoaiPhongService() { context = new BanHangContext(); }
public ThongTinKhachHangService() { context = new BanHangContext(); }
public KhuyenMaiService() { context = new BanHangContext(); }
public DatHangKHService() { context = new BanHangContext(); }
public KhachHangService() { context = new BanHangContext(); }
public BrandsController(BanHangContext context) { _context = context; }
public GiaSPService() { context = new BanHangContext(); }
public CT_PhieuDatHangNCCService() { context = new BanHangContext(); }
public NCCService() { context = new BanHangContext(); }
public SuccessBillService() { context = new BanHangContext(); }
public DardboardService() { context = new BanHangContext(); }
public ProductsController(BanHangContext context) { _context = context; }
public CategoriesController(BanHangContext context) { _context = context; }
public QuyenService() { context = new BanHangContext(); }
public NhanVien_NhomService() { context = new BanHangContext(); }
public RoomKindService() { context = new BanHangContext(); }
public SanPhamService() { context = new BanHangContext(); }
public HomeController(BanHangContext context) { _context = context; }