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 ActorsDirectorsForm(ActorDirectorGetter actorDirectorGetter, MovieGetter movieGetter) { Cursor = Cursors.WaitCursor; InitializeComponent(); _actorDirectorAdder = new ActorDirectorAdder(); _actorDirectorGetter = actorDirectorGetter; _movieGetter = movieGetter; RefreshData(); Cursor = Cursors.Default; }
public void Validate(ActorDirectorGetter actorDirectorGetter, MovieGetter movieGetter) { if (string.IsNullOrWhiteSpace(Name)) { throw new ActorDirectorValidationException("Name cannot be blank."); } if (!IsActor && !IsDirector) { throw new ActorDirectorValidationException("You must select either \"Is Actor\" or \"Is Director\" (or both)"); } if (actorDirectorGetter.IsExistingByName(Name, Id)) { throw new ActorDirectorValidationException( $"An actor or director named {Name} already exists."); } DoMovieChecks(!IsDirector, !IsActor, movieGetter); }
public AddUpdateActorDirectorForm(ActorDirector actorDirector, ActorDirectorGetter actorDirectorGetter, ActorDirectorAdder actorDirectorAdder, MovieGetter movieGetter) { InitializeComponent(); _actorDirector = actorDirector; _actorDirectorGetter = actorDirectorGetter; _actorDirectorAdder = actorDirectorAdder; _actorDirectorUpdater = new ActorDirectorUpdater(); _movieGetter = movieGetter; actorDirectorBindingSource.DataSource = _actorDirector; if (_actorDirector.IsNew) { base.Text = "Add Actor / Director"; } else { base.Text = _actorDirector.Name; } }