Esempio n. 1
0
        public RealTimeHydro(CurrentData w)
        {
            using (Maintain mt = new Maintain()) {
                stationInfo = StationService.GetStationByRawId(w.StationID);
                waterInfo   = w;
                string   currentState = w.CurrentState;
                DateTime time         = w.DataTime;
                DateTime now          = DateTime.Now;
                switch (currentState)
                {
                case "EWarning": state = RealTimeState.Warning; break;

                case "EError": state = RealTimeState.Error; break;

                case "ENormal":
                    if (time.AddHours(1.5) > now)
                    {
                        state = RealTimeState.Normal;
                    }
                    else if (time.AddHours(2.5) < now)
                    {
                        state = RealTimeState.TwoHalfHour;
                    }
                    else
                    {
                        state = RealTimeState.OneHalfHour;
                    }
                    break;
                }
            }
        }
Esempio n. 2
0
        public SoilStaion(soilstation raw)
        {
            using (Maintain mt = new Maintain())
            {
                stationid   = raw.stationid;
                subcenterid = raw.subcenterid;
                //SubCenterName = SubCenterService.GetSubcenter(raw.subcenterid).SubCenterName;
                SubCenterName = "";
                if (SubcenterInfoHelper.subCenterInfoList == null || SubcenterInfoHelper.subCenterInfoList.Count == 0)
                {
                    SubcenterInfoHelper.getSubCenterInfoList();
                }
                if (SubcenterInfoHelper.subCenterInfoList != null && SubcenterInfoHelper.subCenterInfoList.Count > 0)
                {
                    SubCenterName = SubcenterInfoHelper.subcenterInfoDic[subcenterid];
                }
                if (SubCenterName.Length == 0)
                {
                    SubCenterName = DAL.SubCenterService.GetSubcenterName(raw.subcenterid);
                }
                if (SubCenterName.Length == 0)
                {
                    SubCenterName = "未知分中心";
                }
                cname = raw.cname;
                switch (Int32.Parse(raw.ctype))
                {
                case (int)StationTypes.rainStation: ctype = StationTypes.rainStation; break;

                case (int)StationTypes.waterStation: ctype = StationTypes.waterStation; break;

                case (int)StationTypes.hydroStation: ctype = StationTypes.hydroStation; break;

                case (int)StationTypes.soilStation: ctype = StationTypes.soilStation; break;

                default: ctype = StationTypes.unknownStation; break;
                }

                soilData10 = new decimal?[] { raw.A10, raw.B10, raw.C10, raw.D10, raw.M10, raw.N10 };
                soilData20 = new decimal?[] { raw.A20, raw.B20, raw.C20, raw.D20, raw.M20, raw.N20 };
                soilData30 = new decimal?[] { raw.A30, raw.B30, raw.C30, raw.D30, raw.M30, raw.N30 };
                soilData40 = new decimal?[] { raw.A40, raw.B40, raw.C40, raw.D40, raw.M40, raw.N40 };
                soilData60 = new decimal?[] { raw.A60, raw.B60, raw.C60, raw.D60, raw.M60, raw.N60 };

                voltagemin     = raw.voltagemin;
                gsm            = raw.gsm;
                gprs           = raw.gprs;
                bdsatellite    = raw.bdsatellite;
                bdmember       = raw.bdmember;
                maintran       = raw.maintran;
                subtran        = raw.subtran;
                dataprotocol   = raw.dataprotocol;
                reportinterval = raw.reportinterval;
            }
        }
Esempio n. 3
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;
                }
            }
        }
Esempio n. 4
0
        public HydroStation(hydlstation raw)
        {
            Maintain mt = new Maintain();

            StationID   = raw.StationID;
            SubCenterID = raw.SubCenterID;
            //SubCenterName = SubCenterService.GetSubcenterName(SubCenterID);
            SubCenterName = "";
            if (SubcenterInfoHelper.subCenterInfoList == null || SubcenterInfoHelper.subCenterInfoList.Count == 0)
            {
                SubcenterInfoHelper.getSubCenterInfoList();
            }
            if (SubcenterInfoHelper.subCenterInfoList != null && SubcenterInfoHelper.subCenterInfoList.Count > 0)
            {
                SubCenterName = SubcenterInfoHelper.subcenterInfoDic[SubCenterID];
            }
            if (SubCenterName.Length == 0)
            {
                SubCenterName = DAL.SubCenterService.GetSubcenterName(raw.SubCenterID);
            }
            if (SubCenterName.Length == 0)
            {
                SubCenterName = "未知分中心";
            }
            CName = raw.CName;

            switch (Int32.Parse(raw.CType))
            {
            case (int)StationTypes.rainStation: CType = StationTypes.rainStation; break;

            case (int)StationTypes.waterStation: CType = StationTypes.waterStation; break;

            case (int)StationTypes.hydroStation: CType = StationTypes.hydroStation; break;

            case (int)StationTypes.soilStation: CType = StationTypes.soilStation; break;

            case (int)StationTypes.gqStation: CType = StationTypes.gqStation; break;

            case (int)StationTypes.hdStation: CType = StationTypes.hdStation; break;

            case (int)StationTypes.hpStation: CType = StationTypes.hpStation; break;

            case (int)StationTypes.hzStation: CType = StationTypes.hzStation; break;

            default: CType = StationTypes.unknownStation; break;
            }

            WBase          = raw.WBase;
            WMax           = raw.WMax;
            WMin           = raw.WMin;
            WChange        = raw.WChange;
            RAccuracy      = raw.RAccuracy;
            RChange        = raw.RChange;
            Gsm            = raw.Gsm;
            Gprs           = raw.Gprs;
            BDStatellite   = raw.BDSatellite;
            BDmember       = raw.BDmember;
            VoltageMin     = raw.VoltageMin;
            maintran       = raw.maintran;
            subtran        = raw.subtran;
            dataprotocol   = raw.dataprotocol;
            watersensor    = raw.watersensor;
            rainsensor     = raw.rainsensor;
            reportinterval = raw.reportinterval;
        }