예제 #1
0
        private void ValidarDatosCliente(List <string> errors)
        {
            if (DatePickerFechaNacimiento.Value.CompareTo(new FechaHelper().GetSystemDate()) >= 0)
            {
                errors.Add(Resources.ErrorFechaNacimiento);
            }

            if (string.IsNullOrEmpty(TxtNombre.Text))
            {
                errors.Add(Resources.ErrorNombre);
            }

            if (string.IsNullOrEmpty(TxtApellido.Text))
            {
                errors.Add(Resources.ErrorApellido);
            }

            if (string.IsNullOrEmpty(TxtDNI.Text))
            {
                errors.Add(Resources.ErrorDNI);
            }

            if (string.IsNullOrEmpty(TxtTipoDoc.Text))
            {
                errors.Add(Resources.ErrorTipoDocumento1);
            }
            else if (TxtTipoDoc.Text != Resources.DNI && TxtTipoDoc.Text != Resources.LE && TxtTipoDoc.Text != Resources.CUIL)
            {
                errors.Add(Resources.ErrorTipoDocumento2);
            }

            if (!string.IsNullOrEmpty(TxtDNI.Text) && !string.IsNullOrEmpty(TxtTipoDoc.Text))
            {
                Cliente cliente = UsuariosService.GetClienteByTipoDocNroDoc(TxtTipoDoc.Text, TxtDNI.Text);
                if (cliente.IdUsuario != 0)
                {
                    if (cliente.IdUsuario != Usuario.IdUsuario)
                    {
                        errors.Add(Resources.ErrorClienteExistente);
                    }
                }
            }
        }