using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using banco1.domain;

namespace banco1.presentacion
{
	/// <summary>
	/// Descripción breve de NumeroDeCuenta.
	/// </summary>
	public class NumeroDeCuenta : System.Windows.Forms.UserControl
	{
		private System.Windows.Forms.TextBox tbCCC;
		private System.Windows.Forms.TextBox tbDC;
		private System.Windows.Forms.TextBox tbSucursal;
		private System.Windows.Forms.TextBox tbEntidad;
		/// <summary> 
		/// Variable del diseñador requerida.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public NumeroDeCuenta()
		{
			// Llamada requerida por el Diseñador de formularios Windows.Forms.
			InitializeComponent();

			this.tbEntidad.Text=Cuenta.entidad;

		}

		/// <summary> 
		/// Limpiar los recursos que se estén utilizando.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary> 
		/// Método necesario para admitir el Diseñador. No se puede modificar 
		/// el contenido del método con el editor de código.
		/// </summary>
		private void InitializeComponent()
		{
			this.tbCCC = new System.Windows.Forms.TextBox();
			this.tbDC = new System.Windows.Forms.TextBox();
			this.tbSucursal = new System.Windows.Forms.TextBox();
			this.tbEntidad = new System.Windows.Forms.TextBox();
			this.SuspendLayout();
			// 
			// tbCCC
			// 
			this.tbCCC.Location = new System.Drawing.Point(156, 2);
			this.tbCCC.MaxLength = 10;
			this.tbCCC.Name = "tbCCC";
			this.tbCCC.Size = new System.Drawing.Size(92, 20);
			this.tbCCC.TabIndex = 13;
			this.tbCCC.Text = "";
			this.tbCCC.TextChanged += new System.EventHandler(this.tbCCC_TextChanged);
			// 
			// tbDC
			// 
			this.tbDC.Enabled = false;
			this.tbDC.Location = new System.Drawing.Point(128, 2);
			this.tbDC.MaxLength = 2;
			this.tbDC.Name = "tbDC";
			this.tbDC.Size = new System.Drawing.Size(28, 20);
			this.tbDC.TabIndex = 12;
			this.tbDC.Text = "";
			// 
			// tbSucursal
			// 
			this.tbSucursal.Location = new System.Drawing.Point(64, 2);
			this.tbSucursal.MaxLength = 4;
			this.tbSucursal.Name = "tbSucursal";
			this.tbSucursal.Size = new System.Drawing.Size(64, 20);
			this.tbSucursal.TabIndex = 11;
			this.tbSucursal.Text = "";
			this.tbSucursal.TextChanged += new System.EventHandler(this.tbSucursal_TextChanged);
			// 
			// tbEntidad
			// 
			this.tbEntidad.Enabled = false;
			this.tbEntidad.Location = new System.Drawing.Point(0, 2);
			this.tbEntidad.MaxLength = 4;
			this.tbEntidad.Name = "tbEntidad";
			this.tbEntidad.Size = new System.Drawing.Size(64, 20);
			this.tbEntidad.TabIndex = 10;
			this.tbEntidad.Text = "";
			// 
			// NumeroDeCuenta
			// 
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.tbCCC,
																		  this.tbDC,
																		  this.tbSucursal,
																		  this.tbEntidad});
			this.Name = "NumeroDeCuenta";
			this.Size = new System.Drawing.Size(248, 24);
			this.ResumeLayout(false);

		}
		#endregion

		private void tbSucursal_TextChanged(object sender, System.EventArgs e)
		{
			this.tbDC.Text=Cuenta.getDigitoDeControl(this.tbSucursal.Text, this.tbCCC.Text);		
		}

		private void tbCCC_TextChanged(object sender, System.EventArgs e)
		{
			this.tbDC.Text=Cuenta.getDigitoDeControl(this.tbSucursal.Text, this.tbCCC.Text);
		}

		public String numero 
		{
			get { return this.tbEntidad.Text + this.tbSucursal.Text + this.tbDC.Text + this.tbCCC.Text; }
		}

		public String entidad 
		{
			get { return this.tbEntidad.Text; }
			set { this.tbEntidad.Text=value; }
		}

		public String sucursal 
		{
			get { return this.tbSucursal.Text; }
			set { this.tbSucursal.Text=value; }
		}

		public String dc 
		{
			get { return this.tbDC.Text; }
			set { this.tbDC.Text=value; }
		}

		public String ccc
		{
			get { return this.tbCCC.Text; }
			set { this.tbCCC.Text=value; }
		}
	}
}
