/*Busca si el socio ya se encuentra en la BD si lo encuentra extre los datos, si no lo encuentra libera los campos para
         la inserción*/
        protected void btnBuscaSocio_Click(object sender, EventArgs e)
        {
            /*Verifica que el campo Número Socio no sea nulo, si el campo contiene elementos habilita los botones de Modifica y Cancelar
             en caso contrario envia un mensaje de error*/
            if (!this.txtNumSocio.IsEmpty)
            {
                this.btnModificarSocio.Disabled = false;
                this.btnCancelarRegistroSocio.Disabled = false;

                /*Realiza una consulta en la BD enviando los parametros de Numero_Socio y Id_Sucursal*/
                datsocio = llamada.CargaDatosSocioAlta(this.txtNumSocio.Text, this.cbSucursal.SelectedItem.Value);
                
                /*Realiza una comparación de los datos ingresados con los obtenidos de la consulta
                 si son los mismos carga los datos del socio para realizar una modificación*/
                if (datsocio.NumSocio == this.txtNumSocio.Text && datsocio.Sucursal == this.cbSucursal.SelectedItem.Value)
                {
                    Habilitar_CamposSocio();
                    btnModificarSocio.Disabled = false;
                    txtNumSocio.Disabled = true;

                    this.txtNombre.Text = datsocio.Nombre;
                    this.txtNombre2.Text = datsocio.Nombre2;
                    this.txtApellidoPat.Text = datsocio.ApellidoPat;
                    this.txtApellidoMat.Text = datsocio.ApellidoMat;
                    fechaNac = Convert.ToDateTime(datsocio.FechaNac);
                    this.dteFechaN.Text = fechaNac.ToString("dd/MM/yyyy");
                    fechaIng = Convert.ToDateTime(datsocio.FechaIng);
                    this.dteFechaI.Text = fechaIng.ToString("dd/MM/yyyy");
                    if (datsocio.Sexo == true)
                    {
                        this.rdoMasculino.Checked = true;
                    }
                    else
                    {
                        this.rdoFemenino.Checked = true;
                    }
                    this.cbOcupacion.SelectedItem.Value = datsocio.Ocupacion;
                    this.cbEdoCivil.SelectedItem.Value = datsocio.EdoCivil;
                    this.txtCalle.Text = datsocio.Calle;
                    this.txtNoExt.Text = datsocio.NumExt;
                    this.txtNoInt.Text = datsocio.NumInt;
                    this.cbPaqueteria.SelectedItem.Value = datsocio.IdPaqueteria;
                    this.txtGuia.Text = datsocio.NumeroGuia;
                }
                else
                {
                    Limpia_CamposSocio();
                }
                Habilitar_CamposSocio();
                this.txtNumSocio.Disabled = true;
                this.cbCooperativa.Disabled = true;
                this.cbPlaza.Disabled = true;
                this.cbSucursal.Disabled = true;
            }
            else
            {
                X.MessageBox.Alert("Aviso", "No has ingresado el número de socio").Show();
            }
        }
Esempio n. 2
0
        protected void btnBuscaSocio_Click(object sender, EventArgs e)
        {
            this.btnModificarSocio.Disabled = false;
            this.btnCancelarRegistroSocio.Disabled = false;
            if (!this.txtNumSocio.IsEmpty)
            {

                datsocio = llamada.CargaDatosSocioAlta(this.txtNumSocio.Text, this.cbSucursal.SelectedItem.Value);
                if (datsocio.NumSocio == this.txtNumSocio.Text && datsocio.Sucursal == this.cbSucursal.SelectedItem.Value)
                {
                    Habilitar_CamposSocio();
                    btnModificarSocio.Disabled = false;
                    //btnSiguiente.Disabled = true;
                    txtNumSocio.Disabled = true;

                    this.txtNombre.Text = datsocio.Nombre;
                    this.txtNombre2.Text = datsocio.Nombre2;
                    this.txtApellidoPat.Text = datsocio.ApellidoPat;
                    this.txtApellidoMat.Text = datsocio.ApellidoMat;
                    fechaNac = Convert.ToDateTime(datsocio.FechaNac);
                    this.dteFechaN.Text = fechaNac.ToString("dd/MM/yyyy");
                    fechaIng = Convert.ToDateTime(datsocio.FechaIng);
                    this.dteFechaI.Text = fechaIng.ToString("dd/MM/yyyy");
                    if (datsocio.Sexo == true)
                    {
                        this.rdoMasculino.Checked = true;
                    }
                    else
                    {
                        this.rdoFemenino.Checked = true;
                    }
                    this.cbOcupacion.SelectedItem.Value = datsocio.Ocupacion;
                    this.cbEdoCivil.SelectedItem.Value = datsocio.EdoCivil;
                    this.txtCalle.Text = datsocio.Calle;
                    this.txtNoExt.Text = datsocio.NumExt;
                    this.txtNoInt.Text = datsocio.NumInt;
                    this.cbPaqueteria.SelectedItem.Value = datsocio.IdPaqueteria;
                    this.txtGuia.Text = datsocio.NumeroGuia;
                }
                else
                {
                    Limpia_CamposSocio();
                }
                Habilitar_CamposSocio();
                this.txtNumSocio.Disabled = true;
                this.cbCooperativa.Disabled = true;
                this.cbPlaza.Disabled = true;
                this.cbSucursal.Disabled = true;
            }
            else
            {
                X.MessageBox.Alert("Aviso", "No has ingresado el número de socio").Show();
            }
        }