/// <summary> /// Insert the field in the collection at the index /// </summary> /// <param name="index">index</param> /// <param name="field">field</param> internal void Insert(int index,Field field) { this.InnerList.Insert(index, field); }
/// <summary> /// Remove the metadata from the collection /// </summary> /// <param name="collectionField"></param> /// <param name="field"></param> private void RemoveMetadata(FieldsCollection collectionField, Field field) { string[] DeletedField = new string[0]; string FieldIds=string.Empty; foreach (Field MetadataField in collectionField) { // Indicator metadata if (field.FieldID == Indicator.IndicatorName) { if (MetadataField.FieldID.StartsWith(DI_LibBAL.UI.UserPreference.UserPreference.DataviewPreference.MetadataIndicator)) { FieldIds = MetadataField.FieldID + ","; } } // Area metadata else if (field.FieldID== Area.AreaID || field.FieldID == Area.AreaName) { if (MetadataField.FieldID.StartsWith(DI_LibBAL.UI.UserPreference.UserPreference.DataviewPreference.MetadataArea)) { FieldIds = MetadataField.FieldID + ","; } } // Source metadata else if (field.FieldID == IndicatorClassifications.ICName) { if (MetadataField.FieldID.StartsWith(DI_LibBAL.UI.UserPreference.UserPreference.DataviewPreference.MetadataSource)) { FieldIds = MetadataField.FieldID + ","; } } } // delete the fields from list DeletedField = FieldIds.Split(",".ToCharArray()); for (int i = 0; i < DeletedField.Length - 1; i++) { if (!string.IsNullOrEmpty(DeletedField[i].Trim())) { collectionField.Remove(collectionField[DeletedField[i]]); } } }
/// <summary> /// Delete the field object from the collection /// </summary> /// <param name="Field"></param> public void Remove(Field Field) { InnerList.Remove(Field); }
/// <summary> /// Move the field up by 1 index /// </summary> /// <param name="index"></param> /// <param name="field"></param> public void MoveUp(int index,Field field) { this.InnerList.Insert(index - 1, field); this.InnerList.RemoveAt(index + 1); if (this._Source == FieldSource.Column) { this.RaiseColumnOrderChangeEvent(); } }
/// <summary> /// Move the field on the top of the collection. /// </summary> /// <param name="field"></param> public void MoveToTop(Field field) { this.InnerList.Remove(field); this.InnerList.Insert(0,field); }
/// <summary> /// Move the field on the top of the collection. /// </summary> /// <param name="field"></param> public void MoveToEnd(Field field) { this.InnerList.Remove(field); this.InnerList.Insert(this.Count, field); }
/// <summary> /// Add a Field to the fields collection. /// </summary> /// <param name="Field">Field object</param> public void Add(Field Field) { this.InnerList.Add(Field); //raise the event this.RaiseAfterAddedEvent(this._Source, Field.FieldID); }