Exemplo n.º 1
0
        public ActionResult _Nav()
        {
            ModuleShared lstModel = new ModuleShared();


            //Get from cookie
            //List<ModuleApplication> model = CookieStore.Get<List<ModuleApplication>>(APIConstant.COOKIE_MODULE + APIConstant.MODULE_CMS, HttpContext.ApplicationInstance.Context);
            //if (model != null)
            //{
            //    lstModel.lstModuleParent = model.Where(x => x.ParentId == 0).ToList();
            //    lstModel.lstModuleItem = model.Where(x => x.ParentId != 0).ToList();
            //}

            string strUrl = APIProvider.APIGenerator("Module", "Initial", new List <string> {
                "group"
            }, true, APIConstant.MODULE_CMS);
            var lstModule = APIProvider.Authorize_GetNonAsync <List <ModuleApplication> >(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

            if (lstModule != null)
            {
                lstModel.lstModuleParent = lstModule.Where(x => x.ParentId == 0).ToList();
                lstModel.lstModuleItem   = lstModule.Where(x => x.ParentId != 0).ToList();
            }

            return(PartialView("_Nav", lstModel));
        }
Exemplo n.º 2
0
        public PartialViewResult _Counter()
        {
            string url = APIProvider.APIGenerator("Dashboard", "InternalCounter", null);

            var data = APIProvider.Authorize_GetNonAsync <List <int> >(_userSession.BearerToken, url, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

            if (data == null)
            {
                new List <int>();
            }

            return(PartialView(data));
        }
Exemplo n.º 3
0
        public PartialViewResult _Notification()
        {
            var    result             = new List <UserNotificationViewModel>();
            string apiNotificationUrl = APIProvider.APIGenerator("UserNotification", new List <string> {
                "userId", "NumTop"
            }, true, _userSession.UserId, 5);

            var data = APIProvider.Authorize_GetNonAsync <UserNotificationModel>(_userSession.BearerToken, apiNotificationUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

            if (data != null)
            {
                result = data.lstUserNotificationViewModel;
            }

            return(PartialView(result));
        }
Exemplo n.º 4
0
        public JsonResult GetData(int pageIndex, int numberInPage)
        {
            string apiNotificationUrl = APIProvider.APIGenerator("UserNotification", new List <string> {
                "userId", "NumTop", "pageIndex", "numberInPage"
            }, true, _userSession.UserId, 0, pageIndex, numberInPage);

            var data = APIProvider.Authorize_GetNonAsync <UserNotificationModel>(_userSession.BearerToken, apiNotificationUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

            if (data == null)
            {
                data           = new UserNotificationModel();
                data.TotalItem = 0;
                data.lstUserNotificationViewModel = new List <UserNotificationViewModel>();
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public ActionResult GetListNotification()
        {
            //return partial view instead of View
            var    result             = new List <SystemNotificationViewModel>();
            string apiNotificationUrl = APIProvider.APIGenerator("SystemNotification", new List <string> {
                "userId", "sendFrom", "numTop"
            }, true, _userSession.UserId, string.Empty, 5);

            var data = APIProvider.Authorize_GetNonAsync <SystemNotificationModel>(_userSession.BearerToken, apiNotificationUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

            if (data != null)
            {
                result = data.lstUserNotificationViewModel;
            }

            return(PartialView("_ListNotification", result));
        }
Exemplo n.º 6
0
        public ActionResult _Nav()
        {
            ModuleShared lstModel = new ModuleShared();


            string strUrl = APIProvider.APIGenerator("Module", "Initial", new List <string> {
                "group"
            }, true, APIConstant.MODULE_INTERNAL);
            var lstModule = APIProvider.Authorize_GetNonAsync <List <ModuleApplication> >(_userSession.BearerToken, strUrl, APIConstant.API_Resource_CORE, ARS.IgnoredARS);

            if (lstModule != null)
            {
                lstModel.lstModuleParent = lstModule.Where(x => x.ParentId == 0).ToList();
                lstModel.lstModuleItem   = lstModule.Where(x => x.ParentId != 0).ToList();
            }

            return(PartialView("_Nav", lstModel));
        }
Exemplo n.º 7
0
        private UserCache AccessCacheUserData()
        {
            var userCache = (UserCache)MemoryCacheObject.GetCacheObject(ObjectCacheProfile.CACHE_PROFILE_USER + _userSession.UserId);

            if (userCache == null)
            {
                UserSecretInfoViewModel info = APIProvider.Authorize_GetNonAsync <UserSecretInfoViewModel>(_userSession.BearerToken, "Account", "GetSecretInfo", null, APIConstant.API_Resource_Authorize);
                if (info != null)
                {
                    var       patientId     = (info.PatientId == null ? string.Empty : info.PatientId);
                    UserCache cacheUserData = new UserCache();
                    cacheUserData.Image     = (info.Image != null ? FileManagement.ByteArrayToImageBase64(info.Image) : string.Empty);
                    cacheUserData.UserName  = _userSession.UserName;
                    cacheUserData.PatientId = patientId;
                    cacheUserData.UserId    = _userSession.UserId;

                    MemoryCacheObject.CacheObject(ObjectCacheProfile.CACHE_PROFILE_USER + _userSession.UserId, cacheUserData);

                    return(cacheUserData);
                }
            }
            return(userCache);
        }