//#region public Methods... public override void Show() { if (this.mode_ == eMode.Update) { #region MyForm. ... = frm_Main.ntierproject. ...; this.MyForm.ApplicationName = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].ApplicationName; this.MyForm.Namespace = frm_Main.ntierproject.Metadata.MetadataExtendedCollection[0].ApplicationNamespace; this.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.Libraries.Metadata.MetadataExtended.XS_dbType[] _dbmetadata_dbs = new OGen.NTier.Libraries.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 this.MyForm.Bind_DBConnections( _dbmetadata_dbs //, frm_Main.ntierproject.Metadata.Default_DBServerType, //frm_Main.ntierproject.Metadata.Default_ConfigMode ); } else { this.MyForm.ApplicationName = string.Empty; this.MyForm.Namespace = string.Empty; this.MyForm.ApplicationPath = string.Empty; this.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.Libraries.Metadata.MetadataExtended.XS_dbType[] UnBind_DBConnections() { OGen.NTier.Libraries.Metadata.MetadataExtended.XS_dbType[] DBConnections_out; ArrayList _dbservertypes; DBServerTypes _dbservertype; int _dbindex; _dbservertypes = new ArrayList(); for (int i = 0; i < this.lvwConnections.Items.Count; i++) { if ( // if Default !string.IsNullOrEmpty(this.lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text) ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), this.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 < this.lvwConnections.Items.Count; i++) { if ( // if !Default string.IsNullOrEmpty(this.lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text) ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); if (!_dbservertypes.Contains(_dbservertype)) _dbservertypes.Add(_dbservertype); } } //--- DBConnections_out = new OGen.NTier.Libraries.Metadata.MetadataExtended.XS_dbType[ _dbservertypes.Count ]; //--- for (int i = 0; i < _dbservertypes.Count; i++) { DBConnections_out[i] = new OGen.NTier.Libraries.Metadata.MetadataExtended.XS_dbType( ((DBServerTypes)_dbservertypes[i]).ToString() ); } for (int i = 0; i < this.lvwConnections.Items.Count; i++) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); _dbindex = _dbservertypes.IndexOf(_dbservertype); DBConnections_out[_dbindex].DBServerType = this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text; // ToDos: here! //DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].generateSQL = true; DBConnections_out[_dbindex].GenerateSQL = true; DBConnections_out[_dbindex].ConnectionString = this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBConnectionstring ].Text; } 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.Libraries.Metadata.MetadataExtended.XS_dbType[] UnBind_DBConnections() { OGen.NTier.Libraries.Metadata.MetadataExtended.XS_dbType[] DBConnections_out; ArrayList _dbservertypes; DBServerTypes _dbservertype; int _dbindex; _dbservertypes = new ArrayList(); for (int i = 0; i < this.lvwConnections.Items.Count; i++) { if ( // if Default !string.IsNullOrEmpty(this.lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text) ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), this.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 < this.lvwConnections.Items.Count; i++) { if ( // if !Default string.IsNullOrEmpty(this.lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text) ) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); if (!_dbservertypes.Contains(_dbservertype)) { _dbservertypes.Add(_dbservertype); } } } //--- DBConnections_out = new OGen.NTier.Libraries.Metadata.MetadataExtended.XS_dbType[ _dbservertypes.Count ]; //--- for (int i = 0; i < _dbservertypes.Count; i++) { DBConnections_out[i] = new OGen.NTier.Libraries.Metadata.MetadataExtended.XS_dbType( ((DBServerTypes)_dbservertypes[i]).ToString() ); } for (int i = 0; i < this.lvwConnections.Items.Count; i++) { _dbservertype = (DBServerTypes)Enum.Parse( typeof(DBServerTypes), this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text ); _dbindex = _dbservertypes.IndexOf(_dbservertype); DBConnections_out[_dbindex].DBServerType = this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBServerType ].Text; // ToDos: here! //DBConnections_out[_dbindex].DBConnections.DBConnectionCollection[_justadded].generateSQL = true; DBConnections_out[_dbindex].GenerateSQL = true; DBConnections_out[_dbindex].ConnectionString = this.lvwConnections.Items[i].SubItems[ (int)eConnectionColumns.DBConnectionstring ].Text; } return(DBConnections_out); }