Ejemplo n.º 1
0
        /// <summary>
        /// This method adds the groups to a list of users
        /// </summary>
        /// <param name="ado"></param>
        /// <param name="users"></param>
        /// <returns></returns>
        internal void MergeGroupsToUsers(ADO ado, ref ADO_readerOutput resultUsers)
        {
            GroupAccount_ADO adoGroupAccount = new GroupAccount_ADO();

            //cycle through each user in the list and get the group data
            if (resultUsers.hasData)
            {
                foreach (var user in resultUsers.data)
                {
                    GroupAccount_DTO_Read gpAccDto = new GroupAccount_DTO_Read();
                    gpAccDto.CcnUsername = user.CcnUsername;

                    //Get the group data for the user
                    ADO_readerOutput resultGroups = adoGroupAccount.Read(ado, gpAccDto);
                    if (resultGroups.hasData)
                    {
                        user.UserGroups = new List <GroupAccount_DTO>();
                        foreach (var group in resultGroups.data)
                        {// add the new data to the output
                            GroupAccount_DTO groupAccountDTO = new GroupAccount_DTO();
                            groupAccountDTO.GrpName        = group.GrpName;
                            groupAccountDTO.GrpCode        = group.GrpCode;
                            groupAccountDTO.GccApproveFlag = group.GccApproveFlag;
                            // add group to the user
                            user.UserGroups.Add(groupAccountDTO);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get a list of GroupAccounts for a CcnUsername
        /// </summary>
        /// <param name="ccnUsername"></param>
        /// <returns></returns>
        private List <GroupAccount_DTO> getGroupMembership(string ccnUsername)
        {
            GroupAccount_ADO      gaAdo   = new GroupAccount_ADO();
            GroupAccount_DTO_Read dtoRead = new GroupAccount_DTO_Read();

            dtoRead.CcnUsername = ccnUsername;
            dynamic result = gaAdo.Read(Ado, dtoRead);
            List <GroupAccount_DTO> groupAccountList = new List <GroupAccount_DTO>();

            foreach (dynamic groupAccount in result.data)
            {
                GroupAccount_DTO resultDTO = new GroupAccount_DTO(groupAccount);
                groupAccountList.Add(resultDTO);
            }

            return(groupAccountList);
        }