Example #1
0
 public IList<Device> GetDevicesByUserAndLocation(User user, Location location)
 {
     JavaScriptSerializer serializer = new JavaScriptSerializer();
     AdvanticWS.DataControllerPortTypeClient client = new AdvanticWS.DataControllerPortTypeClient();
     string response = client.getDevices(user.UserName,location.id.ToString());
     DeviceResponse deviceResponse = serializer.Deserialize<DeviceResponse>(response);
     return deviceResponse.dispositivos;
 }
 public IList<AdvanticSignal> GetAdvanticSignal(User user, Location location, Device device)
 {
     List<AdvanticSignal> advanticSignalList = new List<AdvanticSignal>();
     SignalService signalService = new SignalService();
     IList<Signal> signalList = signalService.GetSignalsByUserAndDevice(user, device);
     advanticSignalList.AddRange(createAdvanticSignalByUserAndLocationAndDeviceAndSignal(user, location, device,signalList));
     return advanticSignalList;
 }
 public IList<AdvanticSignal> GetAdvanticSignal(User user, Location location)
 {
     List<AdvanticSignal> advanticSignalList = new List<AdvanticSignal>();
     DeviceService deviceService = new DeviceService();
     IList<Device> deviceList = deviceService.GetDevicesByUserAndLocation(user, location);
     foreach (Device device in deviceList)
         advanticSignalList.AddRange(GetAdvanticSignal(user,location,device));
     return advanticSignalList;
 }
 private IList<AdvanticSignal> createAdvanticSignalByUserAndLocationAndDeviceAndSignal(User user, Location location, Device device,IList<Signal> signalList)
 {
     List<AdvanticSignal> advanticSignalList = new List<AdvanticSignal>();
     foreach (Signal signal in signalList)
     {
         advanticSignalList.Add(new AdvanticSignal()
         {
             User=user,
             Location=location,
             Device=device,
             Signal=signal
         });
     }
     return advanticSignalList;
 }