Esempio n. 1
0
        void bwApplyFiltersToUsers_DoWork(object sender, DoWorkEventArgs e)
        {
            var bw        = (BackgroundWorker)sender;
            var rm        = new RuleManager("savedquery", service);
            var templates = ((EntityReferenceCollection)((object[])e.Argument)[0]);
            var users     = (List <Entity>)((object[])e.Argument)[1];

            if (users == null)
            {
                rm.ApplyRuleToActiveUsers(templates);
            }
            else
            {
                foreach (var user in users)
                {
                    bw.ReportProgress(0,
                                      string.Format("Applying filter(s) for user {0}...", user.GetAttributeValue <string>("fullname")));

                    rm.ApplyRulesToUser(templates, user.Id);
                }
            }
        }