Example #1
0
        }// CAFimportOrder()

        /// <summary>
        /// Declare a new binding from a column in the source data to a NTP in NBT in the IMPORT_DEF_BINDINGS table.
        /// </summary>
        /// <param name="SourceColumnName">The column in the source data for this binding</param>
        /// <param name="DestPropertyName">The NTP to which the data will be imported</param>
        /// <param name="DestSubFieldName">The subfield on the NTP where the data should be stored</param>
        /// <param name="SheetName">The sheet being used for this import. If left out, default to "CAF"</param>
        /// <param name="DestNodeTypeName">The Nodetype where data will be imported. If left out, will default to the
        /// last nodetype set with importOrder or the last manually set DestNodeType.</param>
        /// <param name="Instance">Sets which entry in IMPORT_DEF_ORDER this binding should be associated with</param>
        /// <param name="BlobTableName">The source table for BLOB data being imported from CAF, if this binding is to a LOB</param>
        /// <param name="ClobTableName">The source table for CLOB data being imported from CAF, if this binding is to a LOB</param>
        /// <param name="LobDataPkColOverride">The column that stores the value of the PK for the LOB table</param>
        /// <param name="LobDataPkColName">The PK Column of the LOB table, if it differs from the column in the table the stores the PK used to access the LOB table</param>
        /// <param name="LegacyPropId">The CAF PropertyId (used for CAF Props only)</param>
        public void importBinding(string SourceColumnName, string DestPropertyName, string DestSubFieldName, string SheetName = null, string DestNodeTypeName = null, Int32 Instance = Int32.MinValue, string BlobTableName = "", string ClobTableName = "", string LobDataPkColOverride = "", string LobDataPkColName = "", Int32 LegacyPropId = Int32.MinValue)
        {
            if (null != _NbtImporter)
            {
                SheetName        = SheetName ?? CswScheduleLogicNbtCAFImport.DefinitionName;
                DestNodeTypeName = DestNodeTypeName ?? DefaultNodetype; //default to the last nodetype defined in ImportOrder
                if (CswAll.AreStrings(SheetName, DestNodeTypeName, DestPropertyName, SourceColumnName))
                {
                    _SourceColumns.Add(SourceColumnName, AllowNullOrEmpty: false, IsUnique: true);

                    DataRow row = _importBindingsTable.NewRow();
                    row["importdefid"]          = _SheetDefinitions[SheetName];
                    row["destnodetypename"]     = DestNodeTypeName;
                    row["destpropname"]         = DestPropertyName;
                    row["destsubfield"]         = DestSubFieldName;
                    row["sourcecolumnname"]     = SourceColumnName;
                    row["instance"]             = Instance;
                    row["blobtablename"]        = BlobTableName;
                    row["clobtablename"]        = ClobTableName;
                    row["lobdatapkcoloverride"] = LobDataPkColOverride;
                    row["lobdatapkcolname"]     = LobDataPkColName;
                    row["legacypropid"]         = LegacyPropId;
                    _importBindingsTable.Rows.Add(row);
                }
            }
        } // _importBinding()
Example #2
0
        } // importOrder()

        /// <summary>
        /// Declare a new entry in the list of imported nodetypes for CAF in IMPORT_DEF_ORDER, and set
        /// that nodetype as the default for new bindings with this ImportMgr.
        /// </summary>
        /// <param name="NodeTypeName">The string used to identify this nodetype</param>
        /// <param name="TableName">The source table where these nodes were originally stored in CAF (even if a view is used)</param>
        /// <param name="ViewName">The view where CAF importer should pull node data from, if one was used</param>
        /// <param name="PkColumnName">The PK column of the view/table that should be used to set legacy Ids for imported nodes. If blank,
        /// will attempt to do a lookup in DATA_DICTIONARY for the table's original PK column.</param>
        /// <param name="createLegacyId">Whether or not the Legacy Id column should be autogenerated from PKColumnName</param>
        /// <param name="Instance">Used to differentiate the same nodetype imported from multiple places</param>
        public void CAFimportOrder(string NodeTypeName, string TableName, string ViewName = null, string PkColumnName = null, bool createLegacyId = true, Int32 Instance = Int32.MinValue)
        {
            DefaultNodetype = NodeTypeName;
            if (CswAll.AreStrings(NodeTypeName, TableName, PkColumnName))
            {
                DataRow row = _importOrderTable.NewRow();
                row["importdefid"]  = _SheetDefinitions[CswScheduleLogicNbtCAFImport.DefinitionName];
                row["nodetypename"] = NodeTypeName;
                row["importorder"]  = CswNbtCAFImportOrder.CAFOrder[NodeTypeName];
                row["instance"]     = Instance;
                row["tablename"]    = TableName;
                row["viewname"]     = ViewName;
                row["pkcolumnname"] = PkColumnName;
                _importOrderTable.Rows.Add(row);

                if (createLegacyId)
                {
                    if (string.IsNullOrEmpty(PkColumnName))
                    {
                        throw new CswDniException(CswEnumErrorType.Error, "Tried to autogenerate legacyid binding, but did not supply a PK column name.", "");
                    }
                    importBinding(PkColumnName, "Legacy Id", "");
                }
            }
            else
            {
                throw new CswDniException(CswEnumErrorType.Error, "Failed to validate inputs for CAF import order: " + NodeTypeName, "One of the required fields was missing.");
            }
        }// CAFimportOrder()
Example #3
0
        } // _importBinding()

        public void importRelationship(string SheetName, string NodetypeName, string RelationshipPropName, Int32 Instance = Int32.MinValue, string SourceRelColumnName = "")
        {
            if (null != _NbtImporter)
            {
                if (CswAll.AreStrings(SheetName, NodetypeName, RelationshipPropName))
                {
                    DataRow row = _importRelationshipsTable.NewRow();
                    row["importdefid"]         = _SheetDefinitions[SheetName];
                    row["nodetypename"]        = NodetypeName;
                    row["relationship"]        = RelationshipPropName;
                    row["instance"]            = Instance;
                    row["sourcerelcolumnname"] = SourceRelColumnName;
                    _importRelationshipsTable.Rows.Add(row);
                }
            }
        } // _importRelationship()