Esempio n. 1
0
        public void AddCustomField(string value)
        {
            CustomField field = Scout.Core.Data.CreateEntity <CustomField>(Session);

            field.FieldName = value;
            CustomFields.Add(field);
        }
        /// <summary>
        /// Convenience method for adding a boolean custom field.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void AddCustomField(string key, bool value)
        {
            var customField = new CustomField();

            customField.Name  = key;
            customField.Value = value ? "true" : "false";
            CustomFields.Add(customField);
        }
Esempio n. 3
0
        /// <summary>
        /// Convenience method for adding a custom field.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void AddCustomField(string key, string value)
        {
            var customField = new CustomField();

            customField.Name  = key;
            customField.Value = value;
            CustomFields.Add(customField);
        }
Esempio n. 4
0
        public void AddCustomFields(string field, string value)
        {
            if (_customFields == null)
            {
                _customFields = new Dictionary <string, string>();
            }

            CustomFields.Add(field, value);
        }
Esempio n. 5
0
 /// <summary>
 /// Retrieve a Field based off of its custom field Id.
 /// This is only for custom fields - use a string to search custom fields.
 /// </summary>
 /// <param name="fieldId">Custom Field Id</param>
 /// <returns>CustomField if found, otherwise null</returns>
 public CustomField this[Int64 fieldId]
 {
     get { return(CustomFields.FirstOrDefault(f => f.Id == fieldId)); }
     set
     {
         var matchingCustomField = CustomFields.FirstOrDefault(f => f.Id == fieldId);
         CustomFields.Remove(matchingCustomField);
         CustomFields.Add(value);
     }
 }
Esempio n. 6
0
 private void SetCustomFields()
 {
     foreach (KeyValuePair <string, string> kvp in specDef)
     {
         if (_baseForm.ContainsKey(kvp.Key))
         {
             CustomFields.Add(kvp.Key, _baseForm[kvp.Key]);
         }
     }
 }
        /// <summary>
        /// Convenience method for adding a custom field.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="editor"></param>
        /// <param name="required"></param>
        public void AddCustomField(string key, string value, string editor = null, bool?required = null)
        {
            var customField = new CustomField();

            customField.Name     = key;
            customField.Value    = value;
            customField.Editor   = editor;
            customField.Required = required;
            CustomFields.Add(customField);
        }
Esempio n. 8
0
        public virtual void SetCustomField(string name, string value)
        {
            var fieldValue = CustomFields.FirstOrDefault(f => f.FieldName == name);

            if (fieldValue != null)
            {
                fieldValue.FieldValue = value;
            }
            else
            {
                fieldValue = new ProductCustomField(name, value);
                CustomFields.Add(fieldValue);
            }
        }
Esempio n. 9
0
        public PwEntryViewModel(PwEntry model)
        {
            Model = model;

            // Check custom fields in the strings model
            foreach (var field in Model.Strings)
            {
                if (!CustomFieldsExcludedValues.Contains(field.Key))
                {
                    // This fields is a custom field
                    CustomFields.Add(new KeyValuePair <string, string>(field.Key, field.Value.ReadString()));
                }
            }

            CopyUsernameCommand = new RelayCommand(CopyUsernameAction);
            CopyPasswordCommand = new RelayCommand(CopyPasswordAction);
            CopyUrlCommand      = new RelayCommand(CopyUrlAction);
        }
Esempio n. 10
0
 // commands
 private void AddCustomField(object obj)
 {
     try
     {
         int tag = int.Parse(this.CustomFixTag);
         lock (_customFieldsLock)
         {
             foreach (CustomFieldRecord r in CustomFields)
             {
                 if (r.Tag == tag)
                 {
                     r.Value = this.CustomFixValue;
                     return;
                 }
             }
             CustomFields.Add(new CustomFieldRecord(tag, this.CustomFixValue));
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine(e.ToString());
     }
 }