Exemplo n.º 1
0
        public List <ExportRecord> ExportData(bool includeSignals = false)
        {
            List <ExportRecord> export = new List <ExportRecord>();

            string[] exportTypes =
            {
                "ReporterDbRecord",
                "ChannelDbRecord",
                "RouterDbRecord",
                "TemplateDbRecord",
                "SignalDbRecord"
            };

            foreach (string type in exportTypes)
            {
                if (type == "SignalDbRecord" && !includeSignals)
                {
                    continue;
                }

                ExportRecord typeExport = new ExportRecord();
                typeExport.type    = type;
                typeExport.records = GetRecords(type);
                export.Add(typeExport);
                Logger.Info($"Exported {typeExport.records.Count} {type} Records.");
            }

            return(export);
        }
Exemplo n.º 2
0
        private int SaveRecords(ExportRecord exportRecord)
        {
            MethodInfo method      = DbEngine.GetType().GetMethod("Import", BindingFlags.Instance | BindingFlags.Public);
            Type       t           = Type.GetType("Syntinel.Core." + exportRecord.type);
            MethodInfo typedMethod = method.MakeGenericMethod(t);

            object[] parms = new object[1];
            parms[0] = exportRecord.records;
            int count = (int)typedMethod.Invoke(DbEngine, parms);

            return(count);
        }