public List<Actor> GetActorsNotInMovie(int movieID) { List<Actor> results = new List<Actor>(); using (var cn = new SqlConnection(Settings.GetConnectionString())) { var cmd = new SqlCommand("ActorGetNotInMovie", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@MovieID", movieID); cn.Open(); using (var dr = cmd.ExecuteReader()) { while (dr.Read()) { var actor = new Actor(); actor.ActorID = (int)dr["ActorID"]; actor.FirstName = dr["FirstName"].ToString(); actor.LastName = dr["LastName"].ToString(); if (dr["DateOfBirth"] != DBNull.Value) { actor.DateOfBirth = (DateTime)dr["DateOfBirth"]; } results.Add(actor); } } } return results; }
private void GenerateActorRecordsTask( long quantity, RepositoryOperationResult state ) { state.StartDateTime = DateTime.Now; state.MaxIteration = quantity; state.State = RepositoryOperationResultState.InProcess; var actorCollection = _dataBase.GetCollection( ActorCollectionName ); var lastNumber = FindLastNumber( actorCollection, NameFieldName, _actorRegex ) + 1; for (int i = 0; i < quantity; i++, lastNumber++) { var actor = new Actor { Id = ObjectId.GenerateNewId(), Name = string.Format( DefaultActorNameFormat, lastNumber ), Biography = string.Format( DefaultActorBiographyTextFormat, lastNumber ), }; actorCollection.Insert( actor ); state.IterationDone++; } state.EndDateTime = DateTime.Now; state.State = RepositoryOperationResultState.Success; }
public ActorShortDetail(Actor actor) { Id = actor.Id; Name = actor.Name; }