void CopyContentCustomFieldsFromRemoteToCurrentServer(long contentId, string cultureCode) { string url = GetFullUrl(_serviceUrl.Text, SERVICEURL_CONTENT); AWAPI_ContentService.ContentServiceClient client = new AWAPI.AWAPI_ContentService.ContentServiceClient("basicHttp_ContentService", url); AWAPI_Data.CustomEntities.ContentCustomField[] customFields = client.GetFieldList(contentId); AWAPI_Data.CustomEntities.ContentCustomFieldValueExtended[] values = client.GetFieldValueList(contentId, cultureCode); //Add Fields if (customFields == null || customFields.Length == 0) { return; } ContentCustomFieldLibrary lib = new ContentCustomFieldLibrary(); foreach (AWAPI_Data.CustomEntities.ContentCustomField cf in customFields) { AWAPI_Data.Data.awContentCustomField fld = lib.GetField(cf.customFieldId); if (cf.fieldContentId != contentId) { break; } if (fld == null) { fld = new AWAPI_Data.Data.awContentCustomField(); } fld.contentId = contentId; fld.customFieldId = cf.customFieldId; fld.title = cf.title; fld.description = cf.description; fld.applyToSubContents = cf.applyToSubContents; fld.fieldType = cf.fieldType; fld.maximumLength = cf.maximumLength; fld.maximumValue = cf.maximumValue; fld.minimumValue = cf.minimumValue; fld.defaultValue = cf.defaultValue; fld.regularExpression = cf.regularExpression; fld.sortOrder = cf.sortOrder; fld.isEnabled = cf.isEnabled; fld.lastBuildDate = DateTime.Now; //lib.SaveField(true, fld); } //Add Values if (values != null && values.Length > 0) { foreach (AWAPI_Data.CustomEntities.ContentCustomFieldValueExtended value in values) { lib.UpdateFieldValue(value.contentId, value.customFieldId, App_Code.SessionInfo.CurrentUser.userId, value.fieldValue, ""); } } }
/// <summary> /// /// </summary> /// <param name="siteTagId"></param> /// <param name="fieldId"></param> /// <param name="userId"></param> /// <param name="value"></param> /// <returns></returns> public long UpdateFieldValue(long contentId, int fieldId, long userId, string value, string cultureCode) { return(_contentCustomField.UpdateFieldValue(contentId, fieldId, userId, value, cultureCode)); }