internal void addLocalTypeItem(TypeItem item) { if (!this.isTypeItemExist(this.localTypeCollection, item)) { this.addTypeItemToCollection(this.localTypeCollection, item); } }
internal void addOnlineTypeItem(TypeItem item) { if (!this.isTypeItemExist(this.onlineTypeCollection, item)) { this.addTypeItemToCollection(this.onlineTypeCollection, item); } }
private void addTypeItemToCollection(TypeCollection collection, TypeItem item) { if (item.ParentType == 0) { collection.Add(item); } else { foreach (TypeItem temp in collection) { if (temp.Type == item.ParentType) { temp.SubTypeItems.Add(item); break; } } } }
private bool isTypeItemExist(TypeCollection collection, TypeItem item) { foreach (TypeItem temp in collection) { if (temp.Type == item.Type) { return(true); } foreach (TypeItem subTemp in temp.SubTypeItems) { if (subTemp.Type == item.Type) { return(true); } } } return(false); }