public IEnumerable <Copybook> GetCopybooks(int typeId) { using (SqlCommand command = _connection.CreateCommand()) { command.CommandText = @"SELECT Tb_CopyBook.Id,Tb_CopyBook.Title,Tb_CopybookType.TypeName,Tb_CopyBook.Author,Tb_CopyBook.FontType,Tb_CopyBook.Content FROM Tb_CopyBook LEFT JOIN Tb_CopybookType on Tb_CopyBook.TypeId=Tb_CopybookType.TypeId WHERE Tb_CopyBook.TypeId=@typeId ORDER BY Tb_CopyBook.TypeId,Tb_CopyBook.Title"; command.Parameters.AddWithValue("@typeId", typeId); SqlDataReader reader = GetSqlDataReader(command); while (reader.Read()) { Copybook book = new Copybook { Id = reader.GetGuid(0), Title = reader.GetString(1), BookType = reader.GetString(2), Author = reader.GetString(3), FontType = reader.GetString(4), Content = reader.GetString(5) }; yield return(book); } reader.Close(); CloseConnection(); } }
public UserPlay(Clock startsAt, Copybook copybook) { StartsAt = startsAt; FinishesAt = startsAt + (copybook.FinishesAt - copybook.StartsAt); Copybook = copybook; Notes = copybook.Select(note => MoveCopybookNotesBasedOnLocalClock(note)).ToList(); }
void Awake() { var tempo = 130f; var notes = new List<Note>() { new Note(new Clock(tempo , 4 * 0 + 0), NoteNumber.C), new Note(new Clock(tempo , 4 * 0 + 1), NoteNumber.D), new Note(new Clock(tempo , 4 * 0 + 2), NoteNumber.E), new Note(new Clock(tempo , 4 * 0 + 3), NoteNumber.E), new Note(new Clock(tempo , 4 * 1 + 1), NoteNumber.D), new Note(new Clock(tempo , 4 * 1 + 2), NoteNumber.C), }; var copybook = new Copybook(new Clock(tempo, 4 * 0), new Clock(tempo, 4 * 4), notes); var userplay = new UserPlay(new Clock(tempo, 4 * 4), copybook); var phases = new List<IPlayPhase>() { copybook, userplay, }; Score = new Score(phases); }
public void BasicRecordWithoutOptions() { Copybook book = this.testSingleSentence( "01 TOP.", new BasicRecord() { Level = new Int() { Value = "01" }, LevelName = new LevelName() { HasFiller = false, Identifier = new Identifier() { Name = "TOP" } }, Options = new List <Option>() { } } ); Assert.AreEqual(((BasicRecord)book.Records[0]).Level.Value, "01"); }
private Copybook testSingleSentence(string src, Record expected) { Copybook book = this.parse(src); Assert.AreEqual(1, book.Records.Count); Assert.AreEqual(expected.ToString(), book.Records[0].ToString()); return(book); }
/// <summary> /// @see AbstractItemCountingItemStreamItemReader#DoOpen /// </summary> protected override void DoOpen() { Assert.IsTrue(Resource.Exists(), "The input file must exist."); _inputStream = new BufferedStream(Resource.GetInputStream()); FileFormat fileFormat = CopybookLoader.LoadCopybook(Copybook.GetInputStream()); _reader = new EbcdicReader(_inputStream, fileFormat, Rdw); EbcdicReaderMapper.RecordFormatMap = new RecordFormatMap(fileFormat); _nbRead = 0; Name = string.Concat("EbcdicFileReader.", Resource.GetFilename()); }
public IEnumerable <Copybook> GetCopybooks() { SqlDataReader reader = GetSqlDataReader(@"SELECT Tb_CopyBook.Id,Tb_CopyBook.Title,Tb_CopybookType.TypeName,Tb_CopyBook.Author,Tb_CopyBook.FontType,Tb_CopyBook.Content FROM Tb_CopyBook LEFT JOIN Tb_CopybookType on Tb_CopyBook.TypeId=Tb_CopybookType.TypeId ORDER BY Tb_CopyBook.TypeId,Tb_CopyBook.Title"); while (reader.Read()) { Copybook book = new Copybook { Id = reader.GetGuid(0), Title = reader.GetString(1), BookType = reader.GetString(2), Author = reader.GetString(3), FontType = reader.GetString(4), Content = reader.GetString(5) }; yield return(book); } reader.Close(); CloseConnection(); }