Example #1
0
        public void TestSetAlarmDeviceLevelUpdata()
        {
            DateTime           today   = DateTime.Now;
            AlarmDeviceService service = new AlarmDeviceService();
            decimal            l1      = 0.3m;
            decimal            l2      = 0.7m;
            int result = service.SetDeviceBuildAlarmLevel("000001G002", "01000", l1, l2);

            Console.WriteLine(UtilTest.GetJson(result));
        }
Example #2
0
        public object Set([FromBody] JObject obj)
        {
            try
            {
                decimal level1 = Decimal.Parse(obj["level1"].ToString());
                level1 = level1 > 0 ? level1 : 0.01m;

                decimal level2 = Decimal.Parse(obj["level2"].ToString());
                level2 = level2 > 0 ? level2 : 0.02m;

                return(service.SetDeviceBuildAlarmLevel(obj["buildId"].ToString(), obj["energyCode"].ToString(), level1, level2));
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }