//#region public Methods... public override void Show() { if (mode_ == eMode.Update) { #region MyForm. ... = frm_Main.ntierproject. ...; MyForm.ApplicationName = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].ApplicationName; MyForm.Namespace = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].ApplicationNamespace; MyForm.ApplicationPath = System.IO.Path.GetDirectoryName( frm_Main.ntierproject.Filename ); #endregion #region XS_dbType[] _dbmetadata_dbs = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection; OGen.NTier.lib.metadata.metadataExtended.XS_dbType[] _dbmetadata_dbs = new OGen.NTier.lib.metadata.metadataExtended.XS_dbType[ frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection.Count ]; for (int d = 0; d < frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection.Count; d++) { _dbmetadata_dbs[d] = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection[d]; } #endregion MyForm.Bind_DBConnections( _dbmetadata_dbs //, frm_Main.ntierproject.Metadata.Default_DBServerType, //frm_Main.ntierproject.Metadata.Default_ConfigMode ); } else { MyForm.ApplicationName = string.Empty; MyForm.Namespace = string.Empty; MyForm.ApplicationPath = string.Empty; MyForm.Bind_DBConnections(); } base.Show(); }
//#endregion #region private Methods... #endregion //#region public Methods... #region public cDBMetadata_DB[] DBConnections(); /// <summary> /// first item in the array, represents default db connection /// </summary> /// <returns></returns> public OGen.NTier.lib.metadata.metadataExtended.XS_dbType[] UnBind_DBConnections() { OGen.NTier.lib.metadata.metadataExtended.XS_dbType[] DBConnections_out; ArrayList _dbservertypes; DBServerTypes _dbservertype; int _dbindex; int _justadded = -1; _dbservertypes = new ArrayList(); for (int i = 0; i < lvwConnections.Items.Count; i++) { if ( // if Default lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text != string.Empty ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); //if (!_dbservertypes.Contains(_dbservertype)) // no need to check! _dbservertypes.Add(_dbservertype); break; // default was found } } for (int i = 0; i < lvwConnections.Items.Count; i++) { if ( // if !Default lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text == string.Empty ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); if (!_dbservertypes.Contains(_dbservertype)) _dbservertypes.Add(_dbservertype); } } //--- DBConnections_out = new OGen.NTier.lib.metadata.metadataExtended.XS_dbType[ _dbservertypes.Count ]; //--- for (int i = 0; i < _dbservertypes.Count; i++) { DBConnections_out[i] = new OGen.NTier.lib.metadata.metadataExtended.XS_dbType( ((DBServerTypes)_dbservertypes[i]).ToString() ); } for (int i = 0; i < lvwConnections.Items.Count; i++) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); _dbindex = _dbservertypes.IndexOf(_dbservertype); DBConnections_out[_dbindex].DBConnections.DBConnectionCollection.Add( out _justadded, true, new OGen.NTier.lib.metadata.metadataExtended.XS_dbConnectionType( lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBMode ].Text ) ); // ToDos: here! DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].generateSQL = true; DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].Connectionstring = lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBConnectionstring ].Text; DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].isDefault = ( lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text != string.Empty ); } return DBConnections_out; }
//#endregion #region private Methods... #endregion //#region public Methods... #region public cDBMetadata_DB[] DBConnections(); /// <summary> /// first item in the array, represents default db connection /// </summary> /// <returns></returns> public OGen.NTier.lib.metadata.metadataExtended.XS_dbType[] UnBind_DBConnections() { OGen.NTier.lib.metadata.metadataExtended.XS_dbType[] DBConnections_out; ArrayList _dbservertypes; DBServerTypes _dbservertype; int _dbindex; int _justadded = -1; _dbservertypes = new ArrayList(); for (int i = 0; i < lvwConnections.Items.Count; i++) { if ( // if Default lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text != string.Empty ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); //if (!_dbservertypes.Contains(_dbservertype)) // no need to check! _dbservertypes.Add(_dbservertype); break; // default was found } } for (int i = 0; i < lvwConnections.Items.Count; i++) { if ( // if !Default lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text == string.Empty ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); if (!_dbservertypes.Contains(_dbservertype)) { _dbservertypes.Add(_dbservertype); } } } //--- DBConnections_out = new OGen.NTier.lib.metadata.metadataExtended.XS_dbType[ _dbservertypes.Count ]; //--- for (int i = 0; i < _dbservertypes.Count; i++) { DBConnections_out[i] = new OGen.NTier.lib.metadata.metadataExtended.XS_dbType( ((DBServerTypes)_dbservertypes[i]).ToString() ); } for (int i = 0; i < lvwConnections.Items.Count; i++) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); _dbindex = _dbservertypes.IndexOf(_dbservertype); DBConnections_out[_dbindex].DBConnections.DBConnectionCollection.Add( out _justadded, true, new OGen.NTier.lib.metadata.metadataExtended.XS_dbConnectionType( lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBMode ].Text ) ); // ToDos: here! DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].generateSQL = true; DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].Connectionstring = lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBConnectionstring ].Text; DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].isDefault = ( lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text != string.Empty ); } return(DBConnections_out); }
//#region public Methods... public override void Show() { if (mode_ == eMode.Update) { #region MyForm. ... = frm_Main.ntierproject. ...; MyForm.ApplicationName = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].ApplicationName; MyForm.Namespace = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].ApplicationNamespace; MyForm.ApplicationPath = System.IO.Path.GetDirectoryName( frm_Main.ntierproject.Filename ); #endregion #region XS_dbType[] _dbmetadata_dbs = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection; OGen.NTier.lib.metadata.metadataExtended.XS_dbType[] _dbmetadata_dbs = new OGen.NTier.lib.metadata.metadataExtended.XS_dbType[ frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection.Count ]; for (int d = 0; d < frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection.Count; d++) { _dbmetadata_dbs[d] = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].DBs.DBCollection[d]; } #endregion MyForm.Bind_DBConnections( _dbmetadata_dbs //, frm_Main.ntierproject.Metadata.Default_DBServerType, //frm_Main.ntierproject.Metadata.Default_ConfigMode ); } else { MyForm.ApplicationName = string.Empty; MyForm.Namespace = string.Empty; MyForm.ApplicationPath = string.Empty; MyForm.Bind_DBConnections(); } base.Show(); }