Exemplo n.º 1
0
        protected virtual void HandleChanges(object sender, BeforeStoreChangedEventArgs e)
        {
            ChangeRecords <sysuser> persons = e.DataHandler.ObjectData <sysuser>();

            foreach (sysuser created in persons.Created)
            {
                string tempId = created.id;
                string newId  = this.AddPerson(created);

                if (Store1.UseIdConfirmation)
                {
                    e.ConfirmationList.ConfirmRecord(tempId.ToString(), newId.ToString());
                }
                else
                {
                    Store1.UpdateRecordId(tempId, newId);
                }
            }

            foreach (sysuser deleted in persons.Deleted)
            {
                this.DeletePerson(deleted.id);

                if (Store1.UseIdConfirmation)
                {
                    e.ConfirmationList.ConfirmRecord(deleted.id);
                }
            }

            foreach (sysuser updated in persons.Updated)
            {
                this.UpdatePerson(updated);

                if (Store1.UseIdConfirmation)
                {
                    e.ConfirmationList.ConfirmRecord(updated.id);
                }
            }
            e.Cancel = true;
        }