Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        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;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public Person CreatePerson(Person item)
 {
     try
     {
         return(Client.CreatePerson(item));
     }
     finally
     {
         Store.Clear <Person>(item.GroupName);
     }
 }