Skip Navigation Links.

Northwind\WebControls\ParamsWCCBase.cs

D:\Temp3\TestProjects\CSADO.Net\Northwind\WebControls\ParamsWCCBase.cs
/*
 * This file was generated by ProCG version 2.0
 *
 * File name:	Northwind\WebControls\ParamsWCCBase.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.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using Northwind.General;
using Northwind.Data;

namespace Northwind.WebControls
{
	/// <summary>
	/// Summary description for NorthwindParamsWCCBase.
	/// </summary>
	public class NorthwindParamsWCCBase : Northwind.WebControls.NorthwindWCC
	{

		protected System.Drawing.Point m_Location;
		protected System.Drawing.Size m_Size;
		protected int m_MaxX = 0;
		protected int m_ClientTop = 20, m_ClientLeft = 20;
		protected bool m_bInsideBeginInit;
		protected bool m_bShowDebugMessages;
		protected System.Web.UI.WebControls.Button m_OKButton;
		protected System.Web.UI.WebControls.Button m_NewButton;
		protected System.Web.UI.WebControls.Button m_CancelButton;

		protected bool m_ShowAccessMethodsComboBox = true;
		protected bool m_ShowLabels = true;
		protected bool m_ShowButtons = false;
		protected bool m_ShowNewButton = false;
		protected bool m_ShowNoParamsText = true;

		protected ArrayList m_AllowedAccessMethods;
		protected int m_AccessMethod;

		protected Northwind.General.AccessMethodTypeEnum m_AccessMethodType = AccessMethodTypeEnum.SELECT_ONE_OR_MORE_RECORDS;
		protected Hashtable m_FieldsShowMode;
		protected System.Web.UI.WebControls.Label m_LabelAccessMethod;
		protected System.Web.UI.WebControls.DropDownList m_DropDownAccessMethod;
		protected int m_CurrentAccessMethod;


		public NorthwindParamsWCCBase()
		{
		}

		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		public bool DesignModeInConstructor
		{
			get
			{
				bool bDesignModeInConstructor;
				if (System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
				{
					//MessageBox.Show("NorthwindParamsControl in DesignMode at Constructor");
					bDesignModeInConstructor = true;
				}
				else
				{

					//MessageBox.Show("NorthwindParamsControl NOT in DesignMode at Constructor");

					bDesignModeInConstructor = false;
				}
				return (bDesignModeInConstructor);
			}
		}


		public bool ShowLabels
		{
			get { return m_ShowLabels; }
			set
			{
				m_ShowLabels = value;
			}
		}

		public bool ShowButtons
		{
			get { return m_ShowButtons; }
			set { m_ShowButtons = value; }
		}

		public bool ShowNewButton
		{
			get { return m_ShowNewButton; }
			set { m_ShowNewButton = value; }
		}

		public bool ShowNoParamsText
		{
			get { return m_ShowNoParamsText; }
			set { m_ShowNoParamsText = value; }
		}

		public bool ShowDebugMessages
		{
			get { return m_bShowDebugMessages; }
			set
			{
				m_bShowDebugMessages = value;
			}
		}


		public virtual void RecreateChildControls()
		{
			if (!m_bInsideBeginInit) // was && this.ControlStyleCreated )
				//_controlState == ControlState.ViewStateLoaded)
				CreateChildControls();
			//SetAccessMethod(m_AccessMethod);
		}

		public virtual void SetAccessMethod(int accessMethod)
		{
			throw new NotImplementedException("SetAccessMethod(int accessMethod) in NorthwindParamsControlBase");
		}

		public bool ShowAccessMethodsComboBox
		{
			get { return m_ShowAccessMethodsComboBox; }
			set
			{
				m_ShowAccessMethodsComboBox = value;
			}
		}

		public Northwind.General.AccessMethodTypeEnum AccessMethodType
		{
			get { return m_AccessMethodType; }
			set
			{
				m_AccessMethodType = value;
			}
		}

		public virtual void BeginInit()
		{
			m_bInsideBeginInit = true;
		}

		public virtual void EndInit()
		{
			m_bInsideBeginInit = false;
		}

		[Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
		public virtual Hashtable FieldsShowMode
		{
			get
			{

				return (m_FieldsShowMode);
			}
			set
			{
				m_FieldsShowMode = value;

			}
		}


		protected virtual void SetShowFieldMode(string paramName, FieldShowModeEnum fieldShowMode)
		{
			bool bChanged = false;
			if ((FieldShowModeEnum)m_FieldsShowMode[paramName] != fieldShowMode)
				bChanged = true;
			FieldsShowMode[paramName] = fieldShowMode;
			//if (bChanged && m_DesignMode)
			//  if (bChanged)
			//		RecreateChildControls();
		}



		public virtual System.Web.UI.WebControls.WebControl CreateAccessMethodDropDownAsTR(System.Web.UI.Control tableControl, CCodesCollection accessMethodCollection)
		{
			TableRow tableRow;
			TableCell labelCell, controlCell;
			System.Web.UI.WebControls.WebControl createdControl;

			tableRow = new TableRow();
			tableRow.ID = "AccessMethodRow";
			tableControl.Controls.Add(tableRow);

			// Label
			labelCell = new TableCell();
			tableRow.Controls.Add(labelCell);
			labelCell.CssClass = "label";
			this.CreateAccessMethodLabelControl(labelCell);

			// Control
			controlCell = new TableCell();
			tableRow.Controls.Add(controlCell);
			createdControl = this.CreateAccessMethodControl(controlCell, accessMethodCollection);

			return (createdControl);
		}

		public virtual System.Web.UI.WebControls.WebControl CreateAccessMethodLabelControl(System.Web.UI.Control containerControl)
		{

			// 
			// m_LabelAccessMethod
			// 
			m_LabelAccessMethod = new System.Web.UI.WebControls.Label();
			m_LabelAccessMethod.ID = "labelAccessMethod";
			m_LabelAccessMethod.Text = "Search by";
			m_LabelAccessMethod.Width = 80;
			m_LabelAccessMethod.CssClass = "formlabel";
			containerControl.Controls.Add(m_LabelAccessMethod);

			return (m_LabelAccessMethod);
		}

		public virtual System.Web.UI.WebControls.WebControl CreateAccessMethodControl(System.Web.UI.Control containerControl, CCodesCollection accessMethodCollection)
		{
			// 

			// m_DropDownListDefaultFontSize
			// 

			m_DropDownAccessMethod = NorthwindWebEnv.CreateDropDownList();
			m_DropDownAccessMethod.ID = "AccessMethod";

			m_DropDownAccessMethod.CssClass = "DropDownListCss";

			/*
			if (fieldShowMode == FieldShowModeEnum.SHOW_READ_ONLY)
			{
				m_DropDownListDefaultFontSize.Enabled = false;
			}
			*/
			if (!m_DesignMode)
			{
				WebEnv.SetDropDownListInfoFromCodesTable(m_DropDownAccessMethod, accessMethodCollection, true); // true = value requied
				m_DropDownAccessMethod.AutoPostBack = true;
				m_DropDownAccessMethod.SelectedIndexChanged += new EventHandler(DropDownAccessMethod_SelectedIndexChanged);
			}
			containerControl.Controls.Add(m_DropDownAccessMethod);
			return (m_DropDownAccessMethod);
		}

		// vv delete this function when you don't need it
		public virtual void CreateOKCancelButtonsTR(System.Web.UI.Control tableControl)
		{
			CreateButtonsAsTR(tableControl);
		}
		public virtual void CreateButtonsAsTR(System.Web.UI.Control tableControl)
		{
			TableRow tableRow;
			TableCell labelCell, controlCell;
			System.Web.UI.WebControls.WebControl createdControl;

			tableRow = new TableRow();
			tableRow.ID = "ButtonsRow";
			tableControl.Controls.Add(tableRow);

			// Label
			labelCell = new TableCell();
			tableRow.Controls.Add(labelCell);
			labelCell.CssClass = "label"; // empty cell

			// Control
			controlCell = new TableCell();
			tableRow.Controls.Add(controlCell);
			CreateButtonsControls(controlCell);

		}

		public virtual void CreateButtonsAsTD(System.Web.UI.Control tableRow)
		{
			TableCell labelCell, controlCell;
			System.Web.UI.WebControls.WebControl createdControl;

			// Control
			controlCell = new TableCell();
			tableRow.Controls.Add(controlCell);
			CreateButtonsControls(controlCell);
		}

		public virtual System.Web.UI.WebControls.WebControl CreateButtonsControls(System.Web.UI.Control containerControl)
		{
			CreateSearchButton(containerControl);
			if (ShowNewButton)
				CreateNewButton(containerControl);

			return (m_OKButton);
		}

		private void CreateSearchButton(Control containerControl)
		{
			m_OKButton = new System.Web.UI.WebControls.Button();
			m_OKButton.ID = "OK";
			m_OKButton.Text = "Search";

			m_OKButton.CssClass = "ButtonCss";
			if (!m_DesignMode)
			{
				m_OKButton.Click += new EventHandler(OKButton_Click);
			}
			containerControl.Controls.Add(m_OKButton);
		}

		private void CreateNewButton(Control containerControl)
		{
			m_NewButton = new System.Web.UI.WebControls.Button();
			m_NewButton.ID = "New";
			m_NewButton.Text = "New";

			m_NewButton.CssClass = "ButtonCss";
			if (!m_DesignMode)
			{
				m_NewButton.Click += new EventHandler(NewButton_Click);
			}
			containerControl.Controls.Add(m_NewButton);
		}

		public virtual void CheckInDesignMode(string property)
		{
			//if (!m_DesignMode)
			//	MessageBox.Show("Property "+property+ " Is Design Proprty, You are not allowed to change this property at run time");
		}

		/// <summary> 
		/// Render this control to the output parameter specified.
		/// </summary>
		/// <param name="output"> The HTML writer to write out to </param>
		protected override void Render(HtmlTextWriter output)
		{
			base.Render(output);
		}

		[Browsable(false)]
		public int CurrentAccessMethod
		{
			get
			{
				if (m_DropDownAccessMethod != null)
				{
					m_CurrentAccessMethod = Convert.ToInt32(m_DropDownAccessMethod.SelectedValue);
					return (m_CurrentAccessMethod);
				}
				else
					return (0);
			}
			set
			{
				if (m_DropDownAccessMethod != null)
				{
					int selectedValue;
					if (m_DropDownAccessMethod.SelectedValue != null)
						selectedValue = Convert.ToInt32(m_DropDownAccessMethod.SelectedValue);
					else
						selectedValue = 0;

					if (selectedValue != value)
					{
						if (m_DropDownAccessMethod != null)
						{
							m_DropDownAccessMethod.SelectedValue = value.ToString();
							//MessageBox.Show("Selected value "+value.ToString());
						}
					}
				}
			}
		}

		// Access Method Drop Down List
		[Browsable(false)]
		public System.Web.UI.WebControls.DropDownList AccessMethodDropDownList
		{
			get { return m_DropDownAccessMethod; }
		}

		protected void DropDownAccessMethod_SelectedIndexChanged(object sender, EventArgs e)
		{
			OnDropDownAccessMethodSelectedIndexChanged(sender, e);

		}



		public virtual void OnDropDownAccessMethodSelectedIndexChanged(object sender, EventArgs e)
		{

			this.SetAccessMethod(Convert.ToInt32(AccessMethodDropDownList.SelectedValue));
		}



		// OK Button

		[Browsable(false)]
		public System.Web.UI.WebControls.Button OKButton
		{
			get
			{
				if (m_OKButton != null)
					return m_OKButton;
				m_OKButton = (Button)FindControl("OK");
				return m_OKButton;
			}
		}

		protected void OKButton_Click(object sender, EventArgs e)
		{
			OnOKCliked(sender, e);
		}

		public virtual void OnOKCliked(object sender, EventArgs e)
		{
		}

		[Browsable(false)]
		public System.Web.UI.WebControls.Button NewButton
		{
			get
			{
				if (m_NewButton != null)
					return m_NewButton;
				m_NewButton = (Button)FindControl("New");
				return m_NewButton;
			}
		}

		protected void NewButton_Click(object sender, EventArgs e)
		{
			OnNewCliked(sender, e);
		}

		public virtual void OnNewCliked(object sender, EventArgs e)
		{
		}

		// Cancel Button

		[Browsable(false)]
		public System.Web.UI.WebControls.Button CancelButton
		{
			get { return m_CancelButton; }
		}

		public override void SetControlsValues()
		{
			if (AccessMethodDropDownList != null)
				AccessMethodDropDownList.SelectedValue = m_AccessMethod.ToString();
		}

		virtual public IStructDataCollection GetResults()
		{
			throw new NotImplementedException("GetResults() in " + this.GetType().ToString());
		}
	}
}



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