public bool registerBayLine(BayLineRequest line) { try { new DatabaseUpdate().registerBayLine(line); foreach (BayLineDeviceRequest device in line.listOfBayLineDevices) { device.requestID = line.requestID; new DatabaseUpdate().registerBayLineDevice(device); } } catch { return(false); } return(true); }
public void registerBayLine(BayLineRequest bayLine) { if (!(new AiGrow.Business.BL_BayLine().doesBayLineExist(bayLine.bay_line_unique_id))) { new BL_BayLine().insert(new ML_BayLine() { bay_line_unique_id = bayLine.bay_line_unique_id, bay_id = bayLine.bay_id }); } else { BaseResponse response = new BaseResponse(); response.success = false; response.errorMessage = UniversalProperties.DUPLICATE_BAY_LINE; response.errorCode = UniversalProperties.EC_RegistrationError; response.deviceID = bayLine.bay_line_unique_id; response.requestID = bayLine.requestID; string responseJSON = new JavaScriptSerializer().Serialize(response); new MQTTHandler().Publish(UniversalProperties.MQTT_topic, responseJSON); } }