SafeDispatch/SafeMobileLIB_DLL/Safenet/Alert.cs
2024-02-22 18:43:59 +02:00

128 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using SafeMobileLib.MessageDecoders;
namespace SafeMobileLib
{
public class Alert
{
private int unitDbID;
public int UnitDbID
{
get { return unitDbID; }
set { unitDbID = value; }
}
private string unitIMEI;
public string UnitIMEI
{
get { return unitIMEI; }
set { unitIMEI = value; }
}
private string unitName;
public string UnitName
{
get { return unitName; }
set { unitName = value; }
}
private Alert_TYPE type;
public Alert_TYPE Type
{
get { return type; }
set { type = value; }
}
private int alertDbID;
public int AlertDbID
{
get { return alertDbID; }
set { alertDbID = value; }
}
private List<GeoPoint> pointList;
private int speed;
public int Speed
{
get { return speed; }
set { speed = value; }
}
private string alert_class;
public string Alert_class
{
get { return alert_class; }
set { alert_class = value; }
}
private int DImask;
public int DImask1
{
get { return DImask; }
set { DImask = value; }
}
private ArrayList notification_email;
public ArrayList Notification_email
{
get { return notification_email; }
set { notification_email = value; }
}
private string alert_name;
public string Alert_name
{
get { return alert_name; }
set { alert_name = value; }
}
private string alert_description;
public string Alert_description
{
get { return alert_description; }
set { alert_description = value; }
}
public Alert() { notification_email = new ArrayList(); }
public Alert(int _unitDbID, int _alertDbID, string _unitIMEI, Alert_TYPE _type, List<GeoPoint> _pointList, int _speed)
{
unitDbID = _unitDbID;
alertDbID = _alertDbID;
type = _type;
unitIMEI = _unitIMEI;
pointList = _pointList;
speed = _speed;
notification_email = new ArrayList();
}
public void ProcessAlert(GeoPoint point)
{
switch (type)
{
case Alert_TYPE.SPEED:
{
if (point.speed > speed)
{
Utils.WriteLine("Unit " + unitIMEI + " has a speed alert!!! Unit speed:" + point.speed + " speed treshhold:" + speed);
//TODO: add alert do DB
}
else
{
Utils.WriteLine("Unit " + unitIMEI + " has NO speed alert!!! Unit speed:" + point.speed + " speed treshhold:" + speed);
}
break;
}
default:
Utils.WriteLine("There is no alert type for:"+type);
break;
}
}
}
}