예제 #1
0
        public List <string> GetModels(string brand)
        {
            var list = GPSCollection
                       .Where(t => t.Brand == brand).ToList();

            return((from gps in list select gps.Model).Distinct().ToList());
        }
예제 #2
0
 public void AddRecordToRepo(GPS gps)
 {
     if (gps == null)
     {
         throw new ArgumentNullException("Error: The argument is Null");
     }
     GPSCollection.Add(gps);
 }
예제 #3
0
        public bool AddToCollection(GPS gps)
        {
            int oldCount = GPSCollection.Count;

            _addToCollectionOnly = true;
            if (GetGPS(gps.DeviceID) == null)
            {
                GPSCollection.Add(gps);
            }
            _addToCollectionOnly = false;
            return(GPSCollection.Count > oldCount);
        }
예제 #4
0
        public bool AddRecordToRepo(GPS gps)
        {
            int oldCount = GPSCollection.Count;

            if (gps == null)
            {
                throw new ArgumentNullException("Error: The argument is Null");
            }

            GPSCollection.Add(gps);

            return(GPSCollection.Count > oldCount);
        }
예제 #5
0
        public ObservableCollection <GPS> AvailableGPS()
        {
            List <GPS> availableGPS = GPSCollection.ToList();

            //foreach (var gps in GPSes.GetAssignedUnits())
            foreach (var fg in BSCEntities.FisherGPSViewModel.FisherGPSCollection
                     .Where(t => t.DateReturned == null))

            {
                GPS tempGPS = fg.GPS;
                if (availableGPS.Contains(tempGPS))
                {
                    availableGPS.Remove(tempGPS);
                }
            }
            return(new ObservableCollection <GPS>(availableGPS));
        }
예제 #6
0
        public bool RemoveByEject(GPS gps)
        {
            int oldCount = GPSCollection.Count;
            int index    = 0;

            while (index < GPSCollection.Count)
            {
                if (GPSCollection[index].DeviceID == gps.DeviceID)
                {
                    _gpsRemovedByEject = true;
                    GPSCollection.RemoveAt(index);
                    break;
                }
                index++;
            }
            return(oldCount > GPSCollection.Count);
        }
예제 #7
0
        public void DeleteRecordFromRepo(string id)
        {
            if (id == null)
            {
                throw new Exception("Record ID cannot be null");
            }

            int index = 0;

            while (index < GPSCollection.Count)
            {
                if (GPSCollection[index].ID == id)
                {
                    GPSCollection.RemoveAt(index);
                    break;
                }
                index++;
            }
        }
예제 #8
0
        public bool DeleteRecordFromRepo(string code)
        {
            if (code == null)
            {
                throw new Exception("Record ID cannot be null");
            }

            int index = 0;

            while (index < GPSCollection.Count)
            {
                if (GPSCollection[index].Code == code)
                {
                    GPSCollection.RemoveAt(index);
                    break;
                }
                index++;
            }
            return(EditSuccess);
        }
예제 #9
0
        public GPS GetGPSEx(string deviceID)
        {
            CurrentEntity = GPSCollection.FirstOrDefault(n => n.DeviceID == deviceID);

            if (CurrentEntity == null)
            {
                CurrentEntity = GPSCollection.FirstOrDefault(n => n.Device?.PNPDeviceID == deviceID);
            }

            if (CurrentEntity != null)
            {
                GPSModels = GetModels(CurrentEntity.Brand);
            }
            else
            {
                if (GPSModels != null)
                {
                    GPSModels.Clear();
                }
            }
            return(CurrentEntity);
        }
예제 #10
0
 public GPS GetGPS(string ID)
 {
     return(GPSCollection.FirstOrDefault(n => n.ID == ID));
 }
예제 #11
0
 public List <GPS> GetAllGPS()
 {
     return(GPSCollection.ToList());
 }
예제 #12
0
 public GPS GetGPS(string deviceID)
 {
     CurrentEntity = GPSCollection.FirstOrDefault(n => n.DeviceID == deviceID);
     return(CurrentEntity);
 }
예제 #13
0
 public GPS GetGPSByName(string deviceName)
 {
     CurrentEntity = GPSCollection.FirstOrDefault(n => n.DeviceName == deviceName);
     return(CurrentEntity);
 }
예제 #14
0
 public bool Exists(GPS gps)
 {
     return(GPSCollection.Where(t => t.DeviceID == gps.DeviceID).FirstOrDefault() != null);
 }
예제 #15
0
 public List <GPS> GetAll()
 {
     return(GPSCollection.OrderBy(t => t.DeviceName).ToList());
 }