/// <summary> /// 保存接收到的车辆通行数据 /// </summary> /// <param name="data"></param> public static void SaveReceiveData(T_ReceiveData data) { using (PathIdentifyEquipDemoDBEntities db = new PathIdentifyEquipDemoDBEntities()) { db.T_ReceiveData.Attach(data); db.Entry(data).State = EntityState.Added; db.SaveChanges(); } }
public static void DelEquip(T_PathIdentifyEquip equip) { using (PathIdentifyEquipDemoDBEntities db = new PathIdentifyEquipDemoDBEntities()) { db.T_PathIdentifyEquip.Attach(equip); db.Entry(equip).State = EntityState.Deleted; db.SaveChanges(); } }
/// <summary> /// 保存设备状态数据 /// </summary> /// <param name="status"></param> public static void SaveDeviceStatus(T_DeviceStatusLog status) { using (PathIdentifyEquipDemoDBEntities db = new PathIdentifyEquipDemoDBEntities()) { db.T_DeviceStatusLog.Attach(status); db.Entry(status).State = EntityState.Added; db.SaveChanges(); } }
public static void SaveOrModifyEquip(T_PathIdentifyEquip equip) { using (PathIdentifyEquipDemoDBEntities db = new PathIdentifyEquipDemoDBEntities()) { //if (equip.CreateTime == null) // equip.CreateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day // , DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); db.T_PathIdentifyEquip.Attach(equip); if (equip.Id <= 0) { db.Entry(equip).State = EntityState.Added; } else { db.Entry(equip).State = EntityState.Modified; } db.SaveChanges(); } }