protected virtual void Contact_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } Contact row = e.Row as Contact; BAccount acct = BAccountUtility.FindAccount(this, row.BAccountID); if (acct != null) { SelectedContact selContact = row as SelectedContact; if (!row.DefAddressID.HasValue) { row.DefAddressID = acct.DefAddressID; //Set default value } if (selContact != null) { selContact.IsAddressSameAsMain = (row.DefAddressID == acct.DefAddressID); } } PXUIFieldAttribute.SetVisible <Contact.bAccountID>(cache, row, false); PXUIFieldAttribute.SetVisible <Contact.contactID>(cache, row, false); PXUIFieldAttribute.SetVisible <Contact.defAddressID>(cache, row, false); }
public virtual void ViewDefLocationOnMap() { var row = BAccount.Current; if (row == null || row.BAccountID == null || row.DefLocationID == null) { return; } var location = (Location)PXSelect <Location, Where <Location.locationID, Equal <Required <Location.locationID> > > > . Select(this, row.DefLocationID); if (location == null || location.DefAddressID == null) { return; } var address = (Address)PXSelect <Address, Where <Address.addressID, Equal <Required <Address.addressID> > > > . Select(this, location.DefAddressID); if (address != null) { BAccountUtility.ViewOnMap(address); } }
protected virtual void Contact_ContactID_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e) { Contact row = (Contact)e.Row; if ((int)e.NewValue == -1) { e.NewValue = BAccountUtility.GetNextContactID(this, row.BAccountID); } }
protected virtual void Contact_DefAddressID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { Contact row = e.Row as Contact; if (row != null) { BAccount acct = BAccountUtility.FindAccount(this, row.BAccountID);; if (acct != null) { e.NewValue = acct.DefAddressID; } } }
protected virtual void Address_RowSelected(PXCache cache, PXRowSelectedEventArgs e) { Address row = e.Row as Address; BAccount acct = BAccountUtility.FindAccount(this, row.BAccountID);; bool isSameAsMain = false; if (acct != null) { isSameAsMain = (row.AddressID == acct.DefAddressID); } PXUIFieldAttribute.SetEnabled(cache, row, !isSameAsMain); PXUIFieldAttribute.SetVisible <Address.addressID>(cache, row); PXUIFieldAttribute.SetVisible <Address.bAccountID>(cache, row); }
protected virtual void Contact_RowDeleted(PXCache cache, PXRowDeletedEventArgs e) { Contact row = e.Row as Contact; BAccount acct = BAccountUtility.FindAccount(this, row.BAccountID);; if (acct != null) { if (row.DefAddressID.HasValue && row.DefAddressID != acct.DefAddressID) { Address addr = (Address)this.Address.Current; if (row.DefAddressID == addr.AddressID) { this.Address.Delete(addr); } } } }
protected override void Address_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { Address row = e.Row as Address; if (row != null) { BAccount acct = BAccountUtility.FindAccount(this, row.BAccountID); bool isSameAsMain = false; if (acct != null) { isSameAsMain = (row.AddressID == acct.DefAddressID); } if (!isSameAsMain && Location.Current != null && APPaymentInfoLocation.Current != null && object.Equals(APPaymentInfoLocation.Current.VRemitAddressID, row.AddressID)) { PXUIFieldAttribute.SetEnabled(sender, e.Row, object.Equals(Location.Current.LocationID, Location.Current.VPaymentInfoLocationID)); } else { base.Address_RowSelected(sender, e); } } }
public virtual void Contact_IsAddressSameAsMain_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { SelectedContact row = (SelectedContact)e.Row; if (row.IsAddressSameAsMain.HasValue) { if (row.IsAddressSameAsMain == true) { BAccount account = BAccountUtility.FindAccount(this, row.BAccountID); Address addr = this.Address.Current; if (account != null) { if (row.DefAddressID != account.DefAddressID) { if (addr.AddressID == row.DefAddressID) { this.Address.Cache.Delete(addr); } row.DefAddressID = account.DefAddressID; this.Contact.View.RequestRefresh(); } } } else { Address defAddress = this.Address.Current; Address addr = PXCache <Address> .CreateCopy(defAddress); addr.BAccountID = row.BAccountID; addr.AddressID = null; //Copy from default here addr = (Address)this.Address.Cache.Insert(addr); row.DefAddressID = addr.AddressID; this.Contact.View.RequestRefresh(); } } }
public virtual IEnumerable ViewRemitOnMap(PXAdapter adapter) { BAccountUtility.ViewOnMap(this.RemitAddress.Current); return(adapter.Get()); }
protected virtual void Address_AddressID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { Address row = e.Row as Address; e.NewValue = BAccountUtility.GetNextAddressID(this, row.BAccountID); }
protected virtual void Contact_ContactID_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e) { Contact row = (Contact)e.Row; e.NewValue = BAccountUtility.GetNextContactID(this, row.BAccountID); }