/// <summary> /// 删除某条墒情数据 /// </summary> /// <param name="stationid"></param> /// <param name="time"></param> public static void DeleteHourSoil(string stationid, DateTime time) { using (LNRRDB ln = new LNRRDB()) { soildata v = new soildata(); v = ln.soildata.First(i => (i.StationID) == stationid && i.DataTime == time); ln.Entry <soildata>(v).State = EntityState.Deleted; ln.SaveChanges(); } }
/// <summary> /// 修改某条墒情数据gggg /// </summary> /// <param name="stationid"></param> /// <param name="time"></param> /// <param name="value"></param> public static void AlterHourSoil(string stationid, DateTime time, decimal Voltage10, decimal Voltage20, decimal Voltage40, decimal Moisture10, decimal Moisture20, decimal Moisture40) { using (LNRRDB ln = new LNRRDB()) { soildata v = new soildata(); v = ln.soildata.First(i => (i.StationID) == stationid && i.DataTime == time); v.Voltage10 = Voltage10; v.Voltage20 = Voltage20; v.Voltage40 = Voltage40; v.Moisture10 = Moisture10; v.Moisture20 = Moisture20; v.Moistrue40 = Moisture40; ln.SaveChanges(); } }