public void IsprazniD() { using (AMIEntities entity = new AMIEntities()) { List <Device> agrs = entity.Devices.ToList <Device>(); Shared.DevClass agr = new Shared.DevClass(); foreach (var ag in agrs) { entity.Devices.Remove(ag); entity.SaveChanges(); } } }
public void IsprazniM() { using (AMIEntities entity = new AMIEntities()) { List <Merenja> agrs = entity.Merenjas.ToList <Merenja>(); Shared.Merenje agr = new Shared.Merenje(); foreach (var ag in agrs) { entity.Merenjas.Remove(ag); entity.SaveChanges(); } } }
public void Isprazni() { using (AMIEntities entity = new AMIEntities()) { List <Agregator> agrs = entity.Agregators.ToList <Agregator>(); Shared.Agregator agr = new Shared.Agregator(); foreach (var ag in agrs) { entity.Agregators.Remove(ag); entity.SaveChanges(); } } }
public void SaveMerenje(Merenje m) { using (AMIEntities entity = new AMIEntities()) { Merenja mt = new Merenja() { tip = m.Tip.ToString(), vrednost = m.Vrednost.ToString() }; entity.Merenjas.Add(mt); entity.SaveChanges(); } }
public void SaveData(DevClass dc) { using (AMIEntities entity = new AMIEntities()) { foreach (Merenje m in dc.ListMerenje.Values) { Device d = new Device() { Devcode = dc.AMIDevCode.ToString(), time = dc.TimeStamp.ToString(), idMer = dc.ListMerenje[m.Id].Id.ToString(), }; entity.Devices.Add(d); entity.SaveChanges(); } } }
public void SaveAgregator(Shared.Agregator ag) { using (AMIEntities entity = new AMIEntities()) { int i = 0; foreach (DevClass d in ag.devs) { Agregator agt = new Agregator() { idAgr = ag.AMIAgrCode.ToString(), timestamp = ag.TimeStamp.ToString(), idDC = ag.devs[i].AMIDevCode }; i++; entity.Agregators.Add(agt); entity.SaveChanges(); } } }