Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public LoaiSPService()
 {
     context = new BanHangContext();
 }
 public PhanNhomNVService()
 {
     context = new BanHangContext();
 }
 public PhieuNhapHang_NCCService()
 {
     context = new BanHangContext();
 }
Exemple #6
0
 public MobileService()
 {
     context = new BanHangContext();
 }
Exemple #7
0
 public LoaiPhongService()
 {
     context = new BanHangContext();
 }
 public ThongTinKhachHangService()
 {
     context = new BanHangContext();
 }
Exemple #9
0
 public KhuyenMaiService()
 {
     context = new BanHangContext();
 }
Exemple #10
0
 public DatHangKHService()
 {
     context = new BanHangContext();
 }
 public KhachHangService()
 {
     context = new BanHangContext();
 }
Exemple #12
0
 public BrandsController(BanHangContext context)
 {
     _context = context;
 }
Exemple #13
0
 public GiaSPService()
 {
     context = new BanHangContext();
 }
 public CT_PhieuDatHangNCCService()
 {
     context = new BanHangContext();
 }
Exemple #15
0
 public NCCService()
 {
     context = new BanHangContext();
 }
 public SuccessBillService()
 {
     context = new BanHangContext();
 }
Exemple #17
0
 public DardboardService()
 {
     context = new BanHangContext();
 }
 public ProductsController(BanHangContext context)
 {
     _context = context;
 }
 public CategoriesController(BanHangContext context)
 {
     _context = context;
 }
Exemple #20
0
 public QuyenService()
 {
     context = new BanHangContext();
 }
Exemple #21
0
 public NhanVien_NhomService()
 {
     context = new BanHangContext();
 }
Exemple #22
0
 public RoomKindService()
 {
     context = new BanHangContext();
 }
Exemple #23
0
 public SanPhamService()
 {
     context = new BanHangContext();
 }
Exemple #24
0
 public HomeController(BanHangContext context)
 {
     _context = context;
 }