Example #1
0
 public AfterRecordDeletedEventArgs(XmlNode record, int rowsAffected, Exception e, IDictionary keys, ConfirmationRecord confirmation) : base(record)
 {
     this.rowsAffected = rowsAffected;
     this.e            = e;
     this.keys         = keys;
     this.confirmation = confirmation;
 }
Example #2
0
 internal BeforeRecordInsertedEventArgs(XmlNode record, IDictionary keys, IDictionary newValues, ConfirmationRecord confirmation)
     : base(record)
 {
     this.keys         = keys;
     this.newValues    = newValues;
     this.confirmation = confirmation;
 }
Example #3
0
        private void MakeDeletes(IDataSource ds, XmlDocument xml)
        {
            XmlNodeList deletingRecords = xml.SelectNodes("records/Deleted/record");
            string      id = GetIdColumnName();

            foreach (XmlNode node in deletingRecords)
            {
                record    = node;
                values    = new SortedList(0);
                keys      = new SortedList();
                oldValues = new SortedList(0);

                confirmation = null;
                if (!string.IsNullOrEmpty(id))
                {
                    XmlNode keyNode = node.SelectSingleNode(id);
                    string  idStr   = keyNode != null ? keyNode.InnerText : null;

                    int idInt;
                    if (int.TryParse(idStr, out idInt))
                    {
                        keys[id] = idInt;
                    }
                    else
                    {
                        keys[id] = idStr;
                    }

                    if (this.UseIdConfirmation && keys[id] != null)
                    {
                        confirmation = changingEventArgs.ConfirmationList[keys[id].ToString()];
                    }
                }

                BeforeRecordDeletedEventArgs eBeforeRecordDeleted = new BeforeRecordDeletedEventArgs(record, keys, confirmation);
                this.OnBeforeRecordDeleted(eBeforeRecordDeleted);
                if (eBeforeRecordDeleted.CancelAll)
                {
                    break;
                }
                if (eBeforeRecordDeleted.Cancel)
                {
                    continue;
                }

                if (ds != null)
                {
                    ds.GetView("").Delete(keys, oldValues, DeleteCallback);
                }
                else
                {
                    this.DeleteCallback(0, null);
                }
            }

            if (deletingRecords.Count > 0)
            {
                needRetrieve = true;
            }
        }
Example #4
0
 public AfterRecordUpdatedEventArgs(XmlNode record, int rowsAffected, Exception e, IDictionary keys, IDictionary newValues, IDictionary oldValues, ConfirmationRecord confirmation)
     : base(record)
 {
     this.rowsAffected = rowsAffected;
     this.e            = e;
     this.keys         = keys;
     this.newValues    = newValues;
     this.oldValues    = oldValues;
     this.confirmation = confirmation;
 }
Example #5
0
        private void MakeInsertes(IDataSource ds, XmlDocument xml)
        {
            XmlNodeList insertingRecords = xml.SelectNodes("records/Created/record");
            string      id = GetIdColumnName();

            foreach (XmlNode node in insertingRecords)
            {
                record    = node;
                values    = new SortedList(this.Reader.Reader.Fields.Count);
                keys      = new SortedList();
                oldValues = new SortedList();
                foreach (RecordField field in this.Reader.Reader.Fields)
                {
                    XmlNode keyNode = node.SelectSingleNode(field.Name);
                    values[field.Name] = keyNode != null ? keyNode.InnerText : null;
                }

                confirmation = null;
                if (!string.IsNullOrEmpty(id))
                {
                    XmlNode keyNode = node.SelectSingleNode(id);
                    if (this.UseIdConfirmation && keyNode != null && !string.IsNullOrEmpty(keyNode.InnerText))
                    {
                        confirmation = changingEventArgs.ConfirmationList[keyNode.InnerText];
                    }
                }

                BeforeRecordInsertedEventArgs eBeforeRecordInserted = new BeforeRecordInsertedEventArgs(record, keys, values, confirmation);
                this.OnBeforeRecordInserted(eBeforeRecordInserted);
                if (eBeforeRecordInserted.CancelAll)
                {
                    break;
                }
                if (eBeforeRecordInserted.Cancel)
                {
                    continue;
                }
                if (ds != null)
                {
                    ds.GetView("").Insert(values, InsertCallback);
                }
                else
                {
                    this.InsertCallback(0, null);
                }
            }

            if (insertingRecords.Count > 0)
            {
                needRetrieve = true;
            }
        }
Example #6
0
 internal BeforeRecordDeletedEventArgs(XmlNode record, IDictionary keys, ConfirmationRecord confirmation)
     : base(record)
 {
     this.keys         = keys;
     this.confirmation = confirmation;
 }