public static void LoadS2ImportTestData(RSMDB.RSMDataModelDataContext context, string prefix)
        {
            var s2 = context.ExternalSystems.FirstOrDefault(x => x.Id == S2In.Id);

            var factory = new StageFactory(context);

            //factory.createSetting(1001, string.Format("{0}.Repeat", prefix), "Allow S2 import task to repeat.", "true", 0, false, InputTypes.Checkbox, s2);
            //factory.createSetting(1002, string.Format("{0}.RepeatInterval", prefix), "S2 import repeat interval in minutes.", "3", 0, false, InputTypes.Text, s2);
            //factory.createSetting(1003, string.Format("{0}.LastAccessEvent", prefix), "Date time on last S2 record imported.", "", 0, false, InputTypes.Text, s2);
            //factory.createSetting(1004, string.Format("{0}.PersonImport", prefix), "Allow importing of People from S2.", "true", 0, false, InputTypes.Checkbox, s2);
            //factory.createSetting(1005, string.Format("{0}.ServiceAddress", prefix), "Appliance Address", "http://localhost", 2, true, InputTypes.Text, s2);
            //factory.createSetting(1006, string.Format("{0}.ServiceAccount", prefix), "S2 Service User Id", "asdfasasdfasd", 3, true, InputTypes.Text, s2);
            //factory.createSetting(1007, string.Format("{0}.ServicePassword", prefix), "S2 Service Password", "admin", 4, true, InputTypes.Password, s2);
            //factory.createSetting(1007, string.Format("{0}.ServicePassword", prefix), "S2 Service Password", "admin", 4, true, InputTypes.Password, s2);

            var location = factory.createLocation(name: "Location1", id: 1, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Location, "Location1", s2.Id, location.LocationID);

            var portal = factory.createPortal("Portal1", location.LocationID, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Portal, "Portal1", s2.Id, portal.Id);

            var reader = factory.createReader("Reader1", portal.Id, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Reader, "Reader1", s2.Id, reader.Id);

            context.SubmitChanges();
        }
Exemple #2
0
        public static void LoadS2ImportTestData(RSMDB.RSMDataModelDataContext context, string prefix)
        {
            var s2 = context.ExternalSystems.FirstOrDefault(x => x.Id == S2In.Id);

            var factory = new StageFactory(context);

            factory.createSetting(s2, prefix, S2Import.Repeat);
            factory.createSetting(s2, prefix, S2Import.RepeatInterval, "3");
            factory.createSetting(s2, prefix, S2Import.LastAccessed);
            factory.createSetting(s2, prefix, S2Import.PersonImport, "true");
            factory.createSetting(s2, prefix, S2Import.ServiceAddress, "http://localhost");
            factory.createSetting(s2, prefix, S2Import.ServiceAccount, "asdfasasdfasd");
            factory.createSetting(s2, prefix, S2Import.ServicePassword, "admin");

            var location = factory.createLocation("Location1", action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Location, "Location1", s2.Id, location.LocationID);

            var portal = factory.createPortal("Portal1", location.LocationID, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Portal, "Portal1", s2.Id, portal.Id);

            var reader = factory.createReader("Reader1", portal.Id, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Reader, "Reader1", s2.Id, reader.Id);

            context.SubmitChanges();
        }
Exemple #3
0
        public static void LoadTrackExportTestData(RSMDB.RSMDataModelDataContext context, string prefix)
        {
            var s2       = context.ExternalSystems.FirstOrDefault(x => x.Id == S2In.Id);
            var trackOut = context.ExternalSystems.FirstOrDefault(x => x.Id == TrackOut.Id);

            var factory = new StageFactory(context);

            factory.createSetting(1001, string.Format("{0}.Repeat", prefix), "Allow task to repeat.", "true", 0, false, InputTypes.Checkbox, trackOut);
            factory.createSetting(1002, string.Format("{0}.RepeatInterval", prefix), "repeat interval in minutes.", "3", 0, false, InputTypes.Text, trackOut);
            factory.createSetting(1003, string.Format("{0}.LastAccessEvent", prefix), "Date time on last record exported.", "", 0, false, InputTypes.Text, trackOut);
            factory.createSetting(1004, string.Format("{0}.PersonExport", prefix), "Allow export of People.", "true", 0, false, InputTypes.Checkbox, trackOut);
            factory.createSetting(1005, string.Format("{0}.ServiceAddress", prefix), "Appliance Address", "http://localhost:8088/mockACS2TrackWebSvcSoap12", 2, true, InputTypes.Text, trackOut);
            factory.createSetting(1006, string.Format("{0}.ServiceAccount", prefix), "Service User Id", "asdfasasdfasd", 3, true, InputTypes.Text, trackOut);
            factory.createSetting(1007, string.Format("{0}.ServicePassword", prefix), "Service Password", "admin", 4, true, InputTypes.Password, trackOut);
            factory.createSetting(1008, string.Format("{0}.SourceSystem", prefix), "System whose data will be exported to Track.", s2.Id.ToString(), 0, false, InputTypes.Text, trackOut);

            factory.createSetting(1009, string.Format("{0}.LocationExport", prefix), "Allow exporting of Locations to Track", "true", 1, true, InputTypes.Checkbox, trackOut);
            factory.createSetting(10010, string.Format("{0}.AccessExport", prefix), "Allow exporting of Access History to Track", "true", 2, true, InputTypes.Checkbox, trackOut);
            factory.createSetting(10011, string.Format("{0}.EventCode", prefix), "Event Code value for export to Track.", "8", 0, false, InputTypes.Text, trackOut);
            factory.createSetting(10012, string.Format("{0}.SysId", prefix), "System Id value for export to Track.", "1", 0, false, InputTypes.Text, trackOut);
            factory.createSetting(10013, string.Format("{0}.DataSource", prefix), "DataSource value for export to Track.", "TSTLBZDB", 0, false, InputTypes.Text, trackOut);
            factory.createSetting(10014, string.Format("{0}.CompanyExport", prefix), "Allow exporting of Companies to Track", "true", 1, true, InputTypes.Checkbox, trackOut);

            var location = factory.createLocation("Location1", action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Location, "Location1", s2.Id, location.LocationID);
            factory.createExternalApplicationKey(EntityType.Location, "1", trackOut.Id, location.LocationID);

            var portal = factory.createPortal("Portal 1001", location.LocationID, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Portal, "1001", s2.Id, portal.Id);

            var reader = factory.createReader("Reader1", portal.Id, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Reader, "Reader1", s2.Id, reader.Id);

            var person = factory.createPerson("Jane", "Smith", null, UDFs: new Dictionary <int, string> {
                { 4, "Contractor Co1" }
            }, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Person, "Person1", s2.Id, person.Id);

            var start = DateTime.Now;

            for (var i = 0; i < 5; i++)
            {
                var extId  = string.Format("access{0}", i);
                var access = factory.createAccessHistory(extId, person.Id, portal.Id, reader.Id, (int)AccessType.Valid, accessed: start.Subtract(TimeSpan.FromMinutes(i)), action: EntityAction.InsertAndSubmit);
                factory.createExternalApplicationKey(EntityType.AccessLog, extId, s2.Id, access.Id);
            }
            context.SubmitChanges();
        }
Exemple #4
0
        public static void LoadTrackExportTestData(RSMDB.RSMDataModelDataContext context, string prefix)
        {
            var s2       = context.ExternalSystems.FirstOrDefault(x => x.Id == S2In.Id);
            var trackOut = context.ExternalSystems.FirstOrDefault(x => x.Id == TrackOut.Id);

            var factory = new StageFactory(context);

            factory.createSetting(trackOut, prefix, TrackExport.Repeat);
            factory.createSetting(trackOut, prefix, TrackExport.RepeatInterval);
            factory.createSetting(trackOut, prefix, TrackExport.LastAccessEvent);
            factory.createSetting(trackOut, prefix, TrackExport.PersonExport);
            factory.createSetting(trackOut, prefix, TrackExport.ServiceAddress, "http://localhost:8088/mockACS2TrackWebSvcSoap12");
            factory.createSetting(trackOut, prefix, TrackExport.Account);
            factory.createSetting(trackOut, prefix, TrackExport.Password);
            factory.createSetting(trackOut, prefix, TrackExport.SourceSystem, s2.Id.ToString());

            factory.createSetting(trackOut, prefix, TrackExport.LocationExport);
            factory.createSetting(trackOut, prefix, TrackExport.AccessExport);
            factory.createSetting(trackOut, prefix, TrackExport.EventCode);
            factory.createSetting(trackOut, prefix, TrackExport.SysId);
            factory.createSetting(trackOut, prefix, TrackExport.DataSource);
            factory.createSetting(trackOut, prefix, TrackExport.CompanyExport);

            var location = factory.createLocation("Location1", action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Location, "Location1", s2.Id, location.LocationID);
            factory.createExternalApplicationKey(EntityType.Location, "1", trackOut.Id, location.LocationID);

            var portal = factory.createPortal("Portal 1001", location.LocationID, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Portal, "1001", s2.Id, portal.Id);

            var reader = factory.createReader("Reader1", portal.Id, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Reader, "Reader1", s2.Id, reader.Id);

            var person = factory.createPerson("Jane", "Smith", null, UDFs: new Dictionary <int, string> {
                { 4, "Contractor Co1" }
            }, action: EntityAction.InsertAndSubmit);

            factory.createExternalApplicationKey(EntityType.Person, "Person1", s2.Id, person.Id);

            var start = DateTime.Now;

            for (var i = 0; i < 5; i++)
            {
                var extId  = string.Format("access{0}", i);
                var access = factory.createAccessHistory(extId, person.Id, portal.Id, reader.Id, (int)AccessType.Valid, accessed: start.Subtract(TimeSpan.FromMinutes(i)), action: EntityAction.InsertAndSubmit);
                factory.createExternalApplicationKey(EntityType.AccessLog, extId, s2.Id, access.Id);
            }
            context.SubmitChanges();
        }