상속: IEnumerable
예제 #1
0
    protected void Add(DbField field, string standardValue)
    {
      this.Fields.Add(field);

      var standardValueField = new DbField(field.Name) { ID = field.ID, Value = standardValue };
      this.StandardValues.Add(standardValueField);
    }
예제 #2
0
    public void GetFieldsToEdit_ItemHasFields_ReturnFields(Db db, DbItem item, DbField field1, DbField field2)
    {
      item.Add(field1);
      item.Add(field2);
      db.Add(item);
      var testItem = db.GetItem(item.ID);
      var expectedResult = new [] {field1.Name + "|" + field2.Name, field2.Name + "|" + field1.Name};

      GetFieldsToEditService.GetFieldsToEdit(testItem).Should().BeOneOf(expectedResult);
    }
예제 #3
0
    public new void Add(ID id, string standardValue)
    {
      var field = new DbField(id);

      this.Add(field, standardValue);
    }
예제 #4
0
    public new void Add(string fieldName, string standardValue)
    {
      var field = new DbField(fieldName);

      this.Add(field, standardValue);
    }
예제 #5
0
 public void HasFieldValue_FieldDoesNotExist_ShouldReturnFalse(Db db, DbItem item, DbField field)
 {
   //Arrange
   db.Add(item);
   var testItem = db.GetItem(item.ID);
   //Act
   testItem.FieldHasValue(field.ID).Should().BeFalse();
 }
예제 #6
0
 public void HasFieldValue_FieldIsNull_ShouldReturnFalse(Db db, DbItem item, DbField field)
 {
   //Arrange
   field.Value = null;
   item.Add(field);
   db.Add(item);
   var testItem = db.GetItem(item.ID);
   //Act
   testItem.FieldHasValue(field.ID).Should().BeFalse();
 }
예제 #7
0
 public void HasFieldValue_FieldHasValue_ShouldReturnTrue(Db db, DbItem item, DbField field, string value)
 {
   //Arrange
   field.Value = value;
   item.Add(field);
   db.Add(item);
   var testItem = db.GetItem(item.ID);
   //Act
   testItem.FieldHasValue(field.ID).Should().BeTrue();
 }
예제 #8
0
    /// <summary>
    /// Adds a new <see cref="DbField"/> to the item.
    /// </summary>
    /// <param name="field">The field.</param>
    public void Add(DbField field)
    {
      Assert.ArgumentNotNull(field, "field");

      this.Fields.Add(field);
    }
예제 #9
0
 public void Add(DbField field)
 {
   this.Fields.Add(field);
 }
예제 #10
0
    /// <summary>
    /// Adds a specific field with a Standard Value.
    /// </summary>
    /// <param name="field">The field.</param>
    /// <param name="standardValue">The field standard value.</param>
    public void Add(DbField field, string standardValue)
    {
      this.Fields.Add(field);

      var standardValueField = new DbField(field.Name, field.ID)
      {
        Shared = field.Shared,
        Source = field.Source,
        Type = field.Type,
        Value = standardValue
      };
      this.StandardValues.Add(standardValueField);
    }
예제 #11
0
    public void Add(string fieldName, string standardValue)
    {
      var field = new DbField(fieldName) { ID = ID.NewID };

      this.Add(field, standardValue);
    }
예제 #12
0
    protected virtual void CreateTemplate(DbItem item)
    {
      var isResolved = this.ResolveTemplate(item);
      if (isResolved)
      {
        return;
      }

      if (!ID.IsNullOrEmpty(item.TemplateID) && this.DataStorage.GetFakeTemplate(item.TemplateID) != null)
      {
        return;
      }

      if (item.TemplateID == ID.Null)
      {
        item.TemplateID = ID.NewID;
      }

      var fields = new DbFieldCollection();
      foreach (var itemField in item.Fields)
      {
        var templatefield = new DbField(itemField.Name) { ID = itemField.ID };
        fields.Add(templatefield);
      }

      var template = new DbTemplate(item.Name, item.TemplateID, fields);

      this.Add(template);
    }