Esempio n. 1
0
        protected virtual void SelCampaignMembers_RowInserting(PXCache cache, PXRowInsertingEventArgs e)
        {
            if (Campaign.Current != null && Campaign.Current.CampaignID != null)
            {
                SelCampaignMembers result = PXSelect <SelCampaignMembers, Where <SelCampaignMembers.campaignID, Equal <Required <SelCampaignMembers.campaignID> >, And <SelCampaignMembers.contactID, Equal <Required <SelCampaignMembers.contactID> > > > > .Search <SelCampaignMembers.contactID>(this, ((SelCampaignMembers)e.Row).ContactID, Campaign.Current.CampaignID, ((SelCampaignMembers)e.Row).ContactID);

                if (result != null)
                {
                    cache.RaiseExceptionHandling <SelCampaignMembers.contactID>(e.Row, ((SelCampaignMembers)e.Row).ContactID, new PXException("Record already exists"));
                    e.Cancel = true;
                }
            }
        }
Esempio n. 2
0
        protected virtual void SelCampaignMembers_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
        {
            SelCampaignMembers member = (SelCampaignMembers)e.Row;

            if (member.ContactID != null)
            {
                var cont = (Contact)PXSelect <Contact> .Search <Contact.contactID>(this, member.ContactID);

                member.FirstName = cont.FirstName;
                member.MidName   = cont.MidName;
                member.LastName  = cont.LastName;
                member.Title     = cont.Title;
            }
        }