Beispiel #1
0
        public static bool Update(VehLicenseCheckpoint _model)
        {
            if (_model == null)
            {
                return(false);
            }
            var _Index = FindVehLicenseChkIndexById(_model.ID);

            if (_Index >= 0)
            {
                try
                {
                    currentVehLicenseCheckpoints.Items[_Index].Position  = _model.Position;
                    currentVehLicenseCheckpoints.Items[_Index].Dimension = _model.Dimension;
                    API.shared.deleteColShape(currentVehLicenseCheckpoints.Items[_Index].ColshapeOnMap);
                    currentVehLicenseCheckpoints.Items[_Index].ColshapeOnMap           = API.shared.createCylinderColShape(_model.Position, 3, 3);
                    currentVehLicenseCheckpoints.Items[_Index].ColshapeOnMap.dimension = _model.Dimension;
                    SaveChanges(true);
                    return(true);
                }
                catch (Exception ex)
                {
                    API.shared.consoleOutput(LogCat.Warn, ex.ToString());
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public static void CreateVehLicenseChk(VehLicenseCheckpoint _model)
        {
            if (_model == null)
            {
                return;
            }

            _model.ID                                   = currentVehLicenseCheckpoints.Items.Count > 0 ? currentVehLicenseCheckpoints.Items.LastOrDefault().ID + 1 : 1;
            _model.ColshapeOnMap                        = API.shared.createCylinderColShape(_model.Position, 3, 3);
            _model.ColshapeOnMap.dimension              = _model.Dimension;
            _model.ColshapeOnMap.onEntityEnterColShape += ColshapeOnMap_onEntityEnterColShape;
            currentVehLicenseCheckpoints.Items.Add(_model);
            SaveChanges(true);
        }