Example #1
0
        private void NewButton_Click( object sender, EventArgs e )
        {
            var dog = Dog.Create();

            using( var dlg = new EditDogForm( dog ) )
            {
                if( dlg.ShowDialog( this ) != DialogResult.OK )
                    return;

                try
                {
                    DogDAL.Insert( dog, Member );

                    Push( dog );

                    LoadDogs();
                    LoadPhotos();

                    Bind();
                    BindPhotos();

                    UpdateView();
                    Pop();

                    UI();
                }
                catch( ApplicationException exc )
                {
                    MessageBox.Show( this, "Error : " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                }
            }
        }
Example #2
0
        private void EditButton_Click( object sender, EventArgs e )
        {
            var dog = CurrentDog;
            if( dog == null )
                return;

            using( var dlg = new EditDogForm( dog ) )
            {
                var result = dlg.ShowDialog( this );
                try
                {
                    if( result == DialogResult.OK )
                        DogDAL.Update( dog );

                    Push( dog );

                    LoadDogs();
                    LoadPhotos();

                    Bind();
                    BindPhotos();

                    UpdateView();

                    Pop();
                    UI();
                }
                catch( ApplicationException exc )
                {
                    MessageBox.Show( this, "Error : " + exc.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                }
            }
        }