protected virtual void ARInvoiceAlias_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { ARInvoiceAlias row = e.Row as ARInvoiceAlias; CRCampaign campaign = Campaign.Current; if (row == null || campaign == null) { return; } if (e.Operation == PXDBOperation.Insert) { PXDatabase.Update <ARInvoice>( new PXDataFieldAssign <ARInvoice.campaignID>(campaign.CampaignID), new PXDataFieldRestrict <ARInvoice.docType>(row.DocType), new PXDataFieldRestrict <ARInvoice.refNbr>(row.RefNbr) ); } else if (e.Operation == PXDBOperation.Delete) { PXDatabase.Update <ARInvoice>( new PXDataFieldAssign <ARInvoice.campaignID>(null), new PXDataFieldRestrict <ARInvoice.docType>(row.DocType), new PXDataFieldRestrict <ARInvoice.refNbr>(row.RefNbr) ); } sender.Clear(); e.Cancel = true; }
protected virtual bool AskProcess(List <Contact> list) { if (Operations.Current.CampaignID == null) { return(false); } CRCampaign campaign = PXSelect <CRCampaign, Where <CRCampaign.campaignID, Equal <Current <CampaignOperationParam.campaignID> > > > .Select(this); if (Operations.Current.Action == CampaignOperationParam.ActionList.Update) { return(PXView.AskExt(this, "UpdateMembers", null, (s, e) => { Operations.Current.Status = campaign != null ? campaign.DefaultMemberStatus : null; }) == WebDialogResult.OK && Operations.Current.Status != null); } if (Operations.Current.Action == CampaignOperationParam.ActionList.Remove) { return(Operations.Current.CampaignID != null && Operations.Ask(Messages.AskConfirmation, string.Format(Messages.ConfirmRemoving, list.Count), MessageButtons.YesNoCancel) == WebDialogResult.Yes); } return(PXView.AskExt(this, "AddMembers", null, (s, e) => { Operations.Current.Status = campaign != null ? campaign.DefaultMemberStatus : null; }) == WebDialogResult.OK && Operations.Current.Status != null); }
protected virtual void CRCampaign_Selected_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e) { CRCampaign row = (CRCampaign)e.Row; if (row != null && !(bool)e.OldValue && (bool)row.Selected) { foreach (CRCampaign item in Campaigns.Select()) { if (item.Selected == true && item != row) { sender.SetValue <CRCampaign.selected>(item, false); sender.SetStatus(item, PXEntryStatus.Updated); } } Campaigns.View.RequestRefresh(); } }