예제 #1
0
        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);
        }
예제 #2
0
        protected virtual void _(Events.RowUpdated <DocumentAddress> e)
        {
            DocumentAddress row = e.Row as DocumentAddress;

            if (row == null)
            {
                return;
            }
            Document doc = Documents.Cache.Current as Document;

            if (doc == null)
            {
                return;
            }

            if (doc.BAccountID == null && doc.ContactID == null)
            {
                row.IsValidated = false;
            }
        }