コード例 #1
0
    private void LoadAndMergeRefAndMemberRoles(int memberId)
    {
        if (GlobalLists.RefUserRoles.Count == 0)
        {
            GlobalLists.RefUserRoles = Members.GetAllRefUserRoles().ToList();
        }
        List <vMemberRoleModel> memberRolesList = new List <vMemberRoleModel>();

        if (SaltShakerSession.selectedMemberID != null)
        {
            GlobalLists.MemberRoles = Members.GetMemberRoles(memberId).ToList();

            foreach (var refRole in GlobalLists.RefUserRoles)
            {
                vMemberRoleModel memRole = new vMemberRoleModel();
                memRole.RefMemberRoleID = refRole.RefMemberRoleID;
                memRole.RoleName        = refRole.RoleName;
                memRole.RoleDescription = refRole.RoleDescription;
                foreach (var memberRole in GlobalLists.MemberRoles)
                {
                    if (memberRole.RefMemberRoleID == refRole.RefMemberRoleID)
                    {
                        memRole.IsMemberRoleActive = memberRole.IsMemberRoleActive;
                        memRole.CreatedBy          = memberRole.CreatedBy;
                        memRole.CreatedDate        = memberRole.CreatedDate;
                        memRole.ModifiedBy         = memberRole.ModifiedBy;
                        memRole.ModifiedDate       = memberRole.ModifiedDate;
                        break;
                    }
                }
                memberRolesList.Add(memRole);
            }
            GlobalLists.MemberRoles = memberRolesList;
        }
        else
        {
            ShowMessage(String.Format(GlobalMessages.sMSG_EMPTYPARAM, "Member id"));
        }
    }