public TableDesignForm(DatabaseContext dbContext, Database database, Table table = null)
        {
            InitializeComponent();

            this.dbContext = dbContext;
            this.database = database;
            DialogResult = DialogResult.Cancel;
            TableDataGridView.CellValueChanged += new DataGridViewCellEventHandler(CreateTableDataGridView_CellValueChanged);
            TableDataGridView.DataError += CreateTableDataGridView_DataError;

            if (table != null)
            {
                TableNameTextBox.Text = table.Name;
                TableNameTextBox.Enabled = false;
                TableDataGridView.Rows.Add(table.Columns.Count);

                int index = 0;
                foreach (var column in table.Columns)
                {
                    TableDataGridView.Rows[index].Cells[0].Value = column.Name;
                    TableDataGridView.Rows[index].Cells[1].Value = DataTypeConverter.ToComboType(column.Type);
                    TableDataGridView.Rows[index].Cells[2].Value = column.Size;

                    if (table.PrimaryKey.Contains(column.Name))
                    {
                        TableDataGridView.Rows[index].Cells[3].Value = true;
                    }
                    else
                    {
                        TableDataGridView.Rows[index].Cells[3].Value = false;
                    }

                    if (column.Unique)
                    {
                        TableDataGridView.Rows[index].Cells[4].Value = true;
                    }
                    else
                    {
                        TableDataGridView.Rows[index].Cells[4].Value = false;
                    }

                    if (column.Nullable)
                    {
                        TableDataGridView.Rows[index].Cells[5].Value = true;
                    }
                    else
                    {
                        TableDataGridView.Rows[index].Cells[5].Value = false;
                    }

                    index++;
                }
            }
            else
            {
                relationshipsButton.Enabled = false;
            }
        }
Example #2
0
 public InsertForm(DatabaseContext dbContext, Database database, Table tableSchema)
 {
     InitializeComponent();
     this.dbContext = dbContext;
     this.database = database;
     this.tableSchema = tableSchema;
     BuildUpTheForm();
     this.DialogResult = DialogResult.Cancel;
 }
Example #3
0
        public NewIndexForm(DatabaseContext dbContext, Database database, Table tableSchema)
        {
            InitializeComponent();
            this.dbContext = dbContext;
            this.database = database;
            this.tableSchema = tableSchema;
            ((DataGridViewComboBoxColumn)IndexDataGridView.Columns["Column"]).Items.AddRange(tableSchema.Columns.Select(c => c.Name).ToArray());

            this.DialogResult = DialogResult.Cancel;
        }
Example #4
0
        public MainForm()
        {
            InitializeComponent();

            dbContext = new DatabaseContext();

            BuildDatabaseTree();

            selectDataGridView.CellValueChanged += new DataGridViewCellEventHandler(selectDataGridView_CellValueChanged);
            filterDataGridView.CellValueChanged += new DataGridViewCellEventHandler(filterDataGridView_CellValueChanged);
            joinDataGridView.CellValueChanged += new DataGridViewCellEventHandler(joinDataGridView_CellValueChanged);
            queryDesignerTabControl.Visible = false;

            selection = SelectedOperation.Unknown;
        }
        public RelationshipsForm(DatabaseContext dbContext, Database database, string tableName)
        {
            InitializeComponent();

            this.dbContext = dbContext;
            this.tableName = tableName;
            this.database = database;

            removeButton.Enabled = false;

            tableNames = new List<string>();
            foreach (var table in database.Tables)
            {
                tableNames.Add(table.Name);
            }

            parentComboBox.Items.AddRange(tableNames.ToArray());
            childComboBox.Items.AddRange(tableNames.ToArray());

            relationshipsListBox.Items.AddRange(database.GetAssociationsWhereTableIsParent(tableName).Select(a => a.Name).ToArray());
            relationshipsListBox.Items.AddRange(database.GetAssociationsWhereTableIsChild(tableName).Select(a => a.Name).ToArray());
        }
 public NewDatabaseForm(DatabaseContext dbContext)
 {
     InitializeComponent();
     this.DialogResult = DialogResult.Ignore;
     this.dbContext = dbContext;
 }