protected virtual void Person_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { var person = (Person)e.Row; if (string.IsNullOrEmpty(person?.Name) == false) { if (string.IsNullOrEmpty(person?.GroupName) == false) { switch (e.Operation) { case PXDBOperation.Delete: Api.DeletePerson(person); this.Clear(); break; case PXDBOperation.Insert: Api.CreatePerson(person); this.Clear(); break; case PXDBOperation.Update: Api.UpdatePerson(person); break; } e.Cancel = true; } } }
protected virtual void Person_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { var group = Groups.Current; if (string.IsNullOrEmpty(group?.Name) == false) { if (Groups.Cache.GetStatus(group) != PXEntryStatus.Inserted) { var person = e.Row as Person; if (string.IsNullOrEmpty(person?.Name) == false) { switch (e.Operation) { case PXDBOperation.Delete: Api.DeletePerson(person); sender.Remove(person); e.Cancel = true; break; case PXDBOperation.Insert: Api.CreatePerson(person); e.Cancel = true; break; case PXDBOperation.Update: Api.UpdatePerson(person); e.Cancel = true; break; } } } } }
public Person CreatePerson(Person item) { try { return(Client.CreatePerson(item)); } finally { Store.Clear <Person>(item.GroupName); } }