private void NewButton_Click( object sender, EventArgs e ) { var dogEvent = DogEvent.Create(); using( var dlg = new EditDogEventForm( dogEvent, dogEvents ) ) { if( dlg.ShowDialog( this ) != DialogResult.OK ) return; try { DogEventDAL.Insert( dogEvent ); Push( dogEvent ); LoadEvents(); Bind(); UpdateView(); Pop(); } catch( ApplicationException exc ) { MessageBox.Show( this, "Error : " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } }
private void EditButton_Click( object sender, EventArgs e ) { var dogEvent = CurrentEvent; if( dogEvent == null ) return; using( var dlg = new EditDogEventForm( dogEvent, dogEvents ) ) { var result = dlg.ShowDialog( this ); try { if( result == DialogResult.OK ) DogEventDAL.Update( dogEvent ); Push( dogEvent ); LoadEvents(); Bind(); UpdateView(); Pop(); } catch( ApplicationException exc ) { MessageBox.Show( this, "Error : " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } } }