예제 #1
0
        public RealTimeMoisture(soildata raw)
        {
            Station station = StationService.GetStationByRawId(raw.StationID);

            stationId     = station.id;
            stationName   = station.stationName;
            stationType   = station.stationType;
            subcenterName = station.subcenterName;
            longtitude    = station.longtitude;
            latitude      = station.latitude;
            datatime      = raw.DataTime;
            voltage       = raw.Voltage;
            if (!raw.Moisture10.HasValue)
            {
                errorCode  = -1;
                moisture10 = -1;
            }
            else if (!raw.Moisture20.HasValue)
            {
                errorCode  = -1;
                moisture20 = -1;
            }
            else if (!raw.Moistrue40.HasValue)
            {
                errorCode  = -1;
                moisture40 = -1;
            }
            else
            {
                errorCode  = 0;
                moisture10 = raw.Moisture10;
                moisture20 = raw.Moisture20;
                moisture40 = raw.Moistrue40;
            }
        }
예제 #2
0
        public RealTimeSoil(soildata s)
        {
            using (Maintain mt = new Maintain())
            {
                stationInfo = StationService.GetStationByRawId(s.StationID);
                soilInfo    = s;
                DateTime time = s.DataTime;
                DateTime now  = DateTime.Now;

                if (time.AddHours(1.5) > now)
                {
                    state = RealTimeState.Normal;
                }
                else if (time.AddHours(2.5) < now)
                {
                    state = RealTimeState.TwoHalfHour;
                }
                else
                {
                    state = RealTimeState.OneHalfHour;
                }
            }
        }