Exemplo n.º 1
0
 private Car CheckCarInfo(Car c)
 {
     foreach(Team team in teamList)
         foreach(Car car in team.Cars)
             if(car.CarID != c.CarID && (car.CarNO == c.CarNO || car.SimNO == c.SimNO || car.MachineNO == c.MachineNO))
                 return car;
     return null;
 }
Exemplo n.º 2
0
 //���¼�س���λ��
 private void S_RefreshWatching(Car car)
 {
     try
     {
         StringBuilder stb = new StringBuilder(Constant.HEAD).Append(Constant.C_POS).Append(Constant.C_POS_WATCH);
         stb.Append(car.CarID).Append(Constant.SPLIT1).Append(car.Pos.ToString()).Append(Constant.FOOT);
         String s = stb.ToString();
         Socket[] tempList = car.WatchSockets.ToArray();
         foreach(Socket st in tempList)
             if(car.PointSockets.IndexOf(st) < 0)
                 if(!ClientSend(st, s))
                     car.WatchSockets.Remove(st);
     }
     catch(Exception e)
     {
         if(FormMain.LOG_ERR)
             logger.AddErr(e, "");
     }
 }
Exemplo n.º 3
0
 //�����
 private void S_Point(Car car)
 {
     try
     {
         StringBuilder stb = new StringBuilder(Constant.HEAD).Append(Constant.C_POS).Append(Constant.C_POS_POINT);
         stb.Append(Constant.RESULT_OK).Append(car.CarID).Append(Constant.SPLIT1).Append(car.Pos.ToString()).Append(Constant.FOOT);
         String s = stb.ToString();
         Socket[] tempList = car.PointSockets.ToArray();
         foreach(Socket st in tempList)
             ClientSend(st, s);
         car.PointSockets.Clear();
     }
     catch(Exception e)
     {
         if(FormMain.LOG_ERR)
             logger.AddErr(e, "");
     }
 }
Exemplo n.º 4
0
 //�±�����Ϣ
 private void S_Alarm(Car car, AlarmPosition apos)
 {
     try
     {
         StringBuilder stb = new StringBuilder(Constant.HEAD).Append(Constant.S_INFO).Append(Constant.S_INFO_ALARM);
         stb.Append(apos.ToString()).Append(Constant.FOOT);
         String s = stb.ToString();
         if(car.HandleAlarmClient == null)//�Ƿ��ѽӾ�
         {
             DataClient[] tempList = dataClientList.ToArray();
             foreach(DataClient dc in tempList)//����(δ�Ӿ�)
                 if(dc.LoginUser != null && dc.LoginUser.GetTeamByID(car.TeamID) != null && dc.LoginUser.PolicyAlarmList == 1)
                     dc.Send(s);
         }
         else
         {
             bool send = false;
             DataClient[] tempList = dataClientList.ToArray();
             foreach(DataClient dc in tempList)//����(�ѽӾ�)
                 if(dc == car.HandleAlarmClient)
                 {
                     send = dc.Send(s);
                     break;
                 }
             if(!send)//����ʧ�ܣ����ýӾ��û���ͬʱ���͵�������ϯ
             {
                 car.HandleAlarmClient = null;
                 foreach(DataClient dc in tempList)
                     if(dc.LoginUser != null && dc.LoginUser.GetTeamByID(car.TeamID) != null && dc.LoginUser.PolicyAlarmList == 1)
                         dc.Send(s);
             }
         }
     }
     catch(Exception e)
     {
         if(FormMain.LOG_ERR)
             logger.AddErr(e, "");
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// ���Ƴ�����Ϣ
 /// </summary>
 /// <param name="car"></param>
 public void Clone(Car car)
 {
     this.carID = car.carID;
     this.teamID = car.teamID;
     this.carNO = car.carNO;
     this.simNO = car.simNO;
     this.machineNO = car.machineNO;
     this.controlPassword = car.controlPassword;
     this.machineType = car.machineType;
     this.protocol = car.protocol;
     this.routeway = car.routeway;
     this.carType = car.carType;
     this.carBrand = car.carBrand;
     this.carColor = car.carColor;
     this.installPlace = car.installPlace;
     this.installPerson = car.installPerson;
     this.businessPerson = car.businessPerson;
     this.joinTime = car.joinTime;
     this.overServiceTime = car.overServiceTime;
     this.carRemark = car.carRemark;
     this.driver = car.driver;
     this.driverTel = car.driverTel;
     this.driverMobile = car.driverMobile;
     this.driver2 = car.driver2;
     this.driver2Tel = car.driver2Tel;
     this.driver2Mobile = car.driver2Mobile;
     this.password = car.password;
     this.driverAddress = car.driverAddress;
     this.driverFax = car.driverFax;
     this.driverCompany = car.driverCompany;
     this.buyTime = car.buyTime;
     this.stoped = car.stoped;
     this.specialRequest = car.specialRequest;
     this.driverRemark = car.driverRemark;
     this.regionAlarm = car.regionAlarm;
     this.regionID = car.regionID;
     this.notify = car.notify;
     this.notifyStart = car.notifyStart;
     this.notifyEnd = car.notifyEnd;
     this.notifyText = car.notifyText;
     this.declareCount = car.declareCount;
 }
Exemplo n.º 6
0
 /// <summary>
 /// �����ݿ��г�ʼ��
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 public static Car ParseWithPosition(DataRow dr)
 {
     Car car = new Car();
     try
     {
         car.carID = Int32.Parse(dr[0].ToString());
         car.TeamID = Int32.Parse(dr[1].ToString().ToString());
         car.carNO = dr[2].ToString();
         car.simNO = dr[3].ToString();
         car.machineNO = dr[4].ToString();
         car.controlPassword = dr[5].ToString();
         car.machineType = dr[6].ToString();
         car.protocol = Int32.Parse(dr[7].ToString());
         car.routeway = Int32.Parse(dr[8].ToString());
         car.carType = dr[9].ToString();
         car.carBrand = dr[10].ToString();
         car.carColor = dr[11].ToString();
         car.installPlace = dr[12].ToString();
         car.installPerson = dr[13].ToString();
         car.businessPerson = dr[14].ToString();
         car.joinTime = dr[15].ToString();
         car.overServiceTime = dr[16].ToString();
         car.carRemark = dr[17].ToString();
         car.driver = dr[18].ToString();
         car.driverTel = dr[19].ToString();
         car.driverMobile = dr[20].ToString();
         car.driver2 = dr[21].ToString();
         car.driver2Tel = dr[22].ToString();
         car.driver2Mobile = dr[23].ToString();
         car.password = dr[24].ToString();
         car.driverAddress = dr[25].ToString();
         car.driverFax = dr[26].ToString();
         car.driverCompany = dr[27].ToString();
         car.buyTime = dr[28].ToString();
         car.stoped = Int32.Parse(dr[29].ToString());
         car.specialRequest = dr[30].ToString();
         car.driverRemark = dr[31].ToString();
         car.RegionAlarm = dr[32].ToString() == "1";
         car.RegionID = Int32.Parse(dr[33].ToString());
         car.Notify = Int32.Parse(dr[34].ToString());
         car.NotifyStart = dr[35].ToString();
         car.NotifyEnd = dr[36].ToString();
         car.NotifyText = dr[37].ToString();
         car.Pos = new Position();
         car.Pos.GpsTime = dr[38].ToString();
         car.Pos.Pointed = Int32.Parse(dr[39].ToString());
         car.Pos.Lo = Double.Parse(dr[40].ToString());
         car.Pos.La = Double.Parse(dr[41].ToString());
         car.Pos.Speed = Int32.Parse(dr[42].ToString());
         car.Pos.Direction = Int32.Parse(dr[43].ToString());
         car.Pos.Status = dr[44].ToString();
         car.Pos.Alarm = dr[45].ToString();
         car.Pos.Mileage = Int32.Parse(dr[47].ToString());
         car.Pos.AlarmHandle = Int32.Parse(dr[46].ToString());
     }
     catch { return null; }
     return car;
 }
Exemplo n.º 7
0
 /// <summary>
 /// ���ַ�����ʼ��
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static Car Parse(String s)
 {
     Car car = new Car();
     String[] ss = s.Split(Constant.SPLIT2);
     try
     {
         car.carID = Int32.Parse(ss[0]);
         car.carNO = ss[1];
         car.simNO = ss[2];
         car.machineNO = ss[3];
         car.controlPassword = ss[4];
         car.machineType = ss[5];
         car.protocol = Int32.Parse(ss[6]);
         car.routeway = Int32.Parse(ss[7]);
         car.carType = ss[8];
         car.carBrand = ss[9];
         car.carColor = ss[10];
         car.installPlace = ss[11];
         car.installPerson = ss[12];
         car.businessPerson = ss[13];
         car.joinTime = ss[14];
         car.overServiceTime = ss[15];
         car.carRemark = ss[16];
         car.driver = ss[17];
         car.driverTel = ss[18];
         car.driverMobile = ss[19];
         car.driver2 = ss[20];
         car.driver2Tel = ss[21];
         car.driver2Mobile = ss[22];
         car.password = ss[23];
         car.driverAddress = ss[24];
         car.driverFax = ss[25];
         car.driverCompany = ss[26];
         car.buyTime = ss[27];
         car.stoped = Int32.Parse(ss[28]);
         car.specialRequest = ss[29];
         car.driverRemark = ss[30];
         car.Notify = Int32.Parse(ss[31]);
         car.NotifyStart = ss[32];
         car.NotifyEnd = ss[33];
         car.NotifyText = ss[34];
     }
     catch { return null; }
     return car;
 }
Exemplo n.º 8
0
 public Car(Car car)
 {
     Clone(car);
 }