public int AppendAttributeForAll(string stationNumber, int objectType, string objectNumber, string objectDetail, string attributeCode, string attributeValue) { int error = 0; string[] attributeUploadKeys = new string[] { "ATTRIBUTE_CODE", "ATTRIBUTE_VALUE", "ERROR_CODE" }; string[] attributeUploadValues = new string[] { attributeCode, attributeValue, "0" }; string[] attributeResultValues = new string[] { }; error = imsapi.attribAppendAttributeValues(sessionContext, stationNumber, objectType, objectNumber, objectDetail, -1, 1, attributeUploadKeys, attributeUploadValues, out attributeResultValues); LogHelper.Info("Api attribAppendAttributeValues error=" + error + ",object type=" + objectType + ",object number=" + objectNumber + ",object detail=" + objectDetail + ",attribute code=" + attributeCode + ",attribute value=" + attributeValue + ", station number =" + stationNumber); if (error == 0) { view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, ""); } else { if (attributeResultValues.Length > 0) { if (attributeResultValues[2] == "-901")//attribute code not exist, create { imsapi.attribCreateAttribute(sessionContext, init.configHandler.StationNumber, objectType, attributeCode, attributeCode, "N"); error = imsapi.attribAppendAttributeValues(sessionContext, init.configHandler.StationNumber, objectType, objectNumber, objectDetail, -1, 1, attributeUploadKeys, attributeUploadValues, out attributeResultValues); string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext); if (error == 0) { view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, ""); } else { view.errorHandler(3, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error + "(" + errorString + ")", ""); } } } else { string errorString = UtilityFunction.GetZHSErrorString(error, init, sessionContext); view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error + "(" + errorString + ")", ""); } } return(error); }
public int AppendAttributeValues(string strCode, string strValue) { int error = 0; string errorMsg = ""; string[] attributeUploadKeys = new string[] { "ATTRIBUTE_CODE", "ATTRIBUTE_VALUE", "ERROR_CODE" }; string[] attributeUploadValues = new string[] { strCode, strValue, "0" }; string[] attributeResultValues = new string[] { }; LogHelper.Info("begin api attribAppendAttributeValues (attribute code =" + strCode + ",attribute value=" + strValue + ")"); error = imsapi.attribAppendAttributeValues(sessionContext, init.configHandler.StationNumber, 7, init.configHandler.StationNumber, "-1", -1, 1 , attributeUploadKeys, attributeUploadValues, out attributeResultValues); //imsapi.imsapiGetErrorText(sessionContext, error, out errorMsg); errorMsg = UtilityFunction.GetZHSErrorString(error, init, sessionContext); LogHelper.Info("end api attribAppendAttributeValues (result code = " + error + ")"); if (error == 0) { view.errorHandler(0, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error, ""); } else { view.errorHandler(2, init.lang.ERROR_API_CALL_ERROR + " attribAppendAttributeValues " + error + "(" + errorMsg + ")", ""); } return(error); }