public static void RegisterCars(AVehicle aVehicle) { CheckPointInfo checkPointInfo = new CheckPointInfo(); checkPointInfo.LicencePlateNumber = aVehicle.LicencePlateNumber; checkPointInfo.Color = aVehicle.Color; checkPointInfo.HasPassenger = aVehicle.HasPassenger; checkPointInfo.CurrentSpeed = aVehicle.Speed; if (checkPointInfo.CurrentSpeed > _MAXLETSPEED) { Statistics.SpeedLimitBreakersCountInc(); checkPointInfo.MessageOverSpeed = "OverSpeed"; } else { checkPointInfo.MessageOverSpeed = ""; } if (_stolenNumber.Contains(aVehicle.LicencePlateNumber)) { Statistics.StolenCarsCountInc(); checkPointInfo.MessageStolen = "INTERCEPT!"; } else { checkPointInfo.MessageStolen = ""; } if (aVehicle.BodyType == BodyType.Car) { checkPointInfo.BodyTypeMessage = "Car"; Statistics.CarsCountInc(); } else if (aVehicle.BodyType == BodyType.Truck) { checkPointInfo.BodyTypeMessage = "Truck"; Statistics.TruckCountInc(); } else if (aVehicle.BodyType == BodyType.Bus) { checkPointInfo.BodyTypeMessage = "Bus"; Statistics.BusesCountInc(); } // если обработчик установлен вызываем событие if (CheckPointEventInstance != null) { CheckPointEventInstance(checkPointInfo); } }
//обработчик события public static void InformationView(CheckPointInfo checkPoinInfo) { Console.ForegroundColor = ConsoleColor.DarkCyan; Console.Write(" " + checkPoinInfo.LicencePlateNumber); Console.ForegroundColor = ConsoleColor.White; Console.Write("\t\t" + checkPoinInfo.Color); Console.ForegroundColor = ConsoleColor.Green; Console.Write("\t\t" + checkPoinInfo.BodyTypeMessage); Console.ForegroundColor = ConsoleColor.Blue; Console.Write("\t\t" + checkPoinInfo.HasPassenger); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("\t\t" + checkPoinInfo.CurrentSpeed); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("\t" + checkPoinInfo.MessageOverSpeed); Console.ForegroundColor = ConsoleColor.Red; Console.Write("\t\t" + checkPoinInfo.MessageStolen); Console.ResetColor(); Console.WriteLine(); }
private void DataGridRecord_SelectionChanged(object sender, SelectionChangedEventArgs e) { _selectedRecords = new List <tlsTtResultSecond>(); for (int i = 0; i < DataGridRecord.SelectedItems.Count; i++) { clsATP model = (clsATP)DataGridRecord.SelectedItems[i]; tlsTtResultSecond record = new tlsTtResultSecond(); record.CheckUnitInfo = record.Organizer = model.Atp_CheckName; record.CheckValueInfo = model.Atp_RLU; String str = model.Atp_Result; if (str.Equals("通过")) { str = "合格"; } else if (str.Equals("超标")) { str = "不合格"; } else { str = "合格";//不上传 } CheckPointInfo CPoint = Global.samplenameadapter[0]; record.CheckPlace = CPoint.pointName; record.CheckPlaceCode = CPoint.orgNum; record.Result = str; record.ResultType = record.CheckMethod = "ATP"; record.CheckStartDate = model.Atp_CheckData; record.CheckMachine = "手持式 ATP 荧光检测仪"; record.CheckNo = DateTime.Now.ToString("yyyyMMddHHmmss"); if (!str.Equals("警告")) { _selectedRecords.Add(record); } } }