private bool IsModified(WAYPOINT 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. if (record == null) { return(false); } return(record.IsModified(_context) || record.SupplierProduct.IsModified(_context) || record.GeoCode.IsModified(_context)); //Mapping }
void ClearBindings() { _ignoreLeaveRow = true; _ignorePositionChange = true; _selectedRecord = null; BindingSourceSupplierProduct.Clear(); SetReadOnly(true); BarButtonItemDelete.Enabled = false; BarButtonItemSave.Enabled = false; BindingSource.DataSource = typeof(WAYPOINT); ClearMapData(); //Mapping _ignoreLeaveRow = false; _ignorePositionChange = false; }
void SetBindings() { if (BindingSource.Current == null) { ClearBindings(); } else { _selectedRecord = ((WAYPOINT)BindingSource.Current); LoadAndBindSupplierProducts(); SetReadOnly(false); SetReadOnlyKeyFields(true); BarButtonItemDelete.Enabled = true; BarButtonItemSave.Enabled = true; ShowMapData(_selectedRecord); //Mapping } ErrorProvider.Clear(); }
private void ShowMapData(WAYPOINT record) { GeoCode geoCode = record?.GeoCode ?? new GeoCode(); AddOrMovePushpin(geoCode); //If a bounding box has been given, then use it if (geoCode.NorthLat != 0) { var topLeft = new GeoPoint(geoCode.NorthLat, geoCode.WestLong); var bottomRight = new GeoPoint(geoCode.SouthLat, geoCode.EastLong); MapControl.ZoomToRegion(topLeft, bottomRight, 0); } else { //If there there is no bounding box, zoom all the way out if this is a new record, otherwise go to the //default zoom level MapControl.ZoomLevel = (geoCode.GeoCodeId == 0) ? 1 : 13; } }
private void GridViewLookup_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (!_ignoreLeaveRow) { GridView view = (GridView)sender; object row = view.GetRow(e.FocusedRowHandle); if (row != null && row.GetType() != typeof(DevExpress.Data.NotLoadedObject)) { ReadonlyThreadSafeProxyForObjectFromAnotherThread proxy = (ReadonlyThreadSafeProxyForObjectFromAnotherThread)view.GetRow(e.FocusedRowHandle); WAYPOINT record = (WAYPOINT)proxy.OriginalRow; BindingSource.DataSource = _context.WAYPOINT.Where(c => c.CODE == record.CODE) .Include(c => c.GeoCode); } else { ClearBindings(); } } }