public void ValidateRowDeletion(DevExpress.Mvvm.Xpf.ValidateRowDeletionArgs args) { using (var unitOfWork = new DevExpress.Xpo.UnitOfWork()) { var key = DetachedObjectsHelper.GetKey(args.Items.Single()); var item = unitOfWork.GetObjectByKey <XPOIssues.Issues.Issue>(key); unitOfWork.Delete(item); unitOfWork.CommitChanges(); } }
void OnValidateRowDeletion(System.Object sender, DevExpress.Xpf.Grid.GridValidateRowDeletionEventArgs e) { using (var unitOfWork = new DevExpress.Xpo.UnitOfWork()) { var key = _DetachedObjectsHelper.GetKey(e.Rows.Single()); var item = unitOfWork.GetObjectByKey <XPOIssues.Issues.Issue>(key); unitOfWork.Delete(item); unitOfWork.CommitChanges(); } }
public void ValidateRow(DevExpress.Mvvm.Xpf.RowValidationArgs args) { using (var unitOfWork = new DevExpress.Xpo.UnitOfWork()) { var item = args.IsNewItem ? new XPOIssues.Issues.Issue(unitOfWork) : unitOfWork.GetObjectByKey <XPOIssues.Issues.Issue>(DetachedObjectsHelper.GetKey(args.Item)); DetachedObjectsHelper.ApplyProperties(item, args.Item); unitOfWork.CommitChanges(); if (args.IsNewItem) { DetachedObjectsHelper.SetKey(args.Item, item.Oid); } } }
void OnValidateRow(System.Object sender, DevExpress.Xpf.Grid.GridRowValidationEventArgs e) { using (var unitOfWork = new DevExpress.Xpo.UnitOfWork()) { var item = e.IsNewItem ? new XPOIssues.Issues.Issue(unitOfWork) : unitOfWork.GetObjectByKey <XPOIssues.Issues.Issue>(_DetachedObjectsHelper.GetKey(e.Row)); _DetachedObjectsHelper.ApplyProperties(item, e.Row); unitOfWork.CommitChanges(); if (e.IsNewItem) { _DetachedObjectsHelper.SetKey(e.Row, item.Oid); } } }