Exemplo n.º 1
0
        private void writePowierzchniaDataToDB(ModelPowierzchnia pow)
        {
            string tableName = "";
            uint   newIdPow  = uint.Parse(pow.idPow.ToString());

            tableName = dbConnector.getTableNameFromQuery(SqlQueries.getPoints);
            ModelPunkty points = pow.points;

            if (points.setNewIdPow(newIdPow))
            {
                dbWriter.writeBulkDataToDB(points.pointData, tableName);
            }

            tableName = dbConnector.getTableNameFromQuery(SqlQueries.getTriangles);
            ModelTriangles triangles = pow.triangles;

            if (triangles != null)                              //jest null jeżeli zapisuję same punkty
            {
                if (triangles.setNewIdPow(newIdPow))
                {
                    dbWriter.writeBulkDataToDB(triangles.triangleData, tableName);
                }
            }

            tableName = dbConnector.getTableNameFromQuery(SqlQueries.getGrids);
            ModelGrid grids = pow.grids;

            if (grids.setNewIdPow(newIdPow))
            {
                dbWriter.writeBulkDataToDB(grids.gridData, tableName);
            }

            tableName = dbConnector.getTableNameFromQuery(SqlQueries.getBreaklines);
            ModelLinie breaklines = pow.breaklines;

            if (breaklines.setNewIdPow(newIdPow))
            {
                dbWriter.writeBulkDataToDB(breaklines.breaklineData, tableName);
            }
        }