Exemplo n.º 1
0
 public static bool IsSA(this User user)
 {
     GMRService<Module> modulesvr = new GMRService<Module>();
     var SAModule = modulesvr.FirstOrDefault(p => p.Keys == "SA");
     if (SAModule == null) return false;
     var permission = user.Permissions.Where(p => p.ModuleID == SAModule.ModuleID).FirstOrDefault();
     return permission != null;
 }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            GMRService<Setting> svr = new GMRService<Setting>();
            SettingModel model = new SettingModel(){
            Settings = svr.GetPaged(p=>p.SettingID>0,
            new Common.EF.IOrderByClause<Setting>[] {new Common.EF.OrderByClause<Setting, int>(p=>p.SettingID, Common.EF.SortDirection.Ascending)}
            ,1,100)
            };

            return View(model);
        }
Exemplo n.º 3
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);
            //string controller = requestContext.RouteData.Values["controller"].ToString();
            //string action = requestContext.RouteData.Values["action"].ToString();
            //string area = "Administration";

            //if (SessionManager.UserInfo!= null && SessionManager.UserInfo.PartnerId > 0)
            //{
            //    controller = "Home";
            //    action="ClientLogin";
            //    area="";
            //}
            GMRService<Category> service = new GMRService<Category>();

            this.ViewData.Add(Constants.ViewData.MainMenu, new MainMenuModel()
            {
                Categories = service.GetPaged(p => !p.ParentCategoryID.HasValue,
                 new IOrderByClause<Category>[] {new OrderByClause<Category, int> (p=>p.CategoryID, SortDirection.Ascending),
                },
                 1,
                 100)
            });

            NewsService newsSvr = new NewsService();
            List<News> news = newsSvr.GetLastestSMSAccessNews();
            this.ViewData.Add(Constants.ViewData.LastestSMSNews, news);

            List<News> MarqueeNews = newsSvr.GetLastestMaqueeNews();
            this.ViewData.Add(Constants.ViewData.MarqueeNews, MarqueeNews);

            string GoldOrgKey = "GOLDORG";
            var data = MemoryCache.Default[GoldOrgKey];
            if (data == null)
            {
                GoldOrgCrawler crawler = new GoldOrgCrawler();
                data = crawler.GetstrapTools();

                MemoryCache.Default.Add(GoldOrgKey, data, DateTime.Now.AddMinutes(1));
            }

            this.ViewData.Add("GoldOrgPrice", data);
        }
Exemplo n.º 4
0
        public ActionResult UserView(int id)
        {
            UserService service = new UserService();
             var user = service.GetById(id);

             GMRService<Module> moduleSvc = new GMRService<Module>();

             EditUserPermissionModel model = new EditUserPermissionModel()
             {
                 User = user,
                 GroupId = user.GroupID.HasValue ? user.GroupID.Value : 0,
                 Name = user.Group != null ? user.Group.GroupName : string.Empty,
                 Modules = moduleSvc.GetPaged(p => p.Keys != "SA", new IOrderByClause<Module>[] { new OrderByClause<Module, string>(p => p.Name, SortDirection.Ascending) }, 1, int.MaxValue)

             };
             return View(model);
        }
Exemplo n.º 5
0
        public ActionResult Index()
        {
            GMRService<Group> servie = new GMRService<Group>();
            PermissionService pservice = new PermissionService();
            IndexPermissionModel model = new IndexPermissionModel()
            {
                Groups = servie.GetPaged(p => p.GroupID > 0, new Common.EF.IOrderByClause<Group>[] { new OrderByClause<Group, string>(p => p.GroupName, SortDirection.Ascending) }, 1, 100),
                Permissions = pservice.GetPaged(p => p.PermissionID > 0, new Common.EF.IOrderByClause<Permission>[] { new OrderByClause<Permission, DateTime>(p => p.UpdatedDate.Value, SortDirection.Decending) }, 1, 100)
            };

            return View(model);
        }
Exemplo n.º 6
0
        public ActionResult GroupView(int id)
        {
            GroupService service = new GroupService();
            var group = service.GetById(id);

            GMRService<Module> moduleSvc = new GMRService<Module>();

            ViewGroupPermissionModel model = new ViewGroupPermissionModel()
            {

                GroupId = id,
                Name = group.GroupName,
                Modules = moduleSvc.GetPaged(p => p.Keys != "SA", new IOrderByClause<Module>[] { new OrderByClause<Module, string>(p => p.Name, SortDirection.Ascending) }, 1, int.MaxValue)

            };

            return View(model);
        }
Exemplo n.º 7
0
        public ActionResult GroupEdit(int id)
        {
            GMRService<Module> service = new GMRService<Module>();
            GMRService<Group> groupService = new GMRService<Group>();
            EditGroupPermissionModel model = new EditGroupPermissionModel()
            {
                GroupId = id,
                Name = groupService.FirstOrDefault(p=>p.GroupID == id).GroupName,
                Modules = service.GetPaged(p => p.Keys!= "SA", new IOrderByClause<Module>[] { new OrderByClause<Module, string>(p => p.Name, SortDirection.Ascending) }, 1, int.MaxValue)
            };

            return View(model);
        }
Exemplo n.º 8
0
        public ActionResult Index()
        {
            GMRService<Category> service = new GMRService<Category>();
            HomeContentModel model = new HomeContentModel();

            return View(model);
        }
Exemplo n.º 9
0
        //
        // GET: /Administration/Category/
        public ActionResult Index()
        {
            GMRService<Category> service = new GMRService<Category>();
            IndexCategoryModel model = new IndexCategoryModel(){
                Categories = service.GetPaged(p=>p.CategoryID>0 , new IOrderByClause<Category>[] { new OrderByClause<Category, int>(p => p.CategoryID, SortDirection.Decending)},
                1,100)
            };

            return View(model);
        }