public static bool ReportMachineProperty(string machineName, MachinePropertyLevel propertyLevel, string property, string value) { if (useTestMode) { TextLogger.LogInfo("Test mode machine property report => machine : {0}, level : {1}, property : {2}, value : {3}.", machineName, propertyLevel, property, value); return(true); } else { try { UpdateMachinePropertyRequest request = new UpdateMachinePropertyRequest { StatusFlag = "always", Environment = APRuntime.EnvironmentName, }; request.PropertyList.Add( new DMMachineProperty { MachineName = machineName, Level = propertyLevel, Property = property, Value = value }); DMServerResponseCode responseCode = dmCommands.UpdateMachineProperty(request); if (responseCode != DMServerResponseCode.Ok) { TextLogger.LogError("Failed to report {0} level machine property {1} against machine {2} with value {3}. Response code : {4}.", propertyLevel, property, machineName, value, responseCode); return(false); } return(true); } catch (Exception e) { TextLogger.LogError("Failed to report {0} level machine property {1} against machine {2} with value {3} : {4}.", propertyLevel, property, machineName, value, e); return(false); } } }
public static bool ReportMachineProperty(MachinePropertyLevel propertyLevel, string property, string value) { return(ReportMachineProperty(useTestMode ? Environment.MachineName : APRuntime.MachineName, propertyLevel, property, value)); }