protected virtual void OnBeforeRecordDeleted(BeforeRecordDeletedEventArgs e) { BeforeRecordDeletedEventHandler handler = (BeforeRecordDeletedEventHandler)Events[EventBeforeRecordDeleted]; if (handler != null) { handler(this, e); } }
private void MakeDeletes(IDataSource ds, JArray data) { string id = this.ModelInstance.GetIDProperty(); foreach (JToken token in data) { this.record = token; values = new SortedList(0); keys = new SortedList(); oldValues = new SortedList(0); if (id.IsNotEmpty()) { string idStr = token.Value <string>(id); int idInt; if (int.TryParse(idStr, out idInt)) { keys[id] = idInt; } else { keys[id] = idStr; } } BeforeRecordDeletedEventArgs eBeforeRecordDeleted = new BeforeRecordDeletedEventArgs(record, keys); 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); } } }
private void MakeDeletes(IDataSource ds, JArray data) { string id = this.ModelInstance.GetIDProperty(); foreach (JToken token in data) { this.record = token; values = new SortedList(0); keys = new SortedList(); oldValues = new SortedList(0); if (id.IsNotEmpty()) { string idStr = token.Value<string>(id); int idInt; if (int.TryParse(idStr, out idInt)) { keys[id] = idInt; } else { keys[id] = idStr; } } BeforeRecordDeletedEventArgs eBeforeRecordDeleted = new BeforeRecordDeletedEventArgs(record, keys); 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); } } }
protected virtual void OnBeforeRecordDeleted(BeforeRecordDeletedEventArgs e) { BeforeRecordDeletedEventHandler handler = (BeforeRecordDeletedEventHandler)Events[EventBeforeRecordDeleted]; if (handler != null) { handler(this, e); } }
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 (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()]; } } 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; } }
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 (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()]; } } 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; } }