Ejemplo n.º 1
0
        private static List <Notification> GetNotifications(string query)
        {
            List <Notification> notifications = new List <Notification>();

            foreach (var notification in pgSqlSingleManager.ExecuteSQL(query))
            {
                Notification newNotification = new Notification()
                {
                    id           = Int32.Parse(notification["id"]),
                    condition    = notification["condition"],
                    receivers    = notification["receivers"],
                    repeat_after = Int32.Parse(notification["repeat_after"]),
                    value        = float.Parse(notification["value"]),
                    isActive     = bool.Parse(notification["isActive"])
                };

                newNotification.tunnel           = Tunnel.GetTunnel(Int32.Parse(notification["tunnel"]));
                newNotification.measurement_type = MeasurementType.GetNameOfMeasurementType(Int32.Parse(notification["measurement_type"]));

                notifications.Add(newNotification);
            }
            return(notifications);
        }