Esempio n. 1
0
        public void testAddColumnValues(TestTableNamesReal TestTableName, TestColumnNamesFake TestColumnName)
        {
            Int32          TotalUpdated    = 0;
            CswTableUpdate TestTableUpdate = _CswNbtSchemaModTrnsctn.makeCswTableUpdate("testAddColumnValues_update", _TestTableNamesReal[TestTableName]);
            DataTable      TestTable       = TestTableUpdate.getTable();

            foreach (DataRow CurrentRow in TestTable.Rows)
            {
                CurrentRow[_TestColumnNamesFake[TestColumnName]] = "Test val " + TestTable.Rows.IndexOf(CurrentRow).ToString();
                TotalUpdated++;
            }

            TestTableUpdate.update(TestTable);

            Int32 TotalUpdatedInfact = 0;

            TestTable = TestTableUpdate.getTable();
            foreach (DataRow CurrentRow in TestTable.Rows)
            {
                if ((getTestNameStem(TestNameStem.TestVal) + TestTable.Rows.IndexOf(CurrentRow)) == CurrentRow[_TestColumnNamesFake[TestColumnName]].ToString())
                {
                    TotalUpdatedInfact++;
                }
            }

            if (TotalUpdatedInfact != TotalUpdated)
            {
                throw (new CswDniException("Error adding column " + _TestColumnNamesFake[TestColumnName] + ": updated " + TotalUpdated.ToString() + " rows but retrieved " + TotalUpdatedInfact.ToString() + " with that value"));
            }
        }//_testAddColumnValues()
Esempio n. 2
0
        /// <summary>
        /// Public accessor for the _CAFOrder dictionary so we can use it to change the order in the future
        /// </summary>
        //public Dictionary<string, Int32> CAFImportOrder
        //{
        //    get { return _CAFOrder; }
        //}

        /// <summary>
        /// Build a new UpdateImportMgr for a particular definition
        /// </summary>
        /// <param name="SchemaModTrnsctn">The schema script resources class</param>
        /// <param name="DefinitionName">The IMPORT_DEF definition (use "CAF" for caf imports)</param>
        /// <param name="CafDbLink">Legacy: this should probably change/go away after case 31124</param>
        /// <param name="ImporterSetUpMode">NbtExe or NbtWeb - depending on where you are using the Imp mgr</param>
        public CswNbtSchemaUpdateImportMgr(CswNbtSchemaModTrnsctn SchemaModTrnsctn, string DefinitionName, string CafDbLink = null, CswEnumSetupMode ImporterSetUpMode = CswEnumSetupMode.NbtExe)
        {
            _CAFDbLink            = CafDbLink ?? CswScheduleLogicNbtCAFImport.CAFDbLink;
            _NbtImporter          = new CswNbtImporter(SchemaModTrnsctn.Accessid, ImporterSetUpMode);
            this.SchemaModTrnsctn = SchemaModTrnsctn;

            _importDefTable           = SchemaModTrnsctn.makeCswTableUpdate("Import_getDefs", "import_def").getTable();
            _importOrderTable         = SchemaModTrnsctn.makeCswTableUpdate("Import_getOrder", "import_def_order").getTable();
            _importBindingsTable      = SchemaModTrnsctn.makeCswTableUpdate("Import_getBindings", "import_def_bindings").getTable();
            _importRelationshipsTable = SchemaModTrnsctn.makeCswTableUpdate("Import_getRelationships", "import_def_relationships").getTable();


            _DefinitionName = DefinitionName;
            _SourceColumns  = new CswCommaDelimitedString();

            _SheetDefinitions = SchemaModTrnsctn.createImportDefinitionEntries(DefinitionName, _importDefTable);
        }//ctor
Esempio n. 3
0
        } // addOrderEntries()

        /// <summary>
        /// // first get importdefid from import_def
        // then get each row from import_order that has above importdefid
        // iterate rows, change order column value
        /// </summary>
        /// <param name="CswNbtResources"></param>
        public static void updateOrderEntries(CswNbtSchemaModTrnsctn CswNbtSchemaModTrnsctn)
        {
            Dictionary <string, Int32> CafImportOrder = CswNbtCAFImportOrder.CAFOrder;

            CswTableSelect TblSelect1     = CswNbtSchemaModTrnsctn.makeCswTableSelect("get_caf_importdefid", CswNbtImportTables.ImportDef.TableName);
            DataTable      ImportDefDt    = TblSelect1.getTable("where " + CswNbtImportTables.ImportDef.definitionname + " = 'CAF'");
            Int32          CAFImportDefId = Int32.MinValue;

            if (ImportDefDt.Rows.Count > 0)
            {
                CAFImportDefId = CswConvert.ToInt32(ImportDefDt.Rows[0][CswNbtImportTables.ImportDef.importdefid]);
            }
            CswTableUpdate TblUpdate1    = CswNbtSchemaModTrnsctn.makeCswTableUpdate("update_import_order_caf", CswNbtImportTables.ImportDefOrder.TableName);
            DataTable      ImportOrderDt = TblUpdate1.getTable("where " + CswNbtImportTables.ImportDefOrder.importdefid + " = " + CAFImportDefId);

            foreach (DataRow CurrentRow in ImportOrderDt.Rows)
            {
                string currentNt = CswConvert.ToString(CurrentRow[CswNbtImportTables.ImportDefOrder.nodetypename]);
                Int32  newOrder  = CafImportOrder[currentNt];
                CurrentRow[CswNbtImportTables.ImportDefOrder.importorder] = newOrder;
            }
            TblUpdate1.update(ImportOrderDt);
        }