示例#1
0
        public static void Initialize()
        {
            if (SystemPropertyService.GetInstance().GetValue(Common.Dictionary.SystemProperties.SP_SCADA_NAME) == null)
            {
                SystemParameter scadaName = new SystemParameter();
                scadaName.Key   = Common.Dictionary.SystemProperties.SP_SCADA_NAME;
                scadaName.Value = "RapidScada";
                spr.Save(scadaName);
            }

            if (SystemPropertyService.GetInstance().GetValue(Common.Dictionary.SystemProperties.SP_CLOUD_HOST) == null)
            {
                SystemParameter cloudIp = new SystemParameter();
                cloudIp.Key   = Common.Dictionary.SystemProperties.SP_CLOUD_HOST;
                cloudIp.Value = "http://scadadiploma.azurewebsites.net";
                spr.Save(cloudIp);
            }

            if (SystemPropertyService.GetInstance().GetValue(Common.Dictionary.SystemProperties.SP_SCADA_ID) == null)
            {
                SystemParameter scadaId = new SystemParameter();
                scadaId.Key   = Common.Dictionary.SystemProperties.SP_SCADA_ID;
                scadaId.Value = "";
                spr.Save(scadaId);
            }

            if (SystemPropertyService.GetInstance().GetValue(Common.Dictionary.SystemProperties.SP_REGISTERED) == null)
            {
                SystemParameter registered = new SystemParameter();
                registered.Key   = Common.Dictionary.SystemProperties.SP_REGISTERED;
                registered.Value = false.ToString();
                spr.Save(registered);
            }
        }
示例#2
0
 public static void Register()
 {
     if (!SystemPropertyService.GetInstance().IsRegistered())
     {
         String url     = spr.GetByKey(Common.Dictionary.SystemProperties.SP_CLOUD_HOST).Value;
         String regEp   = Common.Dictionary.SystemProperties.EP_REGISTER;
         String host    = String.Format("{0}/{1}", url, regEp);
         string scadaId = Common.Utils.GetJsonToken(Common.HttpRequest.WebRequest(host), "Uid");
         spr.Register(scadaId);
     }
 }
示例#3
0
        public void TestInitialize()
        {
            SystemParameter reg = spr.GetByKey(Common.Dictionary.SystemProperties.SP_REGISTERED);

            if (reg != null)
            {
                spr.Remove(reg.Id);
            }
            Initialization.Initialize();
            Assert.IsFalse(SystemPropertyService.GetInstance().IsRegistered());

            Initialization.Register();

            Assert.IsTrue(SystemPropertyService.GetInstance().IsRegistered());
            Assert.AreEqual(SystemPropertyService.GetInstance().GetValue(Common.Dictionary.SystemProperties.SP_SCADA_ID), "123");
        }