private void AddColumnToColumnsGrid(Column column) { SlyceTreeGridItem gridItem = new SlyceTreeGridItem(); gridItem.Tag = column; gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.Name)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.Description)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.IsNullable)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.OriginalDataType == null ? null : column.OriginalDataType.ToLower())); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.Default)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.OrdinalPosition)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.Size)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.SizeIsMax)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.Precision)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(column.Scale)); foreach (IKey key in Table.Keys) { SlyceTreeGridCellItem item = new SlyceTreeGridCellItem(key.Columns.Contains(column)); item.Enabled = true; // column.InPrimaryKey; gridItem.SubItems.Add(item); } slyceGrid1.Items.Add(gridItem); }
private void AddKeyToKeysGrid(Key key) { SlyceTreeGridItem gridItem = new SlyceTreeGridItem(); gridItem.Tag = key; gridItem.SubItems.Add(new SlyceTreeGridCellItem(key.Name)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(key.Keytype.ToString())); gridItem.SubItems.Add(new SlyceTreeGridCellItem(key.Description)); slyceGrid1.Items.Add(gridItem); }
private void AddPropertyToPropertiesGrid(ComponentPropertyImpl property) { SlyceTreeGridItem gridItem = new SlyceTreeGridItem(); gridItem.Tag = property; gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.Name)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.Type)); foreach (ArchAngel.Interfaces.ITemplate.IUserOption uo in property.Ex) { if (uo.DataType == typeof(bool?)) { bool?nullableBoolValue = (bool?)uo.Value; gridItem.SubItems.Add(new SlyceTreeGridCellItem(false, true, nullableBoolValue.HasValue ? nullableBoolValue.Value : false)); } else if (uo.DataType == typeof(string)) { gridItem.SubItems.Add(new SlyceTreeGridCellItem((string)uo.Value)); } else if (uo.DataType == typeof(int)) { gridItem.SubItems.Add(new SlyceTreeGridCellItem((int)uo.Value)); } else if (uo.DataType == typeof(bool)) { gridItem.SubItems.Add(new SlyceTreeGridCellItem((bool)uo.Value)); } else { throw new NotImplementedException("Type not handled yet: " + uo.DataType.Name); } } gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.FractionalDigits, ApplicableOptions.Digits)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.FutureDate, ApplicableOptions.Date)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.IntegerDigits, ApplicableOptions.Digits)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MaximumLength, ApplicableOptions.Length)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MinimumLength, ApplicableOptions.Length)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MaximumValue, ApplicableOptions.Value)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MinimumValue, ApplicableOptions.Value)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.NotEmpty, ApplicableOptions.NotEmpty)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.Nullable, ApplicableOptions.Nullable)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.PastDate, ApplicableOptions.Date)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.RegexPattern, ApplicableOptions.RegexPattern)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.ValidationOptions.Validate, (ValidationOptions.GetApplicableValidationOptionsForType(property.Type) & ApplicableOptions.Validate) != ApplicableOptions.Validate)); slyceGrid1.Items.Add(gridItem); }
private void AddEntityToEntitiesGrid(Entity entity) { SlyceTreeGridItem gridItem = new SlyceTreeGridItem(); gridItem.Tag = entity; gridItem.SubItems.Add(new SlyceTreeGridCellItem(entity.Name)); #region Namespaces if (ShowNamespaces) { bool exists = false; foreach (CustomNamespace ns in EntitySet.CustomNamespaces.OrderBy(n => n.Value)) { exists = true; bool isChecked = ns.Entities.Contains(entity); gridItem.SubItems.Add(new SlyceTreeGridCellItem(isChecked)); } if (!exists) { gridItem.SubItems.Add(new SlyceTreeGridCellItem(null)); } } #endregion #region Attributes if (ShowAttributes) { bool exists = false; foreach (CustomAttribute ca in EntitySet.CustomAttributes.OrderBy(n => n.RawName)) { exists = true; bool isChecked = ca.Entities.Contains(entity); gridItem.SubItems.Add(new SlyceTreeGridCellItem(isChecked)); } if (!exists) { gridItem.SubItems.Add(new SlyceTreeGridCellItem(null)); } } #endregion #region Implements if (ShowImplements) { bool exists = false; foreach (CustomImplement ci in EntitySet.CustomImplements.OrderBy(n => n.Value)) { exists = true; bool isChecked = ci.Entities.Contains(entity); gridItem.SubItems.Add(new SlyceTreeGridCellItem(isChecked)); } if (!exists) { gridItem.SubItems.Add(new SlyceTreeGridCellItem(null)); } } #endregion #region Properties if (ShowProperties) { bool exists = false; foreach (CustomProperty cp in EntitySet.CustomProperties.OrderBy(n => n.Name)) { exists = true; bool isChecked = cp.Entities.Contains(entity); gridItem.SubItems.Add(new SlyceTreeGridCellItem(isChecked)); } if (!exists) { gridItem.SubItems.Add(new SlyceTreeGridCellItem(null)); } } #endregion #region Functions if (ShowFunctions) { bool exists = false; foreach (CustomFunction cm in EntitySet.CustomFunctions.OrderBy(n => n.Name)) { exists = true; bool isChecked = cm.Entities.Contains(entity); gridItem.SubItems.Add(new SlyceTreeGridCellItem(isChecked)); } if (!exists) { gridItem.SubItems.Add(new SlyceTreeGridCellItem(null)); } } #endregion slyceGridEntities.Items.Add(gridItem); }
private void AddPropertyToPropertiesGrid(ArchAngel.Providers.EntityModel.Model.EntityLayer.Property property, bool hasMultiSchemas) { SlyceTreeGridItem gridItem = new SlyceTreeGridItem(); gridItem.Tag = property; gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.Name)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.Type)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.NHibernateType)); int numTables = MappedTables.Count; IColumn mappedColumn = property.MappedColumn(); string mappedColumnName; if (mappedColumn == null) { mappedColumnName = ""; } else if (numTables == 1) { mappedColumnName = mappedColumn.Name; } else if (hasMultiSchemas) { mappedColumnName = string.Format("{0}.{1}.{2}", mappedColumn.Parent.Schema, mappedColumn.Parent.Name, mappedColumn.Name); } else { mappedColumnName = string.Format("{0}.{1}", mappedColumn.Parent.Name, mappedColumn.Name); } gridItem.SubItems.Add(new SlyceTreeGridCellItem(mappedColumnName)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.IsKeyProperty)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.ReadOnly)); foreach (ArchAngel.Interfaces.ITemplate.IUserOption uo in property.Ex.OrderBy(u => u.Name)) { if (uo.DataType == typeof(bool?)) { bool?nullableBoolValue = (bool?)uo.Value; gridItem.SubItems.Add(new SlyceTreeGridCellItem(false, true, nullableBoolValue.HasValue ? nullableBoolValue.Value : false)); } else if (uo.DataType == typeof(string)) { gridItem.SubItems.Add(new SlyceTreeGridCellItem((string)uo.Value)); } else if (uo.DataType == typeof(int)) { gridItem.SubItems.Add(new SlyceTreeGridCellItem((int)uo.Value)); } else if (uo.DataType == typeof(bool)) { gridItem.SubItems.Add(new SlyceTreeGridCellItem((bool)uo.Value)); } else if (uo.DataType.ToString() == "ArchAngel.Interfaces.NHibernateEnums.PropertyAccessTypes") { gridItem.SubItems.Add(new SlyceTreeGridCellItem(uo.Value.ToString())); } else if (uo.DataType.ToString() == "ArchAngel.Interfaces.NHibernateEnums.PropertyGeneratedTypes") { gridItem.SubItems.Add(new SlyceTreeGridCellItem(uo.Value.ToString())); } else { throw new NotImplementedException("Type not handled yet: " + uo.DataType.Name); } } gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.FractionalDigits, ApplicableOptions.Digits)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.FutureDate, ApplicableOptions.Date)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.IntegerDigits, ApplicableOptions.Digits)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MaximumLength, ApplicableOptions.Length)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MinimumLength, ApplicableOptions.Length)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MaximumValue, ApplicableOptions.Value)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.MinimumValue, ApplicableOptions.Value)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.NotEmpty, ApplicableOptions.NotEmpty)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.Nullable, ApplicableOptions.Nullable)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.PastDate, ApplicableOptions.Date)); gridItem.SubItems.Add(CreateNewNullableCell(property, property.ValidationOptions.RegexPattern, ApplicableOptions.RegexPattern)); gridItem.SubItems.Add(new SlyceTreeGridCellItem(property.ValidationOptions.Validate, (ValidationOptions.GetApplicableValidationOptionsForType(property.Type) & ApplicableOptions.Validate) != ApplicableOptions.Validate)); slyceGrid1.Items.Add(gridItem); }