Ejemplo n.º 1
0
 internal BeforeRecordInsertedEventArgs(XmlNode record, IDictionary keys, IDictionary newValues, ConfirmationRecord confirmation)
     : base(record)
 {
     this.keys         = keys;
     this.newValues    = newValues;
     this.confirmation = confirmation;
 }
 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;
 }
Ejemplo n.º 3
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 (id.IsNotEmpty())
                {
                    XmlNode keyNode = node.SelectSingleNode(id);

                    if (this.UseIdConfirmation && keyNode != null && keyNode.InnerText.IsNotEmpty())
                    {
                        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;
            }
        }
Ejemplo n.º 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;
 }
 internal BeforeRecordDeletedEventArgs(XmlNode record, IDictionary keys, ConfirmationRecord confirmation)
     : base(record)
 {
     this.keys         = keys;
     this.confirmation = confirmation;
 }
Ejemplo n.º 6
0
        private void MakeUpdates(IDataSource ds, XmlDocument xml)
        {
            XmlNodeList updatingRecords = xml.SelectNodes("records/Updated/record");

            string id = GetIdColumnName();

            foreach (XmlNode node in updatingRecords)
            {
                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 (id.IsNotEmpty())
                {
                    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()];
                    }
                }

                BeforeRecordUpdatedEventArgs eBeforeRecordUpdated = new BeforeRecordUpdatedEventArgs(record, keys, values, oldValues, confirmation);
                this.OnBeforeRecordUpdated(eBeforeRecordUpdated);

                if (eBeforeRecordUpdated.CancelAll)
                {
                    break;
                }

                if (eBeforeRecordUpdated.Cancel)
                {
                    continue;
                }

                if (ds != null)
                {
                    ds.GetView("").Update(keys, values, oldValues, this.UpdateCallback);
                }
                else
                {
                    this.UpdateCallback(0, null);
                }
            }
        }