Inheritance: IField
Example #1
0
 public bool Equals(Field other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.FieldType, FieldType)
         && other.Id.Equals(Id)
         && Equals(other.Value, Value)
         && Equals(other.Name, Name);
 }
Example #2
0
 public IField CreateField(FieldTypeKey key, object value)
 {
     var fieldType = _fieldTypes.SingleOrDefault(ft => ft.Key == key);
     if (fieldType == null) {
         fieldType = new FieldType(key);
     }
     var field = new Field(fieldType);
     field.Value = value;
     return field;
 }
Example #3
0
        internal void Load(AccountDto accountDto)
        {
            Id = accountDto.Id;
            _provider = new Provider(accountDto.ProviderKey);
            foreach (var fieldDto in accountDto.Fields) {
                var field = new Field(
                        new FieldType(fieldDto.FieldTypeKey.ToEnum<FieldTypeKey>()),
                        fieldDto.Id,
                        fieldDto.Name) {
                    Value = fieldDto.Value
                };
                _fields.Add(field);
            }
            foreach (var tagDto in accountDto.Tags) {
                Tags.Add(tagDto.Key);
            }
            Notes = accountDto.Notes;
            LastChangedUtc = accountDto.LastChangedUtc;

            SetClean();
        }