Exemplo n.º 1
0
        public RefMController()
        {
            var docdburi = "[docdburi]";
            var docdbkey = "[docdbkey]";
            var redisuri = "[redis-account].redis.cache.windows.net,ssl=true,password=[redis-key]";

            _refM = new RefM(docdburi, docdbkey, redisuri);
        }
Exemplo n.º 2
0
        public RefMController()
        {
            // the configuration information comes from Web.Config when
            // debugging and from the Azure Portal at runt time
            var docdburi = ConfigurationManager.AppSettings["docdburi"];
            var docdbkey = ConfigurationManager.AppSettings["docdbkey"];
            var redisuri = ConfigurationManager.AppSettings["redisuri"];

            _refM = new RefM(docdburi, docdbkey, redisuri);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var count = 0;

            var configM = new ConfigM {
                ApiUrl = ConfigurationManager.AppSettings["ConfigM"]
            };

            var profileManifest = configM.GetByName("ProfileM");
            var refManifest     = configM.GetByName("RefM");

            var profileM = new ProfileM {
                ApiUrl = profileManifest.lineitems[LineitemsKey.PublicAPI]
            };
            var participants = profileM.GetAllByType(UserType.Participant);

            var refM = new RefM {
                ApiUrl = refManifest.lineitems[LineitemsKey.PublicAPI]
            };
            var products = refM.GetAllByDomain("Products");
            var models   = refM.GetAllByDomain("Models");

            // create  a device registration for each particpant
            foreach (var p in participants)
            {
                var r = new Registration();

                foreach (var m in models)
                {
                    if (m.code == "BIOMAX-HOME")
                    {
                        r.key             = string.Empty;
                        r.productline     = products[0].code;
                        r.model           = m.code;
                        r.version         = m.attributes["version"];
                        r.firmwareversion = m.attributes["firmware"];
                    }
                }

                r.participantid = p.id;

                var json     = ModelManager.ModelToJson <Registration>(r);
                var filename = AppDomain.CurrentDomain.BaseDirectory + @"data\deviceregistration" + count + ".json";
                System.IO.File.WriteAllText(filename, json);

                Console.WriteLine("Device Registration " + count + " generated");
                count++;
            }
        }
        static void Main(string[] args)
        {
            var count = 0;

            var configM = new ConfigM { ApiUrl = ConfigurationManager.AppSettings["ConfigM"] };

            var profileManifest = configM.GetByName("ProfileM");
            var refManifest = configM.GetByName("RefM");

            var profileM = new ProfileM {ApiUrl = profileManifest.lineitems[LineitemsKey.PublicAPI]};
            var participants = profileM.GetAllByType(UserType.Participant);

            var refM = new RefM {ApiUrl = refManifest.lineitems[LineitemsKey.PublicAPI]};
            var products = refM.GetAllByDomain("Products");
            var models = refM.GetAllByDomain("Models");

            // create  a device registration for each particpant
            foreach (var p in participants)
            {
                var r = new Registration();

                foreach (var m in models)
                {
                    if (m.code == "BIOMAX-HOME")
                    {
                        r.key = string.Empty;
                        r.productline = products[0].code;
                        r.model = m.code;
                        r.version = m.attributes["version"];
                        r.firmwareversion = m.attributes["firmware"];
                    }
                }

                r.participantid = p.id;

                var json = ModelManager.ModelToJson<Registration>(r);
                var filename = AppDomain.CurrentDomain.BaseDirectory + @"data\deviceregistration" + count + ".json";
                System.IO.File.WriteAllText(filename, json);

                Console.WriteLine("Device Registration " + count + " generated");
                count++;
            }
        }