void SaveField() { AWAPI_Data.Data.awContentCustomField f = new AWAPI_Data.Data.awContentCustomField(); //update current if (_customFieldId.Text != "") { f.customFieldId = Convert.ToInt64(_customFieldId.Text); } else { f.contentId = ContentId; f.userId = App_Code.SessionInfo.CurrentUser.userId; } f.title = _title.Text; f.description = _description.Text; f.isEnabled = _isEnabled.Checked; f.applyToSubContents = _applyToChildContent.Checked; f.fieldType = _fieldType.SelectedValue; f.maximumLength = Convert.ToInt32(_maximumLength.Text); f.minimumValue = _minimumValue.Text; f.maximumValue = _maximumValue.Text; f.defaultValue = _defaultValue.Text; f.regularExpression = _regularExpression.Text; f.sortOrder = Convert.ToInt32(_sortOrder.Text); f.customFieldId = _customLib.SaveField(f); _customFieldId.Text = f.customFieldId.ToString(); ShowHildeControls(true); PopulateFields(); }
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, ""); } } }
void PopulateField(Int64 fieldId) { AWAPI_Data.Data.awContentCustomField cstField = _customLib.GetField(fieldId); _customFieldId.Text = cstField.customFieldId.ToString(); _title.Text = cstField.title; _description.Text = cstField.description; _isEnabled.Checked = cstField.isEnabled; _applyToChildContent.Checked = cstField.applyToSubContents; _fieldType.SelectedValue = cstField.fieldType; _maximumLength.Text = cstField.maximumLength.ToString(); _minimumValue.Text = cstField.minimumValue; _maximumValue.Text = cstField.maximumValue; _defaultValue.Text = cstField.defaultValue; _regularExpression.Text = cstField.regularExpression; _sortOrder.Text = cstField.sortOrder.ToString(); ShowHildeControls(true); }
public long SaveField(AWAPI_Data.Data.awContentCustomField fld) { return(base.Channel.SaveField(fld)); }