public void SyncTimeByDevice(int deviceId) { var device = db.Devices.Include(d => d.DeviceType).Where(w => w.DeviceId == deviceId).FirstOrDefault(); DeviceFactory factory = new DeviceFactory(); IDevice iDevice = factory.CreateIntance(device); iDevice.SyncTime(); }
public void GetStatus(int id) { DeviceFactory factory = new DeviceFactory(); var device = db.Devices.Include(i => i.DeviceType).Where(w => w.DeviceId == id).FirstOrDefault(); if (device != null) { IDevice iDevice = factory.CreateIntance(device); iDevice.GetStatus(); } }
public void TransferRecordsByDevice(int deviceId) { var device = db.Devices.Include(d => d.DeviceType).Where(w => w.DeviceId == deviceId).FirstOrDefault(); DeviceFactory factory = new DeviceFactory(); IDevice iDevice = factory.CreateIntance(device); if (iDevice.TransferRecords()) { iDevice.ClearDevice(); } }
public void SyncTimeAndTransferByDevice(int deviceId) { MyLogger.GetInstance.Info(string.Format("SyncTimeAndTransferByDevice Device: {0}", deviceId)); var device = db.Devices.Include(d => d.DeviceType).Where(w => w.DeviceId == deviceId).FirstOrDefault(); DeviceFactory factory = new DeviceFactory(); IDevice iDevice = factory.CreateIntance(device); if (iDevice.SyncTime()) { if (iDevice.TransferRecords()) { iDevice.ClearDevice(); } } }
public bool TranferRecordsByDevise(int deviceId) { bool result = false; var device = db.Devices.Include(d => d.DeviceType).Where(w => w.DeviceId == deviceId).FirstOrDefault(); DeviceFactory factory = new DeviceFactory(); IDevice iDevice = factory.CreateIntance(device); if (iDevice.TransferRecords()) { if (iDevice.ClearDevice()) { result = true; } } return(result); }