public bool AddDevice(Model.LoopModel loop) { try { List <DeviceInfo8003> lstDevices = loop.GetDevices <DeviceInfo8003>(); foreach (var device in lstDevices) { device.Loop.ID = loop.ID; device.LoopID = loop.ID; StringBuilder sbDeviceInfoSQL = new StringBuilder("REPLACE INTO DeviceInfo8003("); sbDeviceInfoSQL.Append("ID,"); sbDeviceInfoSQL.Append("Code,"); sbDeviceInfoSQL.Append("Disable,"); sbDeviceInfoSQL.Append("Feature,"); sbDeviceInfoSQL.Append("DelayValue,"); sbDeviceInfoSQL.Append("SensitiveLevel,"); sbDeviceInfoSQL.Append("LinkageGroup1,"); sbDeviceInfoSQL.Append("LinkageGroup2,"); sbDeviceInfoSQL.Append("LinkageGroup3,"); sbDeviceInfoSQL.Append("sdpKey,"); sbDeviceInfoSQL.Append("BroadcastZone,"); sbDeviceInfoSQL.Append("ZoneNo,"); sbDeviceInfoSQL.Append("Location,"); sbDeviceInfoSQL.Append("LoopID,"); sbDeviceInfoSQL.Append("TypeCode)"); sbDeviceInfoSQL.Append(" VALUES("); sbDeviceInfoSQL.Append(device.ID + ",'"); sbDeviceInfoSQL.Append(device.Code + "','"); sbDeviceInfoSQL.Append(device.Disable + "','"); sbDeviceInfoSQL.Append(device.Feature + "','"); sbDeviceInfoSQL.Append(device.DelayValue + "','"); sbDeviceInfoSQL.Append(device.SensitiveLevel + "','"); sbDeviceInfoSQL.Append(device.LinkageGroup1 + "','"); sbDeviceInfoSQL.Append(device.LinkageGroup2 + "','"); sbDeviceInfoSQL.Append(device.LinkageGroup3 + "','"); sbDeviceInfoSQL.Append(device.sdpKey + "','"); sbDeviceInfoSQL.Append(device.BroadcastZone + "','"); sbDeviceInfoSQL.Append(device.ZoneNo + "','"); sbDeviceInfoSQL.Append(device.Location + "','"); sbDeviceInfoSQL.Append(device.LoopID + "','"); sbDeviceInfoSQL.Append(device.TypeCode + "');"); _databaseService.ExecuteBySql(sbDeviceInfoSQL); } } catch (Exception ex) { return(false); } return(true); }
public bool AddDevice(Model.LoopModel loop) { try { List <DeviceInfo8053> lstDevices = loop.GetDevices <DeviceInfo8053>(); foreach (var device in lstDevices) { device.Loop.ID = loop.ID; device.LoopID = loop.ID; _dbFileVersionService.AddDeviceForControllerType8053(device); } } catch (Exception ex) { logger.Error(ex.Message, ex); return(false); } return(true); }
protected override void SetDownloadedDeviceInfoTotalAmountInCurrentLoop(Model.LoopModel loopModel) { DownloadedDeviceInfoTotalAmountInCurrentLoop = loopModel.GetDevices <DeviceInfo8021>().Count; //设置当前回路的器件总数2017-04-06 }
public bool AddDevice(Model.LoopModel loop) { try { List <DeviceInfo8001> lstDevices = loop.GetDevices <DeviceInfo8001>(); foreach (var device in lstDevices) { device.Loop.ID = loop.ID; device.LoopID = loop.ID; //StringBuilder sbDeviceInfoSQL = new StringBuilder("REPLACE INTO DeviceInfo8001("); //sbDeviceInfoSQL.Append("ID,"); //sbDeviceInfoSQL.Append("Code,"); //sbDeviceInfoSQL.Append("Disable,"); //sbDeviceInfoSQL.Append("Feature,"); //sbDeviceInfoSQL.Append("DelayValue,"); //sbDeviceInfoSQL.Append("SensitiveLevel,"); //sbDeviceInfoSQL.Append("BoardNo,"); //sbDeviceInfoSQL.Append("SubBoardNo,"); //sbDeviceInfoSQL.Append("KeyNo,"); //sbDeviceInfoSQL.Append("BroadcastZone,"); //sbDeviceInfoSQL.Append("LinkageGroup1,"); //sbDeviceInfoSQL.Append("LinkageGroup2,"); //sbDeviceInfoSQL.Append("LinkageGroup3,"); //sbDeviceInfoSQL.Append("BuildingNo,"); //sbDeviceInfoSQL.Append("ZoneNo,"); //sbDeviceInfoSQL.Append("FloorNo,"); //sbDeviceInfoSQL.Append("RoomNo,"); //sbDeviceInfoSQL.Append("Location,"); //sbDeviceInfoSQL.Append("SDPKey,"); //sbDeviceInfoSQL.Append("MCBID,"); //sbDeviceInfoSQL.Append("LoopID,"); //sbDeviceInfoSQL.Append("TypeCode) "); //sbDeviceInfoSQL.Append(" VALUES("); //sbDeviceInfoSQL.Append(device.ID + ",'"); //sbDeviceInfoSQL.Append(device.Code + "','"); //sbDeviceInfoSQL.Append(device.Disable + "','"); //sbDeviceInfoSQL.Append(device.Feature + "','"); //sbDeviceInfoSQL.Append(device.DelayValue + "','"); //sbDeviceInfoSQL.Append(device.SensitiveLevel + "','"); //sbDeviceInfoSQL.Append(device.BoardNo + "','"); //sbDeviceInfoSQL.Append(device.SubBoardNo + "','"); //sbDeviceInfoSQL.Append(device.KeyNo + "','"); //sbDeviceInfoSQL.Append(device.BroadcastZone + "','"); //sbDeviceInfoSQL.Append(device.LinkageGroup1 + "','"); //sbDeviceInfoSQL.Append(device.LinkageGroup2 + "','"); //sbDeviceInfoSQL.Append(device.LinkageGroup3 + "','"); //sbDeviceInfoSQL.Append(device.BuildingNo + "','"); //sbDeviceInfoSQL.Append(device.ZoneNo + "','"); //sbDeviceInfoSQL.Append(device.FloorNo + "','"); //sbDeviceInfoSQL.Append(device.RoomNo + "','"); //sbDeviceInfoSQL.Append(device.Location + "','"); //sbDeviceInfoSQL.Append(device.sdpKey + "','"); //sbDeviceInfoSQL.Append(device.MCBID + "','"); //sbDeviceInfoSQL.Append(device.LoopID + "','"); //sbDeviceInfoSQL.Append(device.TypeCode + "');"); //_databaseService.ExecuteBySql(sbDeviceInfoSQL); _dbFileVersionService.AddDeviceForControllerType8001(device); } } catch (Exception ex) { return(false); } return(true); }