Exemple #1
0
        private void readPowierzchniaDataFromDB(ModelPowierzchnia pow)
        {
            string   query    = "";
            DBReader dbReader = new DBReader(dbConnection);

            ModelPunkty points = new ModelPunkty();

            query            = SqlQueries.getPoints + pow.idPow;
            points.pointData = dbReader.readFromDBToDataTable(query);
            pow.points       = points;

            if (saveModelOption == 1)           //tj pełne modele, tylko wtedy wczytuję trójkąty
            {
                ModelTriangles triangles = new ModelTriangles();
                query = SqlQueries.getTriangles + pow.idPow;
                triangles.triangleData = dbReader.readFromDBToDataTable(query);
                pow.triangles          = triangles;
            }

            ModelLinie breaklines = new ModelLinie();

            query = SqlQueries.getBreaklines + pow.idPow;
            breaklines.breaklineData = dbReader.readFromDBToDataTable(query);
            pow.breaklines           = breaklines;

            ModelGrid grids = new ModelGrid();

            query          = SqlQueries.getGrids + pow.idPow;
            grids.gridData = dbReader.readFromDBToDataTable(query);
            pow.grids      = grids;
        }
Exemple #2
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);
            }
        }