private void AddcolumnsToEntitySymbol(EntitySymbol et, MetaDataTable metadati, out int maxWidth)
        {
            maxWidth = TextRenderer.MeasureText(metadati.Name, new Font(baseEntityFont.FontFamily, baseEntityFont.Size + 3)).Width;
            var names = metadati.Columns.Select(t => t.Name);

            foreach (string name in names)
            {
                et.AddColumn(name);
                maxWidth = TextRenderer.MeasureText(name, baseEntityFont).Width > maxWidth ? TextRenderer.MeasureText(name, baseEntityFont).Width : maxWidth;
            }
        }
 public List<RectangularLine> GetRelationshipsByEntity(EntitySymbol entity)
 {
     var shapes = GetAllRelationships();
     return shapes.Where(shape => shape.Tag.ToString().Substring(0, shape.Tag.ToString().Length - 1).Split('|').Contains((string)entity.Tag)).ToList();
 }
 public List<Label> GetRelationshipLabelsByEntity(EntitySymbol entity)
 {
     var shapes = GetAllLabels();
     return shapes.Where(shape => shape.Tag.ToString().Contains((string) entity.Tag)).ToList();
 }
 public AddColumnCommand(EntitySymbol shape, string columnText)
     : base(shape, columnText)
 {
     base.description = string.Format("Add column to {0}", shape.Type.Name);
 }
        internal List<Shape> GetLinkedShapes(EntitySymbol selectedEntity)
        {
            List<Shape> matchingShapes = new List<Shape>();

            var rels = GetRelationshipsByEntity(selectedEntity);
            matchingShapes.AddRange(rels);
            matchingShapes.AddRange(GetRelationshipLabelsByEntity(selectedEntity));
            foreach (var rel in rels)
                matchingShapes.AddRange(GetEntitiesByRelationship(rel).Excluding(selectedEntity));

            return matchingShapes;
        }
 public RemoveColumnCommand(EntitySymbol shape, int removeColumnIndex, string columnText)
     : base(shape, columnText)
 {
     base.description = string.Format("Remove column '{0}' from {1}", columnText, shape.Type.Name);
     this.removeIndex = removeColumnIndex;
 }
 public InsertColumnCommand(EntitySymbol shape, int beforeColumnIndex, string columnText)
     : base(shape, columnText)
 {
     base.description = string.Format("Insert new column in {0}", shape.Type.Name);
     this.beforeIndex = beforeColumnIndex;
 }
 /// <override></override>
 public override Shape Clone()
 {
     Shape result = new EntitySymbol(Type, (Template)null);
     result.CopyFrom(this);
     return result;
 }
 protected EntityShapeColumnCommand(EntitySymbol shape, string columnText)
     : base()
 {
     this.shape = shape;
     this.columnText = columnText;
 }
 public EditColumnCommand(EntitySymbol shape, int columnIndex, string columnText)
     : base(shape, columnText)
 {
     base.description = string.Format("Edit column '{0}' in {1}", columnText, shape.Type.Name);
     this.oldColumnText = shape.ColumnNames[columnIndex];
     this.columnIndex = columnIndex;
 }