internal void SaveValue(DTOs.External.DeviceValue value) { tKovanContext ctx = new tKovanContext(); Models.EntityClass.DeviceValue deviceValue = new Models.EntityClass.DeviceValue(); deviceValue = Utilities.Map <TeknolojiKovaniWebApi.Domain.Values.DTOs.External.DeviceValue, TeknolojiKovaniWebApi.Models.EntityClass.DeviceValue>(value, deviceValue); deviceValue.DataServerTime = DateTime.UtcNow.AddHours(3); deviceValue.DataDeviceTime = DateTime.UtcNow.AddHours(3); ProfileDomain profileDomain = new ProfileDomain(); PropertyRead property = profileDomain.GetProperty(value.PropertyName); deviceValue.PropertyId = property.Id; DeviceDomain deviceDomain = new DeviceDomain(); DeviceRead device = deviceDomain.GetDevice(value.DeviceId); deviceValue.EnvironmentId = device.EnvironmentId.Value; deviceValue.UserId = device.UserId; ctx.DeviceValue.Add(deviceValue); ctx.SaveChanges(); }
public PropertyRead GetProperty(string propertyName) { tKovanContext ctx = new tKovanContext(); Property prop = ctx.Property.Single(i => i.Name == propertyName); PropertyRead property = new PropertyRead() { Id = prop.Id , Name = prop.Name }; return(property); }
protected virtual void CallPropertyRead(string propertyName) { StateManager.OnPropertyRead(this, propertyName); PropertyRead?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }