private List<AppListItem> GetApplicationsByCurrentUser()
        {
            List<AppListItem> applications = new List<AppListItem>();    

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
            {
                var defaultApp = WfProcessDescriptionCategoryAdapter.Instance.Load(p => p.AppendItem("ID", "", "<>"));
                foreach (var item in defaultApp)
                {
                    AppListItem obj = new AppListItem(item.Name);
                    if (!applications.Exists(a => a.Name == obj.Name))
                        applications.Add(obj);
                }
            }

            IRole[] roles = RolesDefineConfig.GetConfig().GetRolesInstances("DesignerRoleMatrix");
            foreach (var role in roles)
            {
                AppendApplicationName(role, applications);
            }

            AppListItem other = new AppListItem("其它");
            applications.Add(other);
            return applications;
        }
        private List <AppListItem> GetApplicationsByCurrentUser()
        {
            List <AppListItem> applications = new List <AppListItem>();

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
            {
                var defaultApp = WfProcessDescriptionCategoryAdapter.Instance.Load(p => p.AppendItem("ID", "", "<>"));
                foreach (var item in defaultApp)
                {
                    AppListItem obj = new AppListItem(item.Name);
                    if (!applications.Exists(a => a.Name == obj.Name))
                    {
                        applications.Add(obj);
                    }
                }
            }

            IRole[] roles = RolesDefineConfig.GetConfig().GetRolesInstances("DesignerRoleMatrix");
            foreach (var role in roles)
            {
                AppendApplicationName(role, applications);
            }

            AppListItem other = new AppListItem("其它");

            applications.Add(other);
            return(applications);
        }
        private static void AppendApplicationName(IRole role, List <AppListItem> appList)
        {
            SOARolePropertyRowCollection allRows = SOARolePropertiesAdapter.Instance.GetByRole(role);
            SOARolePropertyRowCollection rows    = allRows;

            if (!RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
            {
                rows = allRows.Query(r => r.Operator == DeluxeIdentity.Current.User.LogOnName);
            }

            foreach (var row in rows)
            {
                string      appName = row.Values.GetValue("ApplicationName", string.Empty);
                AppListItem obj     = new AppListItem(appName);
                if (!appList.Exists(a => a.Name == obj.Name))
                {
                    appList.Add(obj);
                }
            }
        }
        private static void AppendApplicationName(IRole role, List<AppListItem> appList)
        {
            SOARolePropertyRowCollection allRows = SOARolePropertiesAdapter.Instance.GetByRole(role);
            SOARolePropertyRowCollection rows = allRows;

            if (!RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
                rows = allRows.Query(r => r.Operator == DeluxeIdentity.Current.User.LogOnName);

            foreach (var row in rows)
            {
                string appName = row.Values.GetValue("ApplicationName", string.Empty);
                AppListItem obj = new AppListItem(appName);
                if (!appList.Exists(a => a.Name == obj.Name))
                    appList.Add(obj);
            }
        }