コード例 #1
0
        //#region public Methods...
        public override void Show()
        {
            if (mode_ == eMode.Update)
            {
                #region MyForm. ... = frm_Main.ntierproject. ...;
                MyForm.ApplicationName
                    = frm_Main.ntierproject.Metadata.ApplicationName;
                MyForm.Namespace
                    = frm_Main.ntierproject.Metadata.Namespace;
                MyForm.ApplicationPath
                    = System.IO.Path.GetDirectoryName(
                          frm_Main.ntierproject.Filename
                          );
                #endregion
                #region cDBMetadata_DB[] _dbmetadata_dbs = frm_Main.ntierproject.Metadata.DBs;
                OGen.NTier.lib.metadata.cDBMetadata_DB[] _dbmetadata_dbs
                    = new OGen.NTier.lib.metadata.cDBMetadata_DB[
                          frm_Main.ntierproject.Metadata.DBs.Count
                      ];
                for (int d = 0; d < frm_Main.ntierproject.Metadata.DBs.Count; d++)
                {
                    _dbmetadata_dbs[d] = frm_Main.ntierproject.Metadata.DBs[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.cDBMetadata_DB[] UnBind_DBConnections() {
			OGen.NTier.lib.metadata.cDBMetadata_DB[] DBConnections_out;
			ArrayList _dbservertypes;
			DBServerTypes _dbservertype;
			int _dbindex;
			int _justadded;

			_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.cDBMetadata_DB[
					_dbservertypes.Count
				];
			//---
			for (int i = 0; i < _dbservertypes.Count; i++) {
				DBConnections_out[i] = new OGen.NTier.lib.metadata.cDBMetadata_DB(
// ToDos: here! check this...
null, 
					(DBServerTypes)_dbservertypes[i]
				);
			}


			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);
				_justadded = DBConnections_out[_dbindex].Connections.Add(
true, // ToDos: here!
					lvwConnections.Items[i].SubItems[
						(int)eConnectionColumns.DBMode
					].Text, 
					true
				);
				DBConnections_out[_dbindex].Connections[_justadded].Connectionstring
					= lvwConnections.Items[i].SubItems[
						(int)eConnectionColumns.DBConnectionstring
					].Text;

				DBConnections_out[_dbindex].Connections[_justadded].isDefault = (
					lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text
					!=
					string.Empty
				);
			}

			return DBConnections_out;
		}
コード例 #3
0
		//#region public Methods...
		public override void Show() {
			if (mode_ == eMode.Update) {
				#region MyForm. ... = frm_Main.ntierproject. ...;
				MyForm.ApplicationName 
					= frm_Main.ntierproject.Metadata.ApplicationName;
				MyForm.Namespace 
					= frm_Main.ntierproject.Metadata.Namespace;
				MyForm.ApplicationPath 
					= System.IO.Path.GetDirectoryName(
						frm_Main.ntierproject.Filename
					);
				#endregion
				#region cDBMetadata_DB[] _dbmetadata_dbs = frm_Main.ntierproject.Metadata.DBs;
				OGen.NTier.lib.metadata.cDBMetadata_DB[] _dbmetadata_dbs 
					= new OGen.NTier.lib.metadata.cDBMetadata_DB[
						frm_Main.ntierproject.Metadata.DBs.Count
					];
				for (int d = 0; d < frm_Main.ntierproject.Metadata.DBs.Count; d++) {
					_dbmetadata_dbs[d] = frm_Main.ntierproject.Metadata.DBs[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();
		}
コード例 #4
0
        //#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.cDBMetadata_DB[] UnBind_DBConnections()
        {
            OGen.NTier.lib.metadata.cDBMetadata_DB[] DBConnections_out;
            ArrayList     _dbservertypes;
            DBServerTypes _dbservertype;
            int           _dbindex;
            int           _justadded;

            _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.cDBMetadata_DB[
                      _dbservertypes.Count
                  ];
            //---
            for (int i = 0; i < _dbservertypes.Count; i++)
            {
                DBConnections_out[i] = new OGen.NTier.lib.metadata.cDBMetadata_DB(
// ToDos: here! check this...
                    null,
                    (DBServerTypes)_dbservertypes[i]
                    );
            }


            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);
                _justadded = DBConnections_out[_dbindex].Connections.Add(
                    true, // ToDos: here!
                    lvwConnections.Items[i].SubItems[
                        (int)eConnectionColumns.DBMode
                    ].Text,
                    true
                    );
                DBConnections_out[_dbindex].Connections[_justadded].Connectionstring
                    = lvwConnections.Items[i].SubItems[
                          (int)eConnectionColumns.DBConnectionstring
                      ].Text;

                DBConnections_out[_dbindex].Connections[_justadded].isDefault = (
                    lvwConnections.Items[i].SubItems[(int)eConnectionColumns.Default].Text
                    !=
                    string.Empty
                    );
            }

            return(DBConnections_out);
        }