SafeNet/SafeNetLib/Alert.cs

153 lines
4.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
namespace SafeNetLib
{
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; }
}
private string alert_latitude;
public string Alert_latitude
{
get { return alert_latitude; }
set { alert_latitude = value; }
}
private string alert_longitude;
public string Alert_longitude
{
get { return alert_longitude; }
set { alert_longitude = value; }
}
private string position_time;
public string Position_time
{
get { return position_time; }
set { position_time = value; }
}
private int digital_in;
public int Digital_in
{
get { return digital_in; }
set { digital_in = 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.ConsWrite(DebugMSG_Type.ALERTS, "Unit " + unitIMEI + " has a speed alert!!! Unit speed:" + point.speed + " speed treshhold:" + speed);
//TODO: add alert do DB
}
else
{
Utils.ConsWrite(DebugMSG_Type.ALERTS, "Unit " + unitIMEI + " has NO speed alert!!! Unit speed:" + point.speed + " speed treshhold:" + speed);
}
break;
}
default:
Utils.ConsWrite(DebugMSG_Type.ALERTS, "There is no alert type for:"+type);
break;
}
}
}
}