private static void GetAndNotifyBeforeAction(int identityStoreID, MembershipLifecycleClient membershipClient, Dictionary <string, bool> containers) { foreach (IdentityStoreObject removalPendingObjectsFromContainer in membershipClient.GetRemovalPendingObjectsFromContainer(identityStoreID, Utility.GetCurrentDate(), containers)) { if ((StringUtility.EqualsIgnoreCase(Helper.GetAttributeValue(removalPendingObjectsFromContainer, "IMGIsExpired"), bool.TrueString) ? false : !StringUtility.EqualsIgnoreCase(Helper.GetAttributeValue(removalPendingObjectsFromContainer, "IMGIsDeleted"), bool.TrueString))) { if (removalPendingObjectsFromContainer.get_AttributesBusinessObject().get_AttributesCollection().Any <KeyValuePair <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > >((KeyValuePair <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > attr) => (!attr.Key.Equals("XMember", StringComparison.OrdinalIgnoreCase) ? false : attr.Value.Count > 0))) { List <MembershipLifecycleGroup> membershipLifecycleGroups = new List <MembershipLifecycleGroup>(); KeyValuePair <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > keyValuePair = removalPendingObjectsFromContainer.get_AttributesBusinessObject().get_AttributesCollection().FirstOrDefault <KeyValuePair <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > >((KeyValuePair <string, List <Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute> > e) => e.Key.Equals("XMember", StringComparison.OrdinalIgnoreCase)); keyValuePair.Value.ForEach((Imanami.GroupID.DataTransferObjects.DataContracts.Services.Attribute lMember) => { MembershipType mtype; MembershipLifecycleMember membershipLifecycleMember = new MembershipLifecycleMember(); membershipLifecycleMember.set_GUID(lMember.get_Value()); membershipLifecycleMember.set_FromDate(Convert.ToDateTime(lMember.get_AttributeCollection()["XBeginningDate"], CultureInfo.InvariantCulture)); membershipLifecycleMember.set_ToDate(Convert.ToDateTime(lMember.get_AttributeCollection()["XEndingDate"], CultureInfo.InvariantCulture)); MembershipLifecycleMember _notifyObject = membershipLifecycleMember; Enum.TryParse <MembershipType>(lMember.get_AttributeCollection()["XMembershipType"], out mtype); _notifyObject.set_MembershipType(mtype); MembershipJob.AddInNotification(membershipLifecycleGroups, removalPendingObjectsFromContainer, _notifyObject); }); membershipClient.SendRemovalRemindernotification(Helper.PrepareCompressedData(membershipLifecycleGroups), identityStoreID); } } } }
private static void AddInNotification(List <MembershipLifecycleGroup> listToModifiy, IdentityStoreObject lObject, MembershipLifecycleMember _notifyObject) { if (!listToModifiy.Any <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lObject.get_ObjectIdFromIdentityStore()))) { MembershipLifecycleGroup membershipLifecycleGroup = new MembershipLifecycleGroup(); membershipLifecycleGroup.set_GUID(lObject.get_ObjectIdFromIdentityStore()); membershipLifecycleGroup.set_DisplayName(lObject.get_ObjectDisplayName()); membershipLifecycleGroup.set_ObjectType(lObject.get_ObjectType()); membershipLifecycleGroup.set_MembershiplifeCycleMembers(new List <MembershipLifecycleMember>()); listToModifiy.Add(membershipLifecycleGroup); } listToModifiy.First <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lObject.get_ObjectIdFromIdentityStore())).get_MembershiplifeCycleMembers().Add(_notifyObject); }
private static void AddInNotification(List <MembershipLifecycleGroup> AddMemberGroups, IdentityStoreObject lGroup, MembershipLifecycleMember _notifyMember) { if (!AddMemberGroups.Any <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lGroup.get_ObjectIdFromIdentityStore()))) { MembershipLifecycleGroup membershipLifecycleGroup = new MembershipLifecycleGroup(); membershipLifecycleGroup.set_GUID(lGroup.get_ObjectIdFromIdentityStore()); membershipLifecycleGroup.set_DisplayName(lGroup.get_ObjectDisplayName()); membershipLifecycleGroup.set_ObjectType(lGroup.get_ObjectType()); membershipLifecycleGroup.set_MembershiplifeCycleMembers(new List <MembershipLifecycleMember>()); AddMemberGroups.Add(membershipLifecycleGroup); } AddMemberGroups.First <MembershipLifecycleGroup>((MembershipLifecycleGroup z) => z.get_GUID().Equals(lGroup.get_ObjectIdFromIdentityStore())).get_MembershiplifeCycleMembers().Add(_notifyMember); }