public void Execute(JobData jobData) { Guid notificationTypeId = Guid.Parse(jobData.Data["NotificationTypeId"]); Guid distributionTypeId = Guid.Parse(jobData.Data["DistributionTypeId"]); bool enable = bool.Parse(jobData.Data["Enable"]); UserEnumerate enumerateUsers = new UserEnumerate(null, null); foreach (Entities.User user in enumerateUsers) { PublicApi.Users.RunAsUser(user.Id.Value, () => PublicApi.Notifications.UpdatePreference(notificationTypeId, distributionTypeId, enable)); } }
public void Process(JobData jobData) { GroupId = jobData.Data.ContainsKey("GroupId") ? int.Parse(jobData.Data["GroupId"]) : default(int?); UserName = jobData.Data.ContainsKey("UserName") ? jobData.Data["UserName"] : null; var userEnumerator = new UserEnumerate(UserName, GroupId); var groupEnumerate = new GroupEnumerate(GroupId); foreach (User user in userEnumerator) { foreach (Group group in groupEnumerate) { InternalProcess(user, group, jobData); } } }