Пример #1
0
        private static Guid FindGroupID(DBTable gruppeTable, DBRunner runner, ISQLExecuter executer, DBConnection connection)
        {
            SQL_SelectStatement sqlSelect = new SQL_SelectStatement();

            sqlSelect.AddColumn(gruppeTable, "uiGruppeID");
            sqlSelect.AddCriteria(new Crit_MatchCriteria(gruppeTable, "txNavn", MatchType.Equal, "Dødsattester midlertidig opbevaring"));
            DBRow row = runner.SelectAndReturnFirstRow(executer, connection, sqlSelect);

            if (row == null)
            {
                return(Guid.Empty);
            }

            return((Guid)row["uiGruppeID"]);
        }
Пример #2
0
        private static Guid FindPluginID(DBTable pluginsTable, DBRunner runner, ISQLExecuter executer, DBConnection connection)
        {
            SQL_SelectStatement sqlSelect = new SQL_SelectStatement();

            sqlSelect.AddColumn(pluginsTable, "uiPluginID");
            sqlSelect.AddCriteria(new Crit_MatchCriteria(pluginsTable, "txNavn", MatchType.Equal, "dk.hob.ei.mortality.Plugin"));
            DBRow row = runner.SelectAndReturnFirstRow(executer, connection, sqlSelect);

            if (row == null)
            {
                return(Guid.Empty);
            }

            return((Guid)row["uiPluginID"]);
        }
Пример #3
0
        private static void FindDocuments(DBTable pluginsTable, DBTable gruppePostkasseTable, DBTable revisionssporTable, DBRunner runner, ISQLExecuter executer, DBConnection connection, String plugin, params String[] tables)
        {
            Output("");
            Output("Find plugin ID for " + plugin);

            SQL_SelectStatement sqlSelect = new SQL_SelectStatement();

            sqlSelect.AddColumn(pluginsTable, "uiPluginID");
            sqlSelect.AddCriteria(new Crit_MatchCriteria(pluginsTable, "txNavn", MatchType.Equal, plugin));
            DBRow row = runner.SelectAndReturnFirstRow(executer, connection, sqlSelect);

            if (row == null)
            {
                throw new Exception("Couldn't find plugin ID");
            }

            Guid pluginID = (Guid)row["uiPluginID"];

            // Find all the document IDs
            Dictionary <Guid, Object> documentIDs = new Dictionary <Guid, Object>();

            Output("Find document IDs for " + gruppePostkasseTable.TableName);
            sqlSelect          = new SQL_SelectStatement();
            sqlSelect.Distinct = true;
            sqlSelect.AddColumn(gruppePostkasseTable, "uiSkemaID");
            sqlSelect.AddCriteria(new Crit_MatchCriteria(gruppePostkasseTable, "uiPluginID", MatchType.Equal, pluginID));
            AddIDs(sqlSelect, runner, executer, connection, documentIDs);

            foreach (String tableName in tables)
            {
                Output("Find document IDs for " + tableName);
                DBTable table = pluginsTable.Database.AddTable("EISST", tableName);
                table.AddColumn("uiSkemaID", ColumnType.Guid, ColumnFlag.None);

                sqlSelect = new SQL_SelectStatement();
                sqlSelect.AddColumn(table, "uiSkemaID");
                AddIDs(sqlSelect, runner, executer, connection, documentIDs);
            }

            Output("Check the revisionsspor to see which documents are missing");
            sqlSelect          = new SQL_SelectStatement();
            sqlSelect.Distinct = true;
            sqlSelect.AddColumn(revisionssporTable, "uiSkemaID");
            sqlSelect.AddCriteria(new Crit_MatchCriteria(revisionssporTable, "uiPluginID", MatchType.Equal, pluginID));
            sqlSelect.AddCriteria(new Crit_MatchCriteria(revisionssporTable, "iType", MatchType.Equal, (short)0));
            sqlSelect.AddCriteria(new Crit_MatchCriteria(revisionssporTable, "uiSkemaID", MatchType.IsNotNull));
            sqlSelect.AddSort(revisionssporTable, "uiSkemaID", Order.Ascending);

            using (DBReader reader = runner.GetReader(executer, connection, sqlSelect))
            {
                while ((row = reader.GetNextRow()) != null)
                {
                    Guid id = (Guid)row["uiSkemaID"];

                    if (!documentIDs.ContainsKey(id))
                    {
                        Output(id.ToString("B").ToUpper());
                    }
                }
            }
        }