protected virtual void Process(List <Contact> list) { int result = PXProcessing.ProcessItems(list, item => { if (Operations.Current.Action == CampaignOperationParam.ActionList.Update) { CRCampaignMembers member = PXSelect <CRCampaignMembers, Where <CRCampaignMembers.campaignID, Equal <Current <CampaignOperationParam.campaignID> >, And <CRCampaignMembers.contactID, Equal <Required <CRCampaignMembers.contactID> > > > > . Select(this, item.ContactID); if (member != null) { CRCampaignMembers upd = PXCache <CRCampaignMembers> .CreateCopy(member); upd.Status = Operations.Current.Status; CampaignMembers.Cache.Update(upd); } } else if (Operations.Current.Action == CampaignOperationParam.ActionList.Remove) { var member = (CRCampaignMembers)PXSelect <CRCampaignMembers, Where <CRCampaignMembers.campaignID, Equal <Current <CampaignOperationParam.campaignID> >, And <CRCampaignMembers.contactID, Equal <Required <CRCampaignMembers.contactID> > > > > . Select(this, item.ContactID); if (member != null) { CampaignMembers.Cache.Delete(member); } } else if (item.Selected == true) { OrderedDictionary doc = new OrderedDictionary(); doc.Add("CampaignID", Operations.Current.CampaignID); doc.Add("ContactID", item.ContactID); doc.Add("Status", Operations.Current.Status); CampaignMembers.Cache.Update(doc, doc); } }); try { if (result > 0) { Actions.PressSave(); } Items.Cache.Clear(); if (result != list.Count) { throw new PXOperationCompletedException(ErrorMessages.SeveralItemsFailed); } } finally { CampaignMembers.Cache.Clear(); } }
protected override int ProcessList(List <Contact> list) { return(PXProcessing.ProcessItems <Contact>(list, (Contact item) => { OrderedDictionary orderedDictionaries = new OrderedDictionary() { { "CampaignID", base.filterCurrent.CampaignID }, { "ContactID", item.ContactID } }; if (base.filterCurrent.Action == "Add") { base.membersCache.Update(orderedDictionaries, orderedDictionaries); return; } base.membersCache.Delete(orderedDictionaries, orderedDictionaries); })); }