public void WriteToDatabase(SQLiteConnection connection) { var temp = this; WriteToDatabase0(connection); origin.WriteToDatabase(connection); pointBottom.WriteToDatabase(connection); pointTop.WriteToDatabase(connection); if (!DBAreaBorder.HasRow(connection, handle, file.ID)) { WriteToDatabase0(connection); origin.ID = DBPoint3D.InsertRow(ref origin, connection); pointTop.ID = DBPoint3D.InsertRow(ref pointTop, connection); pointBottom.ID = DBPoint3D.InsertRow(ref pointBottom, connection); } else { AreaBorderModel model = DBAreaBorder.SelectRow(connection, handle, file.ID); ID = model.ID; UpdateToDatabase0(model.matrixTransform.ID, model.position.ID, connection); origin.ID = model.ID; pointTop.ID = model.ID; pointBottom.ID = model.ID; DBPoint3D.UpdateRow(origin, connection); DBPoint3D.UpdateRow(pointTop, connection); DBPoint3D.UpdateRow(pointBottom, connection); DBAreaBorder.UpdateRow(connection, this); } }
public void WriteToDabase(SQLiteConnection connection) { if (!DBFixture_Unit.HasRow(connection, handle, file.ID)) { var temp = this; WriteToDatabase0(connection); if (tagPos != null) { tagPos.WriteToDatabase(connection); } if (ventPos != null) { ventPos.WriteToDatabase(connection); } if (drainPos != null) { drainPos.WriteToDatabase(connection); } if (hotStub != null) { hotStub.WriteToDatabase(connection); } if (coldStub != null) { coldStub.WriteToDatabase(connection); } if (R1 != null) { R1.WriteToDatabase(connection); } if (V != null) { V.WriteToDatabase(connection); } //Tag can never be null M.WriteToDatabase(connection); ID = DBFixture_Unit.InsertRow(connection, ref temp); } else { FixtureUnitModel model = DBFixture_Unit.SelectRow(connection, handle, file.ID); ID = model.ID; UpdateToDatabase0(model.matrixTransform.ID, model.position.ID, connection); if (model.tagPos != null) { tagPos.ID = model.tagPos.ID; tagPos.WriteToDatabase(connection); } if (model.ventPos != null) { ventPos.ID = model.ventPos.ID; ventPos.WriteToDatabase(connection); } if (model.drainPos != null) { drainPos.ID = model.drainPos.ID; drainPos.WriteToDatabase(connection); } if (model.hotStub != null) { hotStub.ID = model.hotStub.ID; hotStub.WriteToDatabase(connection); } if (model.coldStub != null) { coldStub.ID = model.coldStub.ID; coldStub.WriteToDatabase(connection); } if (model.R1 != null) { R1.ID = model.R1.ID; R1.WriteToDatabase(connection); } if (model.V != null) { V.ID = model.V.ID; V.WriteToDatabase(connection); } M.ID = model.M.ID; M.WriteToDatabase(connection); DBFixture_Unit.UpdateRow(connection, this); } }
protected virtual void WriteToDatabase0(SQLiteConnection connection) { position.WriteToDatabase(connection); matrixTransform.WriteToDatabase(connection); }