Esempio n. 1
0
        public static FederatedModelInfo getFederatedModelByID(int FedID)
        {
            FederatedModelInfo fedModel = new FederatedModelInfo();
            string             currStep = "Getting federated ID";

            // Create separate connection with a short duration

            string           SqlStmt = "Select FEDERATEDID federatedID, ModelName, ProjectNumber, ProjectName, WORLDBBOX, MAXOCTREELEVEL, LastUpdateDate, Owner, DBConnection from BIMRL_FEDERATEDMODEL where FederatedID=" + FedID.ToString();
            OracleCommand    command = new OracleCommand(SqlStmt, DBConn);
            OracleDataReader reader  = command.ExecuteReader();

            try
            {
                if (!reader.Read())
                {
                    reader.Close();
                    return(null);
                }

                fedModel.FederatedID   = reader.GetInt32(0);
                fedModel.ModelName     = reader.GetString(1);
                fedModel.ProjectNumber = reader.GetString(2);
                fedModel.ProjectName   = reader.GetString(3);
                if (!reader.IsDBNull(4))
                {
                    SdoGeometry worldBB = reader.GetValue(4) as SdoGeometry;
                    Point3D     LLB     = new Point3D(worldBB.OrdinatesArrayOfDoubles[0], worldBB.OrdinatesArrayOfDoubles[1], worldBB.OrdinatesArrayOfDoubles[2]);
                    Point3D     URT     = new Point3D(worldBB.OrdinatesArrayOfDoubles[3], worldBB.OrdinatesArrayOfDoubles[4], worldBB.OrdinatesArrayOfDoubles[5]);
                    fedModel.WorldBoundingBox = LLB.ToString() + " " + URT.ToString();
                }
                if (!reader.IsDBNull(5))
                {
                    fedModel.OctreeMaxDepth = reader.GetInt16(5);
                }
                if (!reader.IsDBNull(6))
                {
                    fedModel.LastUpdateDate = reader.GetDateTime(6);
                }
                if (!reader.IsDBNull(7))
                {
                    fedModel.Owner = reader.GetString(7);
                }
                if (!reader.IsDBNull(8))
                {
                    fedModel.DBConnection = reader.GetString(8);
                }

                reader.Close();
            }
            catch (OracleException e)
            {
                string excStr = "%%Error - " + e.Message + "\n\t" + currStep;
                refBIMRLCommon.StackPushError(excStr);
                command.Dispose();
                throw;
            }

            command.Dispose();
            return(fedModel);
        }
Esempio n. 2
0
        public static string formatTabName(string rawTabName, int FedID)
        {
            FederatedModelInfo fedInfo = getFederatedModelByID(FedID);

            if (fedInfo == null)
            {
                return(null);
            }
            return((fedInfo.Owner + "." + rawTabName + "_" + fedInfo.FederatedID.ToString("X4")).ToUpper());
        }
Esempio n. 3
0
        public static FedIDStatus getFederatedModel(string modelName, string projName, string projNumber, out FederatedModelInfo fedModel)
        {
            fedModel = new FederatedModelInfo();
            FedIDStatus stat     = FedIDStatus.FedIDExisting;
            string      currStep = "Getting federated ID";

            // Create separate connection with a short duration

            string           SqlStmt = "Select FEDERATEDID federatedID, ModelName, ProjectNumber, ProjectName, WORLDBBOX, MAXOCTREELEVEL, LastUpdateDate, Owner, DBConnection from BIMRL_FEDERATEDMODEL where MODELNAME = '" + modelName + "' and PROJECTNAME = '" + projName + "' and PROJECTNUMBER = '" + projNumber + "'";
            OracleCommand    command = new OracleCommand(SqlStmt, DBConn);
            OracleDataReader reader  = command.ExecuteReader();

            try
            {
                if (!reader.Read())
                {
                    reader.Close();
                    // Create a new record
                    command.CommandText = "Insert into BIMRL_FEDERATEDMODEL (MODELNAME, PROJECTNAME, PROJECTNUMBER) values ('" + modelName + "', '" + projName + "', '" + projNumber + "')";
                    DBOperation.beginTransaction();
                    command.ExecuteNonQuery();
                    DBOperation.commitTransaction();
                    stat = FedIDStatus.FedIDNew;
                }

                command.CommandText = SqlStmt;
                reader = command.ExecuteReader();
                reader.Read();

                fedModel.FederatedID   = reader.GetInt32(0);
                fedModel.ModelName     = reader.GetString(1);
                fedModel.ProjectNumber = reader.GetString(2);
                fedModel.ProjectName   = reader.GetString(3);
                if (!reader.IsDBNull(4))
                {
                    SdoGeometry worldBB = reader.GetValue(4) as SdoGeometry;
                    Point3D     LLB     = new Point3D(worldBB.OrdinatesArrayOfDoubles[0], worldBB.OrdinatesArrayOfDoubles[1], worldBB.OrdinatesArrayOfDoubles[2]);
                    Point3D     URT     = new Point3D(worldBB.OrdinatesArrayOfDoubles[3], worldBB.OrdinatesArrayOfDoubles[4], worldBB.OrdinatesArrayOfDoubles[5]);
                    fedModel.WorldBoundingBox = LLB.ToString() + " " + URT.ToString();
                }
                if (!reader.IsDBNull(5))
                {
                    fedModel.OctreeMaxDepth = reader.GetInt16(5);
                }
                if (!reader.IsDBNull(6))
                {
                    fedModel.LastUpdateDate = reader.GetDateTime(6);
                }
                if (!reader.IsDBNull(7))
                {
                    fedModel.Owner = reader.GetString(7);
                }
                if (!reader.IsDBNull(8))
                {
                    fedModel.DBConnection = reader.GetString(8);
                }

                reader.Close();
            }
            catch (OracleException e)
            {
                string excStr = "%%Error - " + e.Message + "\n\t" + currStep;
                refBIMRLCommon.StackPushError(excStr);
                command.Dispose();
                throw;
            }
            command.Dispose();

            return(stat);
        }