Ejemplo n.º 1
0
        private void tsmiInsertColumn_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = DataGridViewHelper.GetSelectedRow(this.dgvColumns);

            if (row != null)
            {
                this.dgvColumns.Rows.Insert(row.Index - 1 < 0 ? 0 : row.Index - 1);
            }
        }
Ejemplo n.º 2
0
        private void DeleteRow()
        {
            DataGridViewRow row = DataGridViewHelper.GetSelectedRow(this.dgvColumns);

            if (row != null && !row.IsNewRow)
            {
                this.dgvColumns.Rows.RemoveAt(row.Index);
            }
        }
Ejemplo n.º 3
0
        private void dgvColumns_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                DataGridViewRow row = DataGridViewHelper.GetSelectedRow(this.dgvColumns);

                bool isNewRow = row != null && row.IsNewRow;

                this.tsmiDeleteColumn.Enabled = !isNewRow;

                this.contextMenuStrip1.Show(this.dgvColumns, e.Location);
            }
        }
        private void ShowIndexExtraPropertites()
        {
            var row = DataGridViewHelper.GetSelectedRow(this.dgvIndexes);

            if (row != null)
            {
                string indexName = DataGridViewHelper.GetCellStringValue(row, this.colIndexName.Name);

                if (string.IsNullOrEmpty(indexName))
                {
                    return;
                }

                TableIndexDesignerInfo index = row.Tag as TableIndexDesignerInfo;

                if (index == null)
                {
                    index   = new TableIndexDesignerInfo();
                    row.Tag = index;
                }

                TableIndexExtraPropertyInfo extralProperty = index?.ExtraPropertyInfo;

                DataGridViewCell typeCell = row.Cells[this.colType.Name];

                if (extralProperty == null)
                {
                    extralProperty          = new TableIndexExtraPropertyInfo();
                    index.ExtraPropertyInfo = extralProperty;

                    if (DataGridViewHelper.GetCellStringValue(typeCell) != IndexType.Primary.ToString())
                    {
                        index.ExtraPropertyInfo.Clustered = false;
                    }
                }

                if (this.DatabaseType == DatabaseType.Oracle)
                {
                    this.indexPropertites.HiddenProperties = new string[] { nameof(extralProperty.Clustered) };
                }
                else
                {
                    this.indexPropertites.HiddenProperties = null;
                }

                this.indexPropertites.SelectedObject = extralProperty;
                this.indexPropertites.Refresh();
            }
        }
        private void dgvConstraints_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                DataGridViewRow row = DataGridViewHelper.GetSelectedRow(this.dgvConstraints);

                if (row != null)
                {
                    bool isEmptyNewRow = row.IsNewRow && DataGridViewHelper.IsEmptyRow(row);

                    this.tsmiDeleteConstraint.Enabled = !isEmptyNewRow;
                }
                else
                {
                    this.tsmiDeleteConstraint.Enabled = false;
                }

                this.contextMenuStrip1.Show(this.dgvConstraints, e.Location);
            }
        }
Ejemplo n.º 6
0
        private void ShowColumnExtraPropertites()
        {
            var row = DataGridViewHelper.GetSelectedRow(this.dgvColumns);

            if (row != null)
            {
                TableColumnDesingerInfo column = row.Tag as TableColumnDesingerInfo;

                if (column == null)
                {
                    column  = new TableColumnDesingerInfo();
                    row.Tag = column;
                }

                TableColumnExtraPropertyInfo extralProperty = column?.ExtraPropertyInfo;

                if (extralProperty == null)
                {
                    extralProperty           = new TableColumnExtraPropertyInfo();
                    column.ExtraPropertyInfo = extralProperty;
                }

                DataGridViewCell identityCell = row.Cells[this.colIdentity.Name];

                if (!DataGridViewHelper.IsTrueValue(identityCell.Value))
                {
                    this.columnPropertites.HiddenProperties = new string[] { nameof(extralProperty.Seed), nameof(extralProperty.Increment) };
                }
                else
                {
                    this.columnPropertites.HiddenProperties = null;
                }

                this.columnPropertites.SelectedObject = extralProperty;
                this.columnPropertites.Refresh();
            }
        }
        private void dgvIndexes_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                DataGridViewRow row = DataGridViewHelper.GetSelectedRow(this.dgvIndexes);

                if (row != null)
                {
                    bool isEmptyNewRow = row.IsNewRow && DataGridViewHelper.IsEmptyRow(row);

                    string type = DataGridViewHelper.GetCellStringValue(row, this.colType.Name);

                    bool?isPrimary = (row.Tag as TableIndexDesignerInfo)?.IsPrimary;

                    this.tsmiDeleteIndex.Enabled = !isEmptyNewRow && !(isPrimary == true) && !(!string.IsNullOrEmpty(type) && type == IndexType.Primary.ToString());
                }
                else
                {
                    this.tsmiDeleteIndex.Enabled = false;
                }

                this.contextMenuStrip1.Show(this.dgvIndexes, e.Location);
            }
        }