private bool IsModified(ROOMCOD record) { //Type-specific routine that takes into account relationships that should also be considered //when deciding if there are unsaved changes. The entity properties also return true if the //record is new or deleted. return(record.IsModified(_context)); }
private void BarButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _ignoreLeaveRow = true; //so that when the grid row changes it doesn't try to save again if (SaveRecord(true)) { GridViewLookup.ClearColumnsFilter(); //so that the new record will show even if it doesn't match the filter _selectedRecord = (ROOMCOD)BindingSource.AddNew(); //if (GridViewRoute.FocusedRowHandle == GridControl.AutoFilterRowHandle) GridViewLookup.FocusedRowHandle = GridViewLookup.RowCount - 1; SetReadOnlyKeyFields(false); TextEditCode.Focus(); SetReadOnly(false); } ErrorProvider.Clear(); _ignoreLeaveRow = false; }
void SetBindings() { //If the route list is filtered, there will be rows in the binding source //that are not visible, and they can become selected if the last visible row //is deleted, so handle that by checking rowcount. if (BindingSource.Current == null) { _selectedRecord = null; SetReadOnly(true); } else { _selectedRecord = ((ROOMCOD)BindingSource.Current); SetReadOnly(false); SetReadOnlyKeyFields(true); } ErrorProvider.Clear(); }