protected virtual IPersonalContact MapContact(DocumentContact source, IPersonalContact target) { if (source is null) { throw new ArgumentNullException(nameof(source)); } if (target is null) { throw new ArgumentNullException(nameof(target)); } target.FullName = source.FullName; target.Title = source.Title; target.FirstName = source.FirstName; target.LastName = source.LastName; target.Salutation = source.Salutation; target.Attention = source.Attention; target.Email = source.Email; target.WebSite = source.WebSite; target.Phone1 = source.Phone1; target.Phone1Type = source.Phone1Type; target.Phone2 = source.Phone2; target.Phone2Type = source.Phone2Type; target.Phone3 = source.Phone3; target.Phone3Type = source.Phone3Type; target.Fax = source.Fax; target.FaxType = source.FaxType; return(target); }
protected override IPersonalContact MapContact(DocumentContact docContact, IPersonalContact target) { base.MapContact(docContact, target); target.Title = null; return(target); }
protected virtual void _(Events.FieldUpdated <Document, Document.allowOverrideShippingContactAddress> e) { var row = e.Row as Document; if (row == null) { return; } PXCache cacheShippingContact = GetShippingContactCache(); if (cacheShippingContact != null) { PXCache cacheContact = GetContactCache(); if (cacheContact.Current == null) { cacheContact.Current = GetCurrentContact(); } if (cacheShippingContact.Current == null) { cacheShippingContact.Current = GetCurrentShippingContact(); } IPersonalContact crShippingContact = cacheShippingContact.Current as IPersonalContact; if (crShippingContact != null) { cacheShippingContact.SetValueExt <CRShippingContact.overrideContact>(crShippingContact, row.AllowOverrideShippingContactAddress); if (cacheShippingContact.Current == null) { cacheShippingContact.Clear(); cacheShippingContact.Current = GetCurrentShippingContact(); } } } PXCache cacheShippingAddress = GetShippingAddressCache(); if (cacheShippingAddress != null) { PXCache cacheAddress = GetAddressCache(); if (cacheAddress.Current == null) { cacheAddress.Current = GetCurrentAddress(); } IAddress crShippingAddress = GetCurrentShippingAddress(); if (crShippingAddress != null) { cacheShippingAddress.SetValueExt <CRShippingAddress.overrideAddress>(crShippingAddress, row.AllowOverrideShippingContactAddress); if (cacheShippingAddress.Current == null) { cacheShippingAddress.Clear(); cacheShippingAddress.Current = GetCurrentShippingAddress(); } } } }
protected virtual void _(Events.FieldUpdated <Document, Document.allowOverrideContactAddress> e) { var row = e.Row as Document; if (row == null) { return; } DocumentAddress address = Addresses.SelectSingle(); DocumentContact contact = Contacts.SelectSingle(); if (contact != null) { Contacts.Cache.SetValue <DocumentContact.overrideContact>(contact, row.AllowOverrideContactAddress); PXCache cache = GetContactCache(); if (cache != null) { IPersonalContact crContact = GetCurrentContact(); if (crContact != null) { cache.SetValue <CRContact.isDefaultContact>(crContact, row.AllowOverrideContactAddress != true); } } } if (address != null) { Addresses.Cache.SetValue <DocumentAddress.overrideAddress>(address, row.AllowOverrideContactAddress); PXCache cache = GetAddressCache(); if (cache != null) { IAddress crAddress = GetCurrentAddress(); if (crAddress != null) { cache.SetValue <CRAddress.isDefaultAddress>(crAddress, row.AllowOverrideContactAddress != true); } } } Addresses.Cache.Update(address); Contacts.Cache.Update(contact); }