private void AddMapGridRow(DataGridView grid, DatabaseTypeMap map)
        {
            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells.Add(new DataGridViewComboBoxExCell());
            row.Cells[0].Value = map.TypeName;
            row.Cells[1].Value = GetDisplayText(map.DotNetType);
            row.Tag            = map;
            grid.Rows.Add(row);
        }
Example #2
0
        private void mapGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            if (BusyPopulating)
            {
                return;
            }

            DataGridView           grid = (DataGridView)sender;
            List <DatabaseTypeMap> collection;

            if (grid == dataGridViewSqlServer)
            {
                collection = Utility.SqlServerTypes;
            }
            else if (grid == dataGridViewOracle)
            {
                collection = Utility.OracleTypes;
            }
            else if (grid == dataGridViewMySQL)
            {
                collection = Utility.MySqlTypes;
            }
            else if (grid == dataGridViewPostgreSQL)
            {
                collection = Utility.PostgreSqlTypes;
            }
            else if (grid == dataGridViewFirebird)
            {
                collection = Utility.FirebirdTypes;
            }
            else if (grid == dataGridViewSQLite)
            {
                collection = Utility.SQLiteTypes;
            }
            else
            {
                throw new NotImplementedException("Grid not expected: " + grid.Name);
            }

            for (int i = 0; i < e.RowCount; i++)
            {
                DataGridViewRow row       = grid.Rows[e.RowIndex + i - 1];
                DatabaseTypeMap dbMapType = new DatabaseTypeMap("", null);
                collection.Add(dbMapType);
                row.Tag = dbMapType;
            }
        }
        private void dataGridViewSqlServer_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            if (BusyPopulating)
            {
                return;
            }

            DataGridView grid = (DataGridView)sender;

            for (int i = 0; i < e.RowCount; i++)
            {
                DataGridViewRow row       = grid.Rows[e.RowIndex + i - 1];
                DatabaseTypeMap dbMapType = new DatabaseTypeMap("", null);
                Maps.Add(dbMapType);
                row.Tag = dbMapType;
            }
        }
        private void dataGridViewSqlServer_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (BusyPopulating || e.RowIndex < 0)
            {
                return;
            }

            DataGridView grid = (DataGridView)sender;

            DataGridViewRow  row       = grid.Rows[e.RowIndex];
            DataGridViewCell cell      = row.Cells[e.ColumnIndex];
            DatabaseTypeMap  dbMapType = (DatabaseTypeMap)row.Tag;

            switch (e.ColumnIndex)
            {
            case 0:
                dbMapType.TypeName = (string)cell.Value;
                break;

            case 1:
                string name = (string)cell.Value;

                if (!string.IsNullOrWhiteSpace(name))
                {
                    //if (TypeDisplayStyle == TypeDisplayStyles.CSharp)
                    //    name = Utility.DotNetTypes.SingleOrDefault(u => u.CSharpName == name).Name;
                    //else if (TypeDisplayStyle == TypeDisplayStyles.VB)
                    //    name = Utility.DotNetTypes.SingleOrDefault(u => u.VbName == name).Name;

                    dbMapType.DotNetType = Utility.DotNetTypes.SingleOrDefault(u => u.Name == name);
                }
                break;

            default:
                throw new NotImplementedException("Column index is unexpected: " + e.ColumnIndex.ToString());
            }
        }
Example #5
0
        private void mapGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            if (BusyPopulating)
                return;

            DataGridView grid = (DataGridView)sender;
            List<DatabaseTypeMap> collection;

            if (grid == dataGridViewSqlServer)
                collection = Utility.SqlServerTypes;
            else if (grid == dataGridViewOracle)
                collection = Utility.OracleTypes;
            else if (grid == dataGridViewMySQL)
                collection = Utility.MySqlTypes;
            else if (grid == dataGridViewPostgreSQL)
                collection = Utility.PostgreSqlTypes;
            else if (grid == dataGridViewFirebird)
                collection = Utility.FirebirdTypes;
            else if (grid == dataGridViewSQLite)
                collection = Utility.SQLiteTypes;
            else
                throw new NotImplementedException("Grid not expected: " + grid.Name);

            for (int i = 0; i < e.RowCount; i++)
            {
                DataGridViewRow row = grid.Rows[e.RowIndex + i - 1];
                DatabaseTypeMap dbMapType = new DatabaseTypeMap("", null);
                collection.Add(dbMapType);
                row.Tag = dbMapType;
            }
        }
Example #6
0
        private void dataGridViewSqlServer_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
        {
            if (BusyPopulating)
                return;

            DataGridView grid = (DataGridView)sender;

            for (int i = 0; i < e.RowCount; i++)
            {
                DataGridViewRow row = grid.Rows[e.RowIndex + i - 1];
                DatabaseTypeMap dbMapType = new DatabaseTypeMap("", null);
                Maps.Add(dbMapType);
                row.Tag = dbMapType;
            }
        }
Example #7
0
 private void AddMapGridRow(DataGridView grid, DatabaseTypeMap map)
 {
     DataGridViewRow row = new DataGridViewRow();
     row.Cells.Add(new DataGridViewTextBoxCell());
     row.Cells.Add(new DataGridViewComboBoxExCell());
     row.Cells[0].Value = map.TypeName;
     row.Cells[1].Value = GetDisplayText(map.DotNetType);
     row.Tag = map;
     grid.Rows.Add(row);
 }
Example #8
0
        private static bool CreateMapNode(XmlDocument doc, XmlNode sqlServerMapsNode, bool changesExist, DatabaseTypeMap dbType)
        {
            if (SaveUnmodified || dbType.IsModified)
            {
                changesExist = true;
                string dotnetTypeName = dbType.DotNetType == null ? "" : dbType.DotNetType.Name;

                XmlNode mapNode = doc.CreateElement("map");
                AddAttribute(doc, mapNode, "type", dbType.TypeName);
                AddAttribute(doc, mapNode, "dotnet", dotnetTypeName);
                sqlServerMapsNode.AppendChild(mapNode);
            }
            return changesExist;
        }