// Método sensível ao clique no botão "Acessar"
        private void CmdLogin_Click(object sender, EventArgs e)
        {
            // Testa se usuario entrou com valor nulo no campo de matricula
            if (TxtMatricula.Text == "")
            {
                LblStatus.Text      = "Informe a matricula";
                LblStatus.ForeColor = Color.Red;
                TxtMatricula.Focus();
                return;
            }
            int matricula;

            // Testa se usuario entrou com valor numerico valido no campo de matricula
            if (!int.TryParse(TxtMatricula.Text, out matricula) == true)
            {
                LblStatus.Text      = "A matricula deve conter um valor numérico";
                LblStatus.ForeColor = Color.Red;
                TxtMatricula.Focus();
                return;
            }
            // Testa se usuario entrou com valor nulo no campo de senha
            if (TxtSenha.Text == "")
            {
                LblStatus.Text      = "Informe a senha";
                LblStatus.ForeColor = Color.Red;
                TxtSenha.Focus();
                return;
            }

            // Usa o login e senha entrado pelo usuario para fazer login
            logar("", Convert.ToInt32(TxtMatricula.Text), 0, TxtSenha.Text, "Totem", "");
            // Informa o usuario da verificacao no servidor
            LblStatus.Text      = "Verificando dados no servidor";
            LblStatus.ForeColor = Color.Black;
        }
Esempio n. 2
0
        /// <summary>
        /// Limpia los campos dónde se van a introducir datos.
        /// </summary>
        private void LimpiarCampos()
        {
            TxtNombre.Clear();
            TxtApellidos.Clear();
            TxtNif.Clear();
            TxtDireccion.Clear();;
            TxtTelefono.Clear();
            TxtObservaciones.Clear();

            TxtMarca.Clear();
            TxtModelo.Clear();
            TxtMatricula.Clear();
            TxtLlave.Clear();
            TxtPlaza.Clear();

            TxtBaseImponible.Clear();
            TxtIva.Clear();
            TxtTotal.Clear();
        }
Esempio n. 3
0
        /// <summary>
        /// Comprueba que los datos introducidos por el usuario sean correctos.
        /// </summary>
        /// <returns>Indica si los datos introducidos son correctos.</returns>
        private bool ComprobarDatosIntroducidos()
        {
            bool  hayNombre        = false;
            bool  hayDireccion     = false;
            bool  hayPlaza         = false;
            bool  hayBaseImponible = false;
            bool  hayIva           = false;
            bool  hayTotal         = false;
            Regex exprRegTelefono  = new Regex(@"^[0-9]{9}$|^[0-9]{9} \/ [0-9]{9} \/ [0-9]{9}$");
            Regex exprRegNif       = new Regex(@"[0-9]{8}[A-Z]{1}$|^X[0-9]{7}[A-Z]{1}$");
            Regex exprRegMatricula = new Regex("^[0-9]{4} [A-Z]{3}$|^[A-Z]{1,2} [0-9]{4} [A-Z]{1,2}$|^[A-Z]{1} [0-9]{4} [A-Z]{1,3}$");

            if (TxtNombre.Text.Length == 0)
            {
                MessageBox.Show("Tiene que introducir un nombre", "Nombre Vacío", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                hayNombre = true;
            }

            if (TxtDireccion.Text.Length == 0)
            {
                MessageBox.Show("Tiene que introducir una dirección", "Dirección Vacía", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                hayDireccion = true;
            }

            if (CbConceptos.SelectedIndex == 0)
            {
                if (TxtMatricula.Text.Length == 0 && CbConceptos.SelectedIndex == 0 && Convert.ToInt32(BtnAddCliente.Tag) == 1)
                {
                    MessageBox.Show("Tiene que introducir una matrícula", "Matrícula Vacía", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (!exprRegMatricula.IsMatch(TxtMatricula.Text))
                {
                    MessageBox.Show("Formato de matrícula incorrecto", "Formato Incorrecto", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtMatricula.Clear();
                    TxtMatricula.Focus();
                }
            }

            if (TxtPlaza.Text.Length == 0)
            {
                MessageBox.Show("Tiene que introducir una plaza", "Plaza Vacía", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                hayPlaza = true;
            }

            if (TxtBaseImponible.Text.Length == 0)
            {
                MessageBox.Show("Tiene que introducir una base imponible", "Base Imponible Vacía", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                hayBaseImponible = true;
            }

            if (TxtIva.Text.Length == 0)
            {
                MessageBox.Show("Tiene que introducir un I.V.A.", "I.V.A. Vacío", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                hayIva = true;
            }

            if (TxtTotal.Text.Length == 0)
            {
                MessageBox.Show("Tiene que introducir un total", "Total Vacío", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                hayTotal = true;
            }

            return(hayNombre && hayDireccion && hayPlaza && hayBaseImponible && hayIva && hayTotal);
        }