private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var uow = (gridView.GetRow(0) as BookBase).Session as UnitOfWork; var obj = new BookBase(uow); using (var dlg = new BaseBookEditForm(obj)) { if (dlg.ShowDialog() == DialogResult.OK) { dlg.Save(); uow.CommitChanges(); LoadData(); } } }
private void gridView_DoubleClick(object sender, EventArgs e) { var obj = gridView.GetFocusedRow() as BookBase; if (obj.IsNotNull()) { using (var dlg = new BaseBookEditForm(obj)) { if (dlg.ShowDialog() == DialogResult.OK) { dlg.Save(); var uow = dlg.Object.Session as UnitOfWork; uow.CommitChanges(); uow.ReloadChangedObjects(); } } } }