Skip Navigation Links.

Northwind\WebControls\ComboBoxManagerBase.cs

D:\NorthwindForWeb\Northwind\CS\DotNet\ADO.Net\Northwind\WebControls\ComboBoxManagerBase.cs
/*
 * This file was generated by ProCG version 2.0
 *
 * File name:	Northwind\WebControls\ComboBoxManagerBase.cs
 * Language:	C# - ADO.Net 
 * Database:	My Sql
 *
 * Copyright (c) 2002-2019 iGenXSoft.
 * For more information visit http://www.igenxsoft.com
 */

using System;
using System.Collections;
using System.Web.UI.WebControls; 
using System.Data;
using Northwind.General;
using Northwind.Data;
#if (USE_DATA_MANAGER_REMOTE)
	using Northwind.DataManagementRemote;
#endif // if (USE_DATA_MANAGER_REMOTE)


namespace Northwind.WebControls
{
	/// Summary description for ComboBoxManagerBase.
	public abstract class ComboBoxManagerBase : IDisposable 
	{
		static		protected			ComboBoxManagerBase m_ComboBoxManagerBase = null;
		protected	DataManager			m_DataManager	= null;
		protected	bool				m_bDataManagerWasCreatedByMe = false;
		private		bool				disposed = false; 
		protected	string				m_EmptyOptionText = "";
		protected   bool				m_NeedToAddExtraOption = true;
		
#if (USE_DATA_MANAGER_REMOTE)
		protected	DataManagerRemote	m_DataManagerRemote	= null;
#endif // if (USE_DATA_MANAGER_REMOTE)

		public  ComboBoxManagerBase()
		{
		}


		public ComboBoxManagerBase(DataManager dataManager)
		{
			m_DataManager = dataManager;
			m_bDataManagerWasCreatedByMe = false;
		}


#if (USE_DATA_MANAGER_REMOTE)
		public ComboBoxManagerBase(DataManagerRemote dataManagerRemote)
		{
			m_DataManagerRemote = dataManagerRemote;
		}

#endif // if (USE_DATA_MANAGER_REMOTE)


		// This destructor will run only if the Dispose method 
		// does not get called.
		// It gives your base class the opportunity to finalize.
		~ComboBoxManagerBase()	  
		{
			// Do not re-create Dispose clean-up code here.
			// Calling Dispose(false) is optimal in terms of
			// readability and maintainability.
			Dispose(false);
		}

		public string EmptyOptionText
		{
			get { return m_EmptyOptionText; }
			set { m_EmptyOptionText = value; }
		}
		
		public bool NeedToAddExtraOption
		{
			get { return m_NeedToAddExtraOption; }
			set { m_NeedToAddExtraOption = value; }		
		}
		
		public DataManager DataManager
		{
			get 
			{	
				if (m_DataManager == null) 
				{
					m_DataManager = new DataManager(); 
					m_bDataManagerWasCreatedByMe = true;
				}
				return m_DataManager;
			}
			set 
			{ 
				m_DataManager = value;			
			}	
		}
		
		//
		// Table CCodes
		// AnlRecord.CodeFieldIndex = 2
		public virtual void SetDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, CCodesCollection codesCollection, bool needToAddExtraOption, string extraOptionText = null)
		{
			CCodesCollection tempCodesCollection = codesCollection;
			if (needToAddExtraOption)
			{
				tempCodesCollection = (CCodesCollection)codesCollection.CloneForReadOnly();
				CCodes codes = tempCodesCollection.InsertNewCodes(0);
				if (extraOptionText == null)
					codes.Description = EmptyOptionText;
				else
					codes.Description = extraOptionText;
			}
			dropDownList.DataValueField = "CodeNum";
			dropDownList.DataTextField  = "Description";
			dropDownList.DataSource		= tempCodesCollection;
			try
			{
				if (dropDownList.Visible) // indication that it is inside databind event
					dropDownList.DataBind();
			}
			catch (Exception ex)
			{
				dropDownList.SelectedIndex = -1; 
			}
		}

		// Table CCodes
		// Access Method CodesByTableNum
		
		public virtual void SetCodesByTableNumDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList,short tableNum, bool needToAddExtraOption)
		{
			CCodesCollection collection;
#if (USE_DATA_MANAGER_REMOTE)
			if (m_DataManager != null)
				collection = m_DataManager.CodesRecord.GetCodesByTableNumCollection(tableNum);
			else
				collection = m_DataManagerRemote.GetCodesByTableNumCollection(tableNum);
#else
			collection = DataManager.CodesRecord.GetCodesByTableNumCollection(tableNum);

#endif // if (USE_DATA_MANAGER_REMOTE)

			SetDropDownListInfo(dropDownList,collection,needToAddExtraOption);

		}

		// Table CCodes
		// Access Method CodesTables
		
		public virtual void SetCodesTablesDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, bool needToAddExtraOption)
		{
			CCodesCollection collection;
#if (USE_DATA_MANAGER_REMOTE)
			if (m_DataManager != null)
				collection = m_DataManager.CodesRecord.GetCodesTablesCollection();
			else
				collection = m_DataManagerRemote.GetCodesTablesCollection();
#else
			collection = DataManager.CodesRecord.GetCodesTablesCollection();

#endif // if (USE_DATA_MANAGER_REMOTE)

			SetDropDownListInfo(dropDownList,collection,needToAddExtraOption);

		}

		// Table CCodes
		// Access Method AllCodes
		
		public virtual void SetAllCodesDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, bool needToAddExtraOption)
		{
			CCodesCollection collection;
#if (USE_DATA_MANAGER_REMOTE)
			if (m_DataManager != null)
				collection = m_DataManager.CodesRecord.GetAllCodesCollection();
			else
				collection = m_DataManagerRemote.GetAllCodesCollection();
#else
			collection = DataManager.CodesRecord.GetAllCodesCollection();

#endif // if (USE_DATA_MANAGER_REMOTE)

			SetDropDownListInfo(dropDownList,collection,needToAddExtraOption);

		}
		//
		// Table CCriteriaDefinition
		// AnlRecord.CodeFieldIndex = 1
		public virtual void SetDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, CCriteriaDefinitionCollection criteriaDefinitionCollection, bool needToAddExtraOption, string extraOptionText = null)
		{
			CCriteriaDefinitionCollection tempCriteriaDefinitionCollection = criteriaDefinitionCollection;
			if (needToAddExtraOption)
			{
				tempCriteriaDefinitionCollection = new CCriteriaDefinitionCollection(criteriaDefinitionCollection);
				CCriteriaDefinition criteriaDefinition = tempCriteriaDefinitionCollection.InsertNewCriteriaDefinition(0);
				if (extraOptionText == null)
					criteriaDefinition.Name = EmptyOptionText;
				else
					criteriaDefinition.Name = extraOptionText;
			}
			dropDownList.DataValueField = "Id";
			dropDownList.DataTextField  = "Name";
			dropDownList.DataSource		= tempCriteriaDefinitionCollection;
			try
			{
				if (dropDownList.Visible) // indication that it is inside databind event
					dropDownList.DataBind();
			}
			catch (Exception ex)
			{
				dropDownList.SelectedIndex = -1; 
			}
		}

		// Table CCriteriaDefinition
		// Access Method CriteriaDefinitionsByUserIdRecordNum
		
		public virtual void SetCriteriaDefinitionsByUserIdRecordNumDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList,int userId,int recordNum, bool needToAddExtraOption)
		{
			CCriteriaDefinitionCollection collection;
#if (USE_DATA_MANAGER_REMOTE)
			if (m_DataManager != null)
				collection = m_DataManager.CriteriaDefinitionRecord.GetCriteriaDefinitionsByUserIdRecordNumCollection(userId, recordNum);
			else
				collection = m_DataManagerRemote.GetCriteriaDefinitionsByUserIdRecordNumCollection(userId, recordNum);
#else
			collection = DataManager.CriteriaDefinitionRecord.GetCriteriaDefinitionsByUserIdRecordNumCollection(userId, recordNum);

#endif // if (USE_DATA_MANAGER_REMOTE)

			SetDropDownListInfo(dropDownList,collection,needToAddExtraOption);

		}
		//
		// Table CNorthwindUser
		// AnlRecord.CodeFieldIndex = 1
		public virtual void SetDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, CNorthwindUserCollection northwindUserCollection, bool needToAddExtraOption, string extraOptionText = null)
		{
			CNorthwindUserCollection tempNorthwindUserCollection = northwindUserCollection;
			if (needToAddExtraOption)
			{
				tempNorthwindUserCollection = new CNorthwindUserCollection(northwindUserCollection);
				CNorthwindUser northwindUser = tempNorthwindUserCollection.InsertNewNorthwindUser(0);
				if (extraOptionText == null)
					northwindUser.FullName = EmptyOptionText;
				else
					northwindUser.FullName = extraOptionText;
			}
			dropDownList.DataValueField = "Id";
			dropDownList.DataTextField  = "FullName";
			dropDownList.DataSource		= tempNorthwindUserCollection;
			try
			{
				if (dropDownList.Visible) // indication that it is inside databind event
					dropDownList.DataBind();
			}
			catch (Exception ex)
			{
				dropDownList.SelectedIndex = -1; 
			}
		}

		// Table CNorthwindUser
		// Access Method AllUsers
		
		public virtual void SetAllUsersDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, bool needToAddExtraOption)
		{
			CNorthwindUserCollection collection;
#if (USE_DATA_MANAGER_REMOTE)
			if (m_DataManager != null)
				collection = m_DataManager.NorthwindUserRecord.GetAllUsersCollection();
			else
				collection = m_DataManagerRemote.GetAllUsersCollection();
#else
			collection = DataManager.NorthwindUserRecord.GetAllUsersCollection();

#endif // if (USE_DATA_MANAGER_REMOTE)

			SetDropDownListInfo(dropDownList,collection,needToAddExtraOption);

		}
		//
		// Table CSupplier
		// AnlRecord.CodeFieldIndex = 1
		public virtual void SetDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, CSupplierCollection supplierCollection, bool needToAddExtraOption, string extraOptionText = null)
		{
			CSupplierCollection tempSupplierCollection = supplierCollection;
			if (needToAddExtraOption)
			{
				tempSupplierCollection = new CSupplierCollection(supplierCollection); 
				CSupplier supplier = tempSupplierCollection.InsertNewSupplier(0);
				if (extraOptionText == null)
					supplier.CompanyName = EmptyOptionText;
				else
					supplier.CompanyName = extraOptionText;
			}
			dropDownList.DataValueField = "Id";
			dropDownList.DataTextField  = "CompanyName";
			dropDownList.DataSource		= tempSupplierCollection;
			try
			{
				if (dropDownList.Visible) // indication that it is inside databind event
					dropDownList.DataBind();
			}
			catch (Exception ex)
			{
				dropDownList.SelectedIndex = -1; 
			}
		}

		// Table CSupplier
		// Access Method AllSuppliers
		
		public virtual void SetAllSuppliersDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, bool needToAddExtraOption)
		{
			CSupplierCollection collection;
#if (USE_DATA_MANAGER_REMOTE)
			if (m_DataManager != null)
				collection = m_DataManager.SupplierRecord.GetAllSuppliersCollection();
			else
				collection = m_DataManagerRemote.GetAllSuppliersCollection();
#else
			collection = DataManager.SupplierRecord.GetAllSuppliersCollection();

#endif // if (USE_DATA_MANAGER_REMOTE)

			SetDropDownListInfo(dropDownList,collection,needToAddExtraOption);

		}
		//
		// Table CTestTable
		// AnlRecord.CodeFieldIndex = 1
		public virtual void SetDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList, CTestTableCollection testTableCollection, bool needToAddExtraOption, string extraOptionText = null)
		{
			CTestTableCollection tempTestTableCollection = testTableCollection;
			if (needToAddExtraOption)
			{
				tempTestTableCollection = new CTestTableCollection(testTableCollection);
				CTestTable testTable = tempTestTableCollection.InsertNewTestTable(0);
				if (extraOptionText == null)
					testTable.Name = EmptyOptionText;
				else
					testTable.Name = extraOptionText;
			}
			dropDownList.DataValueField = "Id";
			dropDownList.DataTextField  = "Name";
			dropDownList.DataSource		= tempTestTableCollection;
			try
			{
				if (dropDownList.Visible) // indication that it is inside databind event
					dropDownList.DataBind();
			}
			catch (Exception ex)
			{
				dropDownList.SelectedIndex = -1; 
			}
		}

		public virtual void SetTabControlThemeDropDownListInfo(System.Web.UI.WebControls.DropDownList dropDownList)
		{
			dropDownList.Items.Clear();
			dropDownList.Items.Add(new ListItem("XP", "ajax__tab_xp-theme"));
			dropDownList.Items.Add(new ListItem("IE", "ajax__tab_ie-theme"));
			dropDownList.Items.Add(new ListItem("Yahoo", "ajax__tab_yuitabview-theme"));
			dropDownList.Items.Add(new ListItem("Technorati", "ajax__tab_technorati-theme"));
			dropDownList.Items.Add(new ListItem("MSN", "ajax__tab_msngallery-theme"));
		}
		
		#region IDisposable Members

		// Implement IDisposable.
		// Do not make this method virtual.
		// A derived class should not be able to override this method.
		public void Dispose()
		{
			Dispose(true);
			// This object will be cleaned up by the Dispose method.
			// Therefore, you should call GC.SupressFinalize to
			// take this object off the finalization queue 
			// and prevent finalization code for this object
			// from executing a second time.
			GC.SuppressFinalize(this);
		}

		// Dispose(bool disposing) executes in two distinct scenarios.
		// If disposing equals true, the method has been called directly
		// or indirectly by a user's code. Managed and unmanaged resources
		// can be disposed.
		// If disposing equals false, the method has been called by the 
		// runtime from inside the finalizer and you should not reference 
		// other objects. Only unmanaged resources can be disposed.
		private void Dispose(bool disposing)
		{
			// Check to see if Dispose has already been called.
			if(!this.disposed)
			{
				// If disposing equals true, dispose all managed 
				// and unmanaged resources.
				if(disposing)
				{
					if (m_DataManager != null)
					{
						if (m_bDataManagerWasCreatedByMe)
						{
							m_DataManager.Dispose();
							m_DataManager = null;

						}
					}
					m_ComboBoxManagerBase = null;
				}		 
			}
			disposed = true;		 
		}
		#endregion
	}
}


  //     12899 ProCG uses this line - don't edit it

2020 © iGenXSoft ProCG Generated Codes
pompy wtryskowe|cheap huarache shoes| bombas inyeccion|cheap jordans|cheap air max| cheap sneaker|wholesale jordans|cheap china jordans|cheap wholesale jordans