Exemple #1
0
        public SOARolePropertyRowUsersCollection GenerateRowsUsers()
        {
            SOARolePropertyRowUsersCollection result = new SOARolePropertyRowUsersCollection();

            foreach (SOARolePropertyRow row in this)
            {
                //内嵌矩阵,有可能行信息(原始矩阵的行)重复
                if (result.ContainsKey(row) == false)
                {
                    SOARolePropertyRowUsers rowUsers = new SOARolePropertyRowUsers(row);

                    rowUsers.ObjectIDs      = GenerateObjectIDs(row, r => r.Operator);
                    rowUsers.EnterNotifyIDs = GenerateObjectIDs(row, r => r.Values.GetValue(SOARolePropertyDefinition.EnterNotifyReceiverColumn, string.Empty));
                    rowUsers.LeaveNotifyIDs = GenerateObjectIDs(row, r => r.Values.GetValue(SOARolePropertyDefinition.LeaveNotifyReceiverColumn, string.Empty));

                    result.Add(rowUsers);
                }
            }

            FillPersonTypeUsers(result,
                                (rowUsers) => rowUsers.ObjectIDs,
                                (rowUsers) => rowUsers.Row.OperatorType,
                                (rowUsers, userDicts) => FillMatchedUsers(rowUsers.ObjectIDs, userDicts, rowUsers.Users));

            FillRoleTypeUsers(result,
                              (rowUsers) => rowUsers.Row.OperatorType,
                              (rowUsers) => rowUsers.Row.Operator,
                              (rowUsers, user) => rowUsers.Users.AddNotExistsItem(user, u => string.Compare(u.ID, user.ID, true) == 0));

            FillPersonTypeUsers(result,
                                (rowUsers) => rowUsers.EnterNotifyIDs,
                                (rowUsers) => rowUsers.Row.Values.GetValue(SOARolePropertyDefinition.EnterNotifyReceiverTypeColumn, SOARoleOperatorType.User),
                                (rowUsers, userDicts) => FillMatchedUsers(rowUsers.EnterNotifyIDs, userDicts, rowUsers.EnterNotifyUsers));

            FillRoleTypeUsers(result,
                              (rowUsers) => rowUsers.Row.Values.GetValue(SOARolePropertyDefinition.EnterNotifyReceiverTypeColumn, SOARoleOperatorType.Role),
                              (rowUsers) => rowUsers.Row.Values.GetValue(SOARolePropertyDefinition.EnterNotifyReceiverColumn, string.Empty),
                              (rowUsers, user) => rowUsers.EnterNotifyUsers.AddNotExistsItem(user, u => string.Compare(u.ID, user.ID, true) == 0));

            FillPersonTypeUsers(result,
                                (rowUsers) => rowUsers.LeaveNotifyIDs,
                                (rowUsers) => rowUsers.Row.Values.GetValue(SOARolePropertyDefinition.LeaveNotifyReceiverTypeColumn, SOARoleOperatorType.User),
                                (rowUsers, userDicts) => FillMatchedUsers(rowUsers.LeaveNotifyIDs, userDicts, rowUsers.LeaveNotifyUsers));

            FillRoleTypeUsers(result,
                              (rowUsers) => rowUsers.Row.Values.GetValue(SOARolePropertyDefinition.LeaveNotifyReceiverTypeColumn, SOARoleOperatorType.Role),
                              (rowUsers) => rowUsers.Row.Values.GetValue(SOARolePropertyDefinition.LeaveNotifyReceiverColumn, string.Empty),
                              (rowUsers, user) => rowUsers.LeaveNotifyUsers.AddNotExistsItem(user, u => string.Compare(u.ID, user.ID, true) == 0));

            result.SortByActivitySN();
            result.RemoveMergeableRows();

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 直接生成行和用户信息,只有用户信息,不包含OperationType为角色的信息
        /// </summary>
        /// <returns></returns>
        public SOARolePropertyRowUsersCollection GenerateRowsUsersDirectly()
        {
            SOARolePropertyRowUsersCollection result = new SOARolePropertyRowUsersCollection();

            foreach (SOARolePropertyRow row in this)
            {
                if (row.OperatorType == SOARoleOperatorType.User)
                {
                    SOARolePropertyRowUsers rowUsers = new SOARolePropertyRowUsers(row);

                    rowUsers.ObjectIDs = GenerateObjectIDs(row, (r) => r.Operator);

                    result.Add(rowUsers);
                }
            }

            FillPersonTypeUsers(result,
                                (rowUsers) => rowUsers.ObjectIDs,
                                (rowUsers) => rowUsers.Row.OperatorType,
                                (rowUsers, userDicts) => FillMatchedUsers(rowUsers.ObjectIDs, userDicts, rowUsers.Users));

            return(result);
        }