public override ICollection <MachineRecordRowView> GetAll()
        {
            var records = new List <MachineRecordRowView>();

            foreach (var rec in _recordRepository.All().OrderByDescending(d => d.ReadDatetime))
            {
                AdresKlient      address = null;
                Klient           client  = null;
                UrzadzenieKlient device  = null;

                device = Cache.DeviceCache.Get(rec.SerialNumber);

                if (device != null)
                {
                    address = Cache.AddressCache.Get(device.IdMiejsceInstalacji);
                    client  = Cache.ClientCache.Get(device.IdKlient);
                    client.UmowaSerwisowa = Cache.ServiceAgreementCache.Contains(client.IdKlient);
                }
                else
                {
                    Debug.WriteLine("Empty device");
                }


                records.Add(new MachineRecordRowView(rec, device, address, client));
            }

            return(records);
        }
Esempio n. 2
0
 public MachineRecordRowView(Record record, UrzadzenieKlient device, AdresKlient address, Klient client)
 {
     Record  = record;
     Device  = device;
     Address = address;
     Client  = client;
 }
Esempio n. 3
0
 private void UpdateDevice(UrzadzenieKlient device)
 {
     if (device != null)
     {
         Mapper.Map(device, this);
         var address = _deviceService.GetDeviceAddress(device.IdMiejsceInstalacji);
         Mapper.Map(address, this);
     }
 }