//insert public static void Insert(DbLink dbLink, fin_field fin_filed) { string query = @"insert into fin_field(fif_id, ident, title, description) values(nextval('mir_sequence'), @ident, @title, @description);"; dbLink.GetConnection().Execute(query, fin_filed); }
public void TestInsertFinField() { var tempConnection = DataBaseLink.Fabricate.CreateConnection(_connection, DataBaseLink.ConnectionType.Npgsql); DataBaseLink.DbLink dbLink = new DbLink(tempConnection); fin_field fin_field = new fin_field() { ident = "Start_Date", title = "Дата размещения", description = "Дата размещения", }; if (FinField.FindId(dbLink, fin_field.ident) == null) { FinField.Insert(dbLink, fin_field); } }
public void TestRemoveFinField() { var tempConnection = DataBaseLink.Fabricate.CreateConnection(_connection, DataBaseLink.ConnectionType.Npgsql); DataBaseLink.DbLink dbLink = new DbLink(tempConnection); fin_field fin_field = new fin_field() { ident = "ROMAN", title = "ROMAN", description = "roman" }; if (FinField.FindId(dbLink, fin_field.ident) == null) { FinField.Insert(dbLink, fin_field); var result = FinField.FindId(dbLink, fin_field.ident); FinField.Remove(dbLink, result.fif_id); } else { var result = FinField.FindId(dbLink, fin_field.ident); FinField.Remove(dbLink, result.fif_id); } }