public ReferenceField Clone() { ReferenceField c = new ReferenceField(); if (c.attributes != null) { c.attributes = attributes.Clone(); } c.refType = refType; c.Name = Name; c.CustomPrivateName = CustomPrivateName; c.CustomColumnName = CustomColumnName; c.refMode = refMode; c.Caption = Caption; c.Description = Description; c.refMode = refMode; c.isIndexed = isIndexed; c.isUnique = isUnique; c.isTableCoded = isTableCoded; c.tableName = tableName; c.group = group; c.cascadeSaveEnabled = cascadeSaveEnabled; c.enableCache = enableCache; c.isClientCollectionAddEnabled = isClientCollectionAddEnabled; c.isClientCollectionDeleteEnabled = isClientCollectionDeleteEnabled; c.isClientCollectionEditEnabled = isClientCollectionEditEnabled; c.isClientEditEnabled = isClientEditEnabled; c.isClientGridEnabled = isClientGridEnabled; c.isClientViewEnabled = isClientViewEnabled; return(c); }
public void Remove(ReferenceField value) { int index = IndexOf(value); if (index == -1) { throw(new Exception("ChildEntry not found in collection.")); } RemoveAt(index); }
public int IndexOf(ReferenceField value) { for (int x = 0; x < itemCount; x++) { if (ChildEntryArray[x].Equals(value)) { return(x); } } return(-1); }
public void Insert(int index, ReferenceField value) { itemCount++; if (itemCount > ChildEntryArray.Length) { for (int x = index + 1; x == itemCount - 2; x++) { ChildEntryArray[x] = ChildEntryArray[x - 1]; } } ChildEntryArray[index] = value; }
public int Add(ReferenceField value) { itemCount++; if (itemCount > ChildEntryArray.GetUpperBound(0) + 1) { ReferenceField[] tempChildEntryArray = new ReferenceField[itemCount * 2]; for (int x = 0; x <= ChildEntryArray.GetUpperBound(0); x++) { tempChildEntryArray[x] = ChildEntryArray[x]; } ChildEntryArray = tempChildEntryArray; } ChildEntryArray[itemCount - 1] = value; return(itemCount - 1); }
public void MoveDown(ReferenceField c) { int i = IndexOf(c); // Don't do anything if this field is already on bottom if (i == this.Count - 1) { return; } ReferenceField swap = ChildEntryArray[i + 1]; ChildEntryArray[i + 1] = c; ChildEntryArray[i] = swap; }
public void MoveUp(ReferenceField c) { int i = IndexOf(c); // Don't do anything if this field is already on top if (i == 0) { return; } ReferenceField swap = ChildEntryArray[i - 1]; ChildEntryArray[i - 1] = c; ChildEntryArray[i] = swap; }
public ModelClass(XmlTextReader r, string version) { extended = new Dictionary <Type, ModelClassExtension>(); // BE SURE TO CREATE SYSTEM FOLDER! if (r.Name != "ClassObject") { throw new Exception(string.Format("Source file does not match NitroCast DTD; " + "expected 'ClassModel', found '{0}'.", r.Name)); } r.MoveToAttribute("Name"); name = r.Value; r.MoveToAttribute("NameSpace"); _namespace = r.Value; r.MoveToContent(); r.Read(); outputpath = r.ReadElementString("OutputPath"); if (r.Name == "WebOutputPath") { webOutputPath = r.ReadElementString("WebOutputPath"); } defaultTableName = r.ReadElementString("DefaultTableName"); isTableCoded = bool.Parse(r.ReadElementString("DefaultTableNameHardCoded")); caption = r.ReadElementString("Caption"); description = r.ReadElementString("Description"); summary = r.ReadElementString("Summary"); if (r.Name == "IsCachingEnabled") { isCachingEnabled = bool.Parse(r.ReadElementString("IsCachingEnabled")); } if (r.Name == "CacheClass") { cacheClass = r.ReadElementString("CacheClass"); } if (r.Name == "CacheName") { cacheName = r.ReadElementString("CacheName"); } if (r.Name == "AspNetCachingEnabled") { isCachingEnabled = bool.Parse(r.ReadElementString("AspNetCachingEnabled")); } if (r.Name == "CacheLifetime") { cacheLifetime = TimeSpan.Parse(r.ReadElementString("CacheLifetime")); } if (r.Name == "IsCollectionCachingEnabled") { isCollectionCachingEnabled = bool.Parse(r.ReadElementString("IsCollectionCachingEnabled")); } if (r.Name == "CollectionCacheLifetime") { collectionCacheLifetime = TimeSpan.Parse(r.ReadElementString("CollectionCacheLifetime")); } if (r.Name == "LockType") { concurrency = (ConcurrencyType)Enum.Parse(typeof(ConcurrencyType), r.ReadElementString("LockType"), true); } if (r.Name == "Concurrency") { concurrency = (ConcurrencyType)Enum.Parse(typeof(ConcurrencyType), r.ReadElementString("Concurrency"), true); } if (r.Name == "IsThreadSafe") { isThreadSafe = bool.Parse(r.ReadElementString("IsThreadSafe")); } if (r.Name == "IsCreateDateEnabled") { r.ReadElementString("IsCreateDateEnabled"); } if (r.Name == "IsModifyDateEnabled") { r.ReadElementString("IsModifyDateEnabled"); } if (r.Name == "Interfaces") { interfaces = r.ReadElementString("Interfaces"); } if (r.Name == "ToStringOverride") { toStringOverride = r.ReadElementString("ToStringOverride"); } if (r.Name == "SimpleQueryEnabled") { simpleQueryEnabled = bool.Parse(r.ReadElementString("SimpleQueryEnabled")); } #region Obsolete Code // Place old version of fields data in data folder if (r.Name == "Fields") { // Make sure there is a default folder! if (folders.Count == 0) { ClassFolder defaultFolder = new ClassFolder("Default"); defaultFolder.ParentClass = this; folders.Add(defaultFolder); } if (!r.IsEmptyElement) { r.Read(); while (r.LocalName == "FieldEntry") { ValueField field = new ValueField(r, version); field.ParentFolder = folders[0]; folders[0].Items.Add(field); } r.ReadEndElement(); } else { r.Read(); } } // Place old version of children data in data folder if (r.Name == "Children") { // Make sure there is a default folder! if (folders.Count == 0) { ClassFolder defaultFolder = new ClassFolder("Default"); folders.Add(defaultFolder); } if (!r.IsEmptyElement) { r.Read(); while (r.LocalName == "ChildEntry") { ReferenceField field = new ReferenceField(r, version); field.ParentFolder = folders[0]; folders[0].Items.Add(field); } r.ReadEndElement(); } else { r.Read(); } } #endregion if (r.Name == "ClassFolders") { if (!r.IsEmptyElement) { r.Read(); while (r.LocalName == "ClassFolder") { ClassFolder folder = new ClassFolder(r, version); folder.ParentClass = this; folders.Add(folder); } r.ReadEndElement(); } else { r.Read(); } } if (r.Name == "OutputPlugins") { if (!r.IsEmptyElement) { r.Read(); while (r.LocalName == "ClassOutputConnector") { outputConnectors.Add(new OutputExtensionConnector(r, this)); } r.ReadEndElement(); } else { r.Read(); } } if (r.Name == "MetaAttributes") { if (!r.IsEmptyElement) { r.Read(); while (r.LocalName == "MetaAttribute") { attributes.Add(new MetaAttribute(r)); } r.ReadEndElement(); } else { r.Read(); } } if (r.Name == "Extensions") { if (!r.IsEmptyElement) { r.Read(); while (r.Name == "Extension") { ModelClassExtension newExtension = (ModelClassExtension) ObjectExtension.Build(r, version); extended.Add(newExtension.GetType(), newExtension); } r.ReadEndElement(); } else { r.Read(); } } r.ReadEndElement(); EnsureSystemFolderExists(); }
public ClassFolder(XmlTextReader r, string version) : this() { if (r.Name != "ClassFolder") { throw new Exception(string.Format("Source file does not match NitroCast DTD; " + "expected 'ClassModel', found '{0}'.", r.Name)); } base.ParseXml(r); if (r.Name == "Builder") { ClassFolderBuilder.Builders.TryGetValue(r.ReadElementString("Builder"), out builder); } _isExpanded = bool.Parse(r.ReadElementString("IsExpanded")); _isItemListExpanded = bool.Parse(r.ReadElementString("IsItemListExpanded")); if (r.Name == "IsReadOnly") { _isReadOnly = bool.Parse(r.ReadElementString("IsReadOnly")); } else { _isReadOnly = false; } if (r.Name == "IsBrowsable") { _isBrowsable = bool.Parse(r.ReadElementString("IsBrowsable")); } else { _isBrowsable = true; } if (r.Name == "IsPartition") { _isPartition = bool.Parse(r.ReadElementString("IsPartition")); } else { _isPartition = false; } if (r.Name == "DataMode") { _dataMode = (ClassFolderDataMode)Enum.Parse(typeof(ClassFolderDataMode), r.ReadElementString("DataMode"), true); } else { _dataMode = ClassFolderDataMode.Integrated; } if (r.Name == "Items") { if (!r.IsEmptyElement) { r.Read(); while ((r.Name == "FieldEntry" | r.Name == "ChildEntry" | r.Name == "EnumField")) { //r.Read(); switch (r.LocalName) { case "FieldEntry": ValueField vf = new ValueField(r, version); vf.ParentFolder = this; items.Add(vf); break; case "ChildEntry": ReferenceField rf = new ReferenceField(r, version); rf.ParentFolder = this; items.Add(rf); break; case "EnumField": EnumField ef = new EnumField(r, version); ef.ParentFolder = this; items.Add(ef); break; } } r.ReadEndElement(); } else { r.Read(); } } if (r.Name == "Extensions") { if (!r.IsEmptyElement) { r.Read(); while (r.Name == "Extension") { ClassFolderExtension newExtension = (ClassFolderExtension) ObjectExtension.Build(r, version); extensions.Add(newExtension.GetType(), newExtension); r.ReadEndElement(); } r.ReadEndElement(); } else { r.Read(); } } r.ReadEndElement(); }
public int CompareTo(ReferenceField x) { return(Name.CompareTo(x.Name)); }
public bool Contains(ReferenceField value) { return(IndexOf(value) != -1); }