new public int Add(IndexField val) { if (this._index != null) { val.SetIndex(this._index); } if ( !this.Contains(val) ) { return base.Add(val); } return -1; }
new public void Insert(int index, IndexField val) { if (this._index != null) { val.SetIndex(this._index); } if ( this.Contains(val) ) { this.Remove(val); } this.Insert(index, val); }
public static IList GetFields(IndexField sender) { ArrayList list = new ArrayList(); foreach (EntityField field in sender.Index.Entity.Fields) { list.Add(field.Name); } // Sort List list.Sort(0, list.Count, null); return list; }
public IndexFieldNameChangedEventArgs(IndexField field, string oldName, string newName) { this.IndexField = field; this.NewName = newName; this.OldName = oldName; }
private void btnFieldAutoIndex_Click(object sender, EventArgs e) { // Create Objects EntityFieldCollection entityFieldCollection = new EntityFieldCollection(); EntityField field; Entity entity; Index tmpNewIndex; IndexField tmpNewIndexField; Boolean bSub; // Get Selected Field field = (EntityField) GetSelectedItemOfType(typeof (EntityField)); // Get Current Entity entity = this.designView.CurrentEntity; // Check if Index exists if (field == null) // Create All Field Index { // Get All Fields entityFieldCollection = entity.Fields; } else { entityFieldCollection.Add(field); } // Looping on entityFieldCollection foreach (EntityField tmpEntityField in entityFieldCollection) { // Clear Found Flag bSub = false; // Check the Index Exists foreach(Index tmpIndex in entity.Indexes) { // Index Alread exists, Set Found Flag if (tmpIndex.Name.Equals(tmpEntityField.Name)) { bSub = true; break; } } if (! bSub) // Check's Found Flag { // Create Index tmpNewIndex = new Index(); tmpNewIndex.Name = tmpEntityField.Name; tmpNewIndex.PrimaryKey = tmpEntityField.KeyField; tmpNewIndex.Unique = tmpEntityField.DBIdentity; tmpNewIndex.SelectBy = true; tmpNewIndex.DeleteBy = tmpEntityField.KeyField; entity.Indexes.Add(tmpNewIndex); // Create Index Fields tmpNewIndexField = new IndexField(); tmpNewIndexField.Name = tmpEntityField.Name; tmpNewIndexField.ParameterName = tmpEntityField.Name; tmpNewIndex.Fields.Add(tmpNewIndexField); } } TreeNode rootNode = GetSelectedNodeOfType(typeof (Entity)); TreeNode indexesNode = rootNode.Nodes[1]; // Refresh List this.designView.RefreshIndexesList(indexesNode, entity, false); }