示例#1
0
        private int obtenerTipo(Cuenta c)
        {
            if (Invitado.esInvitado(user.id))
            {
                tipo = 0;
            }
            else if (Alumno.esAlumno(user.id))
            {
                tipo = 1;
            }
            else if (Docente.esDocente(user.id))
            {
                tipo = 2;
            }
            else if (ONG.esOng(user.id))
            {
                tipo = 3;
            }
            else
            {
                tipo = 4;
            }

            return(tipo);
        }
示例#2
0
        private void intentarLogueo()
        {
            try
            {
                // Se busca cuenta en base de datos.
                user = new Cuenta(tbUsuario.Text, tbClave.Text);

                // Se mira que tipo de cuenta es.
                if (Invitado.esInvitado(user.id))
                {
                    tipo = 0;
                }
                else if (Alumno.esAlumno(user.id))
                {
                    tipo = 1;
                }
                else if (Docente.esDocente(user.id))
                {
                    tipo = 2;
                }
                else if (ONG.esOng(user.id))
                {
                    tipo = 3;
                }
                else
                {
                    tipo = 4;
                }
                Principal ventana = new Principal(user, tipo);
                this.Visible = false;
                ventana.ShowDialog();
                this.Visible = true;
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Too many connections"))
                {
                    MessageBox.Show("Base de datos sobrecargada, por favor, intentalo de nuevo");
                }
                else
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }