示例#1
0
        //public void asignarDataBinding()
        //{
        //    this.bindingSource.DataSource = socioNegocio;
        //    foreach (Control control1 in this.Controls)
        //    {
        //        if (control1.Tag != null)
        //            ((DevExpress.XtraEditors.BaseEdit)control1).DataBindings.Add(new System.Windows.Forms.Binding("EditValue", bindingSource, control1.Tag.ToString(), true));

        //    }
        //}

        private void searchControlCliente_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }
            if (e.NewValue.ToString().Length < 5)
            {
                return;
            }
            SOCIONEGOCIO registro = fs.buscarSocioNegocio(e.NewValue.ToString(), CredencialUsuario.getInstancia().getEmpresaSeleccionada().CODIGOEMPRESA);

            if (registro != null)
            {
                this.bindingSource.DataSource = registro;
            }
            else
            {
                this.bindingSource.DataSource = new SOCIONEGOCIO();
                SystemSounds.Beep.Play();
            }
            //if (registro != null)
            //{

            //    this.textEditDocumento.EditValue = registro.NUMERODOCUMENTO;
            //    this.textEditRazonSocial.EditValue = registro.RAZONSOCIAL;
            //    this.textEditTelefono.EditValue = registro.TELEFONO;
            //    this.textEditDireccion.EditValue = registro.TELEFONO;
        }
        private void textEditDocumento_EditValueChanged(object sender, EventArgs e)
        {
            BaseEdit edit = (BaseEdit)sender;

            if (edit.Text == "" || edit.Text == null || edit.Text.Length < 8)
            {
                return;
            }
            //Utiles.Utiles util = new Utiles.Utiles();
            socionegocioSeleccionado = facturaServicio.buscarSocioNegocio(edit.Text);

            if (socionegocioSeleccionado == null)
            {
                DialogResult resultado = XtraMessageBox.Show("El cliente con documento " + edit.EditValue + " no existe. Desea crearlo?", "Atención", MessageBoxButtons.YesNo);
                if (resultado == System.Windows.Forms.DialogResult.Yes)
                {
                    FormDatoCliente formDatoCliente = new FormDatoCliente(edit.Text);
                    formDatoCliente.ShowDialog();
                    if (formDatoCliente.DialogResult == DialogResult.OK)
                    {
                        socionegocioSeleccionado = formDatoCliente.DatoCliente;
                    }
                }
                else
                {
                    socionegocioSeleccionado = new SOCIONEGOCIO();
                }
            }

            bindingSourceSocioNegocio.DataSource = socionegocioSeleccionado;
        }
示例#3
0
        public bool validarDocumentoCliente()
        {
            bindingSource.EndEdit();
            SOCIONEGOCIO cliente = facturaServcio.buscarSocioNegocio(datoCliente.NUMERODOCUMENTO, CredencialUsuario.getInstancia().getEmpresaSeleccionada().CODIGOEMPRESA);

            if (cliente != null)
            {
                MessageBox.Show("Cliente con documento: " + cliente.NUMERODOCUMENTO + " ya existe");
                this.bindingSource.DataSource = cliente;
                return(false);
            }

            if (!utiles.validarDocumento(datoCliente.NUMERODOCUMENTO))
            {
                MessageBox.Show("Documento no cumple con la validación. Asigne como pasaporte el tipo de documento");
                datoCliente.CODIGOTIPOIDENTIFICACION = (long)EnumTipoIdentificacion.PASAPORTE;

                return(false);
            }
            return(true);
        }