예제 #1
0
        public object SetAlarmInfo([FromBody] JObject obj)
        {
            try
            {
                MeterAlarmSet setInfo = new MeterAlarmSet();

                setInfo.BuildID   = obj["BuildID"].ToString();
                setInfo.MeterID   = obj["MeterID"].ToString();
                setInfo.ParamID   = obj["ParamID"].ToString();
                setInfo.ParamCode = obj["ParamCode"].ToString();
                setInfo.State     = Convert.ToInt32(obj["State"].ToString());
                setInfo.Level     = Convert.ToInt32(obj["Level"].ToString());
                setInfo.Delay     = Convert.ToInt32(obj["Delay"].ToString());
                setInfo.Lowest    = Convert.ToDecimal(obj["Lowest"].ToString());
                setInfo.Low       = Convert.ToDecimal(obj["Low"].ToString());
                setInfo.High      = Convert.ToDecimal(obj["High"].ToString());
                setInfo.Highest   = Convert.ToDecimal(obj["Highest"].ToString());

                return(service.SetAlarmInfo(setInfo));
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
예제 #2
0
        public object DeleteMeter(MeterAlarmSet setInfo)
        {
            ResultState resultState = new ResultState();

            if (string.IsNullOrEmpty(setInfo.BuildID))
            {
                resultState.State   = 1;
                resultState.Details = "建筑ID不能为空,请输入正确的建筑ID。";
                return(resultState);
            }

            if (string.IsNullOrEmpty(setInfo.MeterID))
            {
                resultState.State   = 1;
                resultState.Details = "仪表ID不能为空,请输入正确的建筑ID。";
                return(resultState);
            }

            int result = context.DeleteMeter(setInfo);

            if (result > 0)
            {
                resultState.State   = 0;
                resultState.Details = "OK";
            }
            else
            {
                resultState.State   = 1;
                resultState.Details = "NG";
            }

            return(resultState);
        }
예제 #3
0
        public int DeleteMeter(MeterAlarmSet setInfo)
        {
            SqlParameter[] sqlParameters =
            {
                new SqlParameter("@BuildID", setInfo.BuildID),
                new SqlParameter("@MeterID", setInfo.MeterID)
            };

            return(_db.Database.ExecuteSqlCommand(MeterAlarmSetResources.SELECT_DeleteOneMeter, sqlParameters));
        }
예제 #4
0
        public void TestDeleteParam()
        {
            MeterAlarmSetService service = new MeterAlarmSetService();

            MeterAlarmSet setInfo = new MeterAlarmSet();

            setInfo.BuildID = "000001G001";
            setInfo.MeterID = "000001G0010001";
            setInfo.ParamID = "31000000000700";


            var viewModel = service.DeleteParam(setInfo);

            Console.WriteLine(UtilTest.GetJson(viewModel));
        }
예제 #5
0
        public object DeleteAlarmInfo([FromBody] JObject obj)
        {
            try
            {
                MeterAlarmSet setInfo = new MeterAlarmSet();

                setInfo.BuildID = obj["BuildID"].ToString();
                setInfo.MeterID = obj["MeterID"].ToString();
                setInfo.ParamID = obj["ParamID"].ToString();

                return(service.DeleteParam(setInfo));
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
예제 #6
0
        public int SetAlarmInfo(MeterAlarmSet setInfo)
        {
            SqlParameter[] sqlParameters =
            {
                new SqlParameter("@BuildID",   setInfo.BuildID),
                new SqlParameter("@MeterID",   setInfo.MeterID),
                new SqlParameter("@ParamID",   setInfo.ParamID),
                new SqlParameter("@ParamCode", setInfo.ParamCode),
                new SqlParameter("@State",     setInfo.State),
                new SqlParameter("@Level",     setInfo.Level),
                new SqlParameter("@Delay",     setInfo.Delay),
                new SqlParameter("@Lowest",    setInfo.Lowest),
                new SqlParameter("@Low",       setInfo.Low),
                new SqlParameter("@High",      setInfo.High),
                new SqlParameter("@Highest",   setInfo.Highest)
            };

            return(_db.Database.ExecuteSqlCommand(MeterAlarmSetResources.SELECT_SetAlarmInfo, sqlParameters));
        }
예제 #7
0
        public void TestSetInfo()
        {
            MeterAlarmSetService service = new MeterAlarmSetService();

            MeterAlarmSet setInfo = new MeterAlarmSet();

            setInfo.BuildID   = "000001G001";
            setInfo.MeterID   = "000001G0010001";
            setInfo.ParamID   = "31000000000701";
            setInfo.ParamCode = "Ub";
            setInfo.State     = Convert.ToInt32("1");
            setInfo.Level     = Convert.ToInt32("2");
            setInfo.Delay     = Convert.ToInt32("3");
            setInfo.Lowest    = Convert.ToDecimal("1");
            setInfo.Low       = Convert.ToDecimal("200");
            setInfo.High      = Convert.ToDecimal("230");
            setInfo.Highest   = Convert.ToDecimal("240");

            var viewModel = service.SetAlarmInfo(setInfo);

            Console.WriteLine(UtilTest.GetJson(viewModel));
        }