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);
        }
示例#2
0
 public MachineRecordRowView(Record record, UrzadzenieKlient device, AdresKlient address, Klient client)
 {
     Record  = record;
     Device  = device;
     Address = address;
     Client  = client;
 }
 public static string ToShortAddress(this AdresKlient address)
 {
     if (address != null)
     {
         return($"{address.Ulica} {address.Miejscowosc}");
     }
     else
     {
         return(string.Empty);
     }
 }
 public static string AddressHouseNumberToString(AdresKlient address)
 {
     return($"{address.NrDomu}" + (string.IsNullOrWhiteSpace(address.NrLokalu) ? string.Empty : $"\\{address.NrLokalu}"));
 }