/// <summary> /// The insert. /// </summary> /// <param name="measure"> /// The measure. /// </param> /// <param name="alphabet"> /// The alphabet. /// </param> /// <param name="building"> /// The building. /// </param> /// <returns> /// The <see cref="long"/>. /// </returns> public long Create(Measure measure, long[] alphabet, int[] building) { List <NpgsqlParameter> parameters = FillParams(measure, alphabet, building); const string Query = @"INSERT INTO measure ( id, value, notation, alphabet, building, beats, beatbase, fifths, major ) VALUES ( @id, @value, @notation, @alphabet, @building, @beats, @beatbase, @fifths, @major );"; db.ExecuteCommand(Query, parameters.ToArray()); return(measure.Id); }
public void Create(ImageSequence sequence, LibiadaWebEntities db) { if (sequence.Id == default) { sequence.Id = db.GetNewElementId(); } var parameters = new List <NpgsqlParameter> { new NpgsqlParameter <long>("id", NpgsqlDbType.Bigint) { TypedValue = sequence.Id }, new NpgsqlParameter <byte>("notation", NpgsqlDbType.Smallint) { TypedValue = (byte)sequence.Notation }, new NpgsqlParameter <long>("matter_id", NpgsqlDbType.Bigint) { TypedValue = sequence.MatterId }, new NpgsqlParameter <byte[]>("image_transformations", NpgsqlDbType.Array | NpgsqlDbType.Smallint) { TypedValue = Array.Empty <byte>() }, new NpgsqlParameter <byte[]>("matrix_transformations", NpgsqlDbType.Array | NpgsqlDbType.Smallint) { TypedValue = Array.Empty <byte>() }, new NpgsqlParameter <byte>("order_extractor", NpgsqlDbType.Smallint) { TypedValue = (byte)sequence.OrderExtractor }, }; const string Query = @"INSERT INTO image_sequence ( id, notation, matter_id, image_transformations, matrix_transformations, order_extractor ) VALUES ( @id, @notation, @matter_id, @image_transformations, @matrix_transformations, @order_extractor );"; db.ExecuteCommand(Query, parameters.ToArray()); }
/// <summary> /// The insert. /// </summary> /// <param name="fmotif"> /// The Fmotif. /// </param> /// <param name="alphabet"> /// The alphabet. /// </param> /// <param name="building"> /// The building. /// </param> /// <returns> /// The <see cref="long"/>. /// </returns> public long Create(Fmotif fmotif, long[] alphabet, int[] building) { List <NpgsqlParameter> parameters = FillParams(fmotif, alphabet, building); const string Query = @"INSERT INTO fmotif ( id, value, notation, alphabet, building, fmotif_type ) VALUES ( @id, @value, @notation, @alphabet, @building, @fmotif_type );"; db.ExecuteCommand(Query, parameters.ToArray()); return(fmotif.Id); }