Esempio n. 1
0
 /// <summary>
 ///     缓存所有角色的页面权限数据
 /// </summary>
 public void DoCache()
 {
     using (var proxy = new RedisProxy(RedisProxy.DbSystem))
     {
         proxy.FindAndRemoveKey("role:*");
     }
     using (SystemContextScope.CreateScope())
     {
         var access = new RoleDataAccess();
         var roles  = access.All();
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             proxy.CacheData(roles);
         }
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             CreatePowerTree(proxy);
         }
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             LoadAllPowers(0, proxy);
             foreach (var items in roles)
             {
                 LoadAllPowers(items.Id, proxy);
             }
         }
     }
     CachePageAuditUser();
     CacheTypeUser();
 }
Esempio n. 2
0
 /// <summary>
 ///     缓存所有角色的页面权限数据
 /// </summary>
 public static void Cache()
 {
     using (SystemContextScope.CreateScope())
     {
         new RoleCache().DoCache();
     }
 }
Esempio n. 3
0
 /// <summary>
 ///     缓存所有角色的页面权限数据
 /// </summary>
 public static void Cache(int id)
 {
     using (SystemContextScope.CreateScope())
     {
         new RoleCache().CacheRolePower(id);
     }
 }
 /// <summary>
 ///     生成完整的组织结构树(UI相关)
 /// </summary>
 /// <returns></returns>
 private void CreateFullOrgTree(RedisProxy proxy)
 {
     using (SystemContextScope.CreateScope())
     {
         var root  = CreateRootNode();
         var lists = Access.All(p => p.DataState < DataStateType.Delete);
         CreateOrgTree(root, lists, proxy);
     }
 }
Esempio n. 5
0
 /// <summary>
 /// 数据状态检测
 /// </summary>
 void OnTrigger()
 {
     using (SystemContextScope.CreateScope())
     {
         using (MySqlDataBaseScope.CreateScope(MySqlDataBase.DefaultDataBase))
         {
             DoDataChanged();
         }
     }
 }
Esempio n. 6
0
 /// <summary>
 ///     缓存角色的页面权限数据
 /// </summary>
 /// <param name="roleId">角色ID</param>
 public void CacheRolePower(int roleId)
 {
     using (SystemContextScope.CreateScope())
     {
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             LoadAllPowers(roleId, proxy);
         }
     }
 }
Esempio n. 7
0
 /// <summary>
 ///     缓存角色的页面权限数据
 /// </summary>
 public void CacheRolePower()
 {
     using (SystemContextScope.CreateScope())
     {
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             CreateMenu(proxy);
         }
     }
 }
Esempio n. 8
0
 /// <summary>
 ///     保存完成后的操作
 /// </summary>
 /// <param name="data">数据</param>
 /// <param name="isAdd">是否为新增</param>
 /// <returns>如果为否将阻止后续操作</returns>
 protected override bool OnSaved(PageItemData data, bool isAdd)
 {
     using (SystemContextScope.CreateScope())
     {
         using (MySqlDataBaseScope.CreateScope(Access.DataBase))
         {
             Cache(data, Access);
         }
     }
     return(true);
 }
Esempio n. 9
0
 /// <summary>
 /// 检查类型绑定
 /// </summary>
 /// <param name="pid"></param>
 /// <param name="types"></param>
 public bool BindType(long pid, List <Type> types)
 {
     using (SystemContextScope.CreateScope())
     {
         using (MySqlDataBaseScope.CreateScope(Access.DataBase))
         {
             FindAndBindType(pid, types);
         }
     }
     return(true);
 }
Esempio n. 10
0
 /// <summary>
 ///     状态改变后的统一处理(unityStateChanged不设置为true时不会产生作用--基于性能的考虑)
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 protected override void DoStateChanged(OrganizePositionData data)
 {
     using (SystemContextScope.CreateScope())
     {
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             var bl = new OrganizationBusinessLogic();
             bl.CreateOrgPosTree(proxy);
         }
     }
     base.DoStateChanged(data);
 }
Esempio n. 11
0
 /// <summary>
 /// 缓存页面数据
 /// </summary>
 public static void Cache()
 {
     using (SystemContextScope.CreateScope())
     {
         PageItemDataAccess access = new PageItemDataAccess();
         var items = access.All(p => p.ItemType == PageItemType.Page);
         foreach (var item in items)
         {
             Cache(item, access);
         }
     }
 }
Esempio n. 12
0
 /// <summary>
 ///     缓存页面的审批用户
 /// </summary>
 public void CachePageAuditUser()
 {
     //LogRecorder.BeginStepMonitor("CachePageAuditUser");
     using (SystemContextScope.CreateScope())
     {
         _allPowers = _rpAccess.All();
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             CachePageAuditUser(proxy);
         }
     }
     //LogRecorder.EndStepMonitor();
 }
Esempio n. 13
0
        static void CacheTask(int roleId)
        {
            using (SystemContextScope.CreateScope())
            {
                using (MySqlDataBaseScope.CreateScope(MySqlDataBase.DefaultDataBase))
                {
                    RoleCache.Cache(roleId);

                    RoleCache cache = new RoleCache();
                    cache.CachePageAuditUser();
                    cache.CacheTypeUser();
                }
            }
        }
Esempio n. 14
0
 /// <summary>
 ///     缓存类型对应的权限用户
 /// </summary>
 public void CacheTypeUser()
 {
     LogRecorder.BeginStepMonitor("CacheEditUser");
     using (SystemContextScope.CreateScope())
     {
         _allPowers = _rpAccess.All();
         using (var proxy = new RedisProxy(RedisProxy.DbAuthority))
         {
             CacheUser(proxy, "edit", edits);
             CacheUser(proxy, "audit", audits);
         }
     }
     LogRecorder.EndStepMonitor();
 }
        static void CacheTask(int pid)
        {
            var orb = new UserBusinessLogic();

            using (SystemContextScope.CreateScope())
            {
                using (MySqlDataBaseScope.CreateScope(MySqlDataBase.DefaultDataBase))
                {
                    orb.SyncUser(orb._posAccess.First(pid));
                    RoleCache cache = new RoleCache();
                    cache.CachePageAuditUser();
                    cache.CacheTypeUser();
                }
            }
        }
 /// <summary>
 ///     生成完整的组织结构树(UI相关)
 /// </summary>
 /// <returns></returns>
 public static void Cache()
 {
     using (SystemContextScope.CreateScope())
     {
         var bl = new OrganizationBusinessLogic();
         using (var proxy = new RedisProxy(RedisProxy.DbSystem))
         {
             bl.CreateFullOrgTree(proxy);
             bl.CreateOrgPosTree(proxy);
             bl.CreateAreaTree(proxy);
             proxy.CacheData <OrganizationData, OrganizationDataAccess>();
             proxy.CacheData <OrganizePositionData, OrganizePositionDataAccess>();
             proxy.CacheData <PositionPersonnelData, PositionPersonnelDataAccess>(p => $"e:pp:{p.UserId}");
         }
     }
 }
Esempio n. 17
0
 /// <summary>
 /// 缓存
 /// </summary>
 private void DoCache()
 {
     using (SystemContextScope.CreateScope())
     {
         using (MySqlDataBaseScope.CreateScope(Access.DataBase))
         {
             var pAccess = new PositionPersonnelDataAccess();
             foreach (var pos in pAccess.All())
             {
                 SyncUser(pos);
             }
             var users = Access.All();
             using (var proxy = new RedisProxy(RedisProxy.DbSystem))
             {
                 foreach (var user in users)
                 {
                     Cache(proxy, user);
                 }
             }
         }
     }
 }
Esempio n. 18
0
 /// <summary>
 /// 检查标准的增删改查按钮
 /// </summary>
 /// <param name="pid"></param>
 /// <param name="type">类型</param>
 public bool CheckNormalButtons(long pid, string type)
 {
     using (SystemContextScope.CreateScope())
     {
         using (MySqlDataBaseScope.CreateScope(Access.DataBase))
         {
             DeleteButtonItem(p => p.ExtendValue == "list" || p.ExtendValue == "physical_delete");
             if (pid < 0)
             {
                 var ids = Access.LoadValues(p => p.Id, p => p.ItemType == PageItemType.Page);
                 foreach (var id in ids)
                 {
                     NormalButtons(id);
                 }
             }
             else
             {
                 CheckNormalButtonsInner(pid);
             }
         }
     }
     return(true);
 }