Пример #1
0
        private void HttpServer_PingReceived(string DeviceSerialNumber, int Status, int Voltage, int Frequency, DateTime PingTime)
        {
            GridStatu X = S1.GridStatus.Where(G => G.DeviceSerialNumber.Trim().Equals(DeviceSerialNumber)).FirstOrDefault();

            if (X != null)
            {
                X.Frequency    = Frequency;
                X.Voltage      = Voltage;
                X.Status       = Status;
                X.LastPingTime = PingTime;
                UpdateChanges(X);
            }
            else
            {
                X = new GridStatu();
                X.DeviceSerialNumber = DeviceSerialNumber;
                X.Frequency          = Frequency;
                X.Voltage            = Voltage;
                X.Status             = Status;
                X.LastPingTime       = PingTime;
                S1.GridStatus.Add(X);
                S1.SaveChanges();
            }
        }
Пример #2
0
        private void HttpServer_PingReceived(string DeviceSerialNumber, int Status, int Voltage, int Frequency, DateTime PingTime)
        {
            GridStatu X = S1.GridStatus.Where(G => G.DeviceSerialNumber.Trim().Equals(DeviceSerialNumber)).FirstOrDefault();

            if (X != null)
            {
                X.Frequency = Frequency;
                X.Voltage = Voltage;
                X.Status = Status;
                X.LastPingTime = PingTime;
                UpdateChanges(X);
            }
            else
            {
                X = new GridStatu();
                X.DeviceSerialNumber = DeviceSerialNumber;
                X.Frequency = Frequency;
                X.Voltage = Voltage;
                X.Status = Status;
                X.LastPingTime = PingTime;
                S1.GridStatus.Add(X);
                S1.SaveChanges();
            }
        }