public bool registerBayRackLevelLine(BayRackLevelLineRequest line) { try { new DatabaseUpdate().registerBayRackLevelLine(line); foreach (BayRackLevelLineDeviceRequest device in line.listOfBayRackLevelLineDevices) { device.requestID = line.requestID; new DatabaseUpdate().registerBayRackLevelLineDevice(device); } } catch { return(false); } return(true); }
public void registerBayRackLevelLine(BayRackLevelLineRequest bayRackLevelLine) { if (!(new AiGrow.Business.BL_BayRackLevelLine().doesBayRackLevelLineExist(bayRackLevelLine.level_line_unique_id))) { new BL_BayRackLevelLine().insert(new ML_BayRackLevelLine() { level_id = bayRackLevelLine.level_id, level_line_unique_id = bayRackLevelLine.level_line_unique_id }); } else { BaseResponse response = new BaseResponse(); response.success = false; response.errorMessage = UniversalProperties.DUPLICATE_BAY_RACK_LEVEL_LINE; response.errorCode = UniversalProperties.EC_RegistrationError; response.deviceID = bayRackLevelLine.level_line_unique_id; response.requestID = bayRackLevelLine.requestID; string responseJSON = new JavaScriptSerializer().Serialize(response); new MQTTHandler().Publish(UniversalProperties.MQTT_topic, responseJSON); } }