Exemple #1
0
 public void Execute(IJobExecutionContext context)
 {
     //Console.WriteLine("Scheduled Job: " + DateTime.Now);
     string url    = sysRep.GetByKey(Common.Dictionary.SystemProperties.SP_CLOUD_HOST).Value;
     string ep     = Common.Dictionary.SystemProperties.EP_HEARTBEAT;
     string id     = sysRep.GetByKey(Common.Dictionary.SystemProperties.SP_SCADA_ID).Value;
     string host   = String.Format("{0}/{1}/{2}", url, ep, id);
     String answer = Common.HttpRequest.WebRequest(host);
 }
Exemple #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);
     }
 }
        public SystemMessage register(String key, String user)
        {
            AddCorsHeaders();
            String id = spRep.GetByKey(Common.Dictionary.SystemProperties.SP_SCADA_ID).Value;

            return(new SystemMessage()
            {
                id = id,
                name = "RapidSCADA",
                key = key
            });
        }
        public void TestSPUpdate()
        {
            SystemParameter sp = EntityGenerator.GetSystemParameter();

            spr.Save(sp);

            string newValue = "newValue";

            sp.Value = newValue;
            spr.Update(sp.Id, sp);

            SystemParameter act = spr.GetByKey(sp.Key);

            Assert.ReferenceEquals(act, sp);
        }
Exemple #5
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");
        }
Exemple #6
0
        public bool IsRegistered()
        {
            SystemParameter reg = spr.GetByKey(Common.Dictionary.SystemProperties.SP_REGISTERED);

            return(reg != null && reg.Value.ToLower().Equals("true"));
        }