public AddUpdateMovieForm(Movie movie, ActorDirectorGetter actorDirectorGetter, LocationGetter locationGetter, MovieAdder movieAdder) { InitializeComponent(); _isInitialising = true; _movie = movie; _actorDirectorGetter = actorDirectorGetter; _locationGetter = locationGetter; _movieAdder = movieAdder; movieBindingSource.DataSource = _movie; actorBindingSource.DataSource = _actorDirectorGetter.GetListForAddUpdateMovie(); directorBindingSource.DataSource = _actorDirectorGetter.GetListForAddUpdateMovie(isForDirectors: true); locationBindingSource.DataSource = _locationGetter.GetList(); if (_movie.IsNew) { Text = "Add Movie"; } else { Text = _movie.Title; submitButton.Text = "OK"; closeButton.Text = "Cancel"; SelectCorrectActor(); SelectCorrectDirector(); SelectCorrectLocation(); } _isInitialising = false; }
public MainForm() { //TODO Add a splash screen while loading all this stuff (it could take a while // with lots of actors, directors, or locations) //TODO Add an icon for the application and all resizable forms //TODO Implement sorting on all grids //TODO Move Domain and Models into their own assembly (MovieCollectionLib), so we // can have multiple types of clients all using it //TODO Add linking table between Movie and Actor, so we can have multiple actors // per movie, and update UI and all code to support this //TODO Make LocationsForm and ActorsDirectorsForm single instance Cursor = Cursors.WaitCursor; _isInitialising = true; InitializeComponent(); _actorDirectorGetter = new ActorDirectorGetter(); _locationGetter = new LocationGetter(); _movieResultGetter = new MovieResultGetter(); _movieGetter = new MovieGetter(); _movieAdder = new MovieAdder(); RefreshActors(); RefreshDirectors(); RefreshLocations(); _isInitialising = false; DoFilter(); //This will set the cursor back to default }
public LocationsForm(LocationGetter locationGetter, MovieGetter movieGetter) { Cursor = Cursors.WaitCursor; InitializeComponent(); _locationAdder = new LocationAdder(); _locationGetter = locationGetter; _movieGetter = movieGetter; RefreshData(); Cursor = Cursors.Default; }
public void Validate(LocationGetter locationGetter) { if (string.IsNullOrWhiteSpace(Description)) { throw new LocationValidationException("Description cannot be blank."); } if (locationGetter.IsExistingByDescription(Description, Id)) { throw new LocationValidationException( $"A location named {Description} already exists."); } }
public AddUpdateLocationForm(Location location, LocationGetter locationGetter, LocationAdder locationAdder) { InitializeComponent(); _location = location; _locationGetter = locationGetter; _locationAdder = locationAdder; _locationUpdater = new LocationUpdater(); locationBindingSource.DataSource = _location; if (_location.IsNew) { Text = "Add Location"; } else { Text = _location.Description; } }