public ProfeRamos(object sender, string name)
        {
            InitializeComponent();
            listener = sender;
            if (sender is Ibd)
            {
                ibd = (Ibd)sender;
            }
            BaseDeDatos BdAux = ibd.GetBaseDeDatos();

            profesor = (Profesor)BdAux.GetUser(name);
            foreach (Semestre s in BdAux.GetListaSemestres())
            {
                foreach (Ramo r in s.GetListaRamos())
                {
                    foreach (Profesor p in r.GetProfes())
                    {
                        if (p.GetNombre() == profesor.GetNombre())
                        {
                            ComboBoxRamos.Items.Add(r);
                        }
                    }
                }
            }
        }
        private void button_Iniciar_Click(object sender, EventArgs e)
        {
            string name = textBox_User.Text;
            string pwd  = textBox_Pwd.Text;

            if (bd.ExisteUser(name)) //Verifica que existe Usuario
            {
                Usuario usuario = bd.GetUser(name);
                bd.SetUsuarioActual(usuario);
                bool bnd = false;
                while (bnd == false)
                {
                    if (usuario.GetContrasena() != pwd)
                    {
                        MessageBox.Show("Contrasena incorrecta.");
                        break;
                    }
                    else
                    {
                        bnd = true;
                    }
                }
                if (bnd != false)
                {
                    if (usuario is Administrador)
                    {
                        Hide();
                        AccionesAdmin accionesAdmin = new AccionesAdmin(this, name);
                        Login(usuario);
                        accionesAdmin.ShowDialog();
                        Show();
                    }
                    else if (usuario is Alumno)
                    {
                        Hide();
                        AccionesAlumno accionesAlumno = new AccionesAlumno(this, name);
                        Login(usuario);
                        accionesAlumno.ShowDialog();
                        Show();
                    }
                    else
                    {
                        Hide();
                        AccionesProfesor accionesProfesor = new AccionesProfesor(this, name);
                        Login(usuario);
                        accionesProfesor.ShowDialog();
                        Show();
                    }
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show("Usuario o contrasena incorrectas.");
            }
        }
Beispiel #3
0
        public DisplayApuntes(object sender, string name)
        {
            InitializeComponent();
            if (sender is Ibd)
            {
                BdD = (Ibd)sender;
            }
            BaseDeDatos bdAux = BdD.GetBaseDeDatos();

            if (bdAux.GetUser(name) is Alumno)
            {
                alumno = (Alumno)bdAux.GetUser(name);
                foreach (Notes apunte in alumno.GetApuntes())
                {
                    listBox_Apuntes.Items.Add(apunte);
                }
            }
            else if (bdAux.GetUser(name) is Profesor)
            {
                Profesor profesor = (Profesor)bdAux.GetUser(name);
            }
        }
        public Apuntes(object sender, string name)
        {
            InitializeComponent();
            if (sender is Ibd)
            {
                BdD = (Ibd)sender;
            }
            BaseDeDatos bdAux = BdD.GetBaseDeDatos();

            alumno = (Alumno)bdAux.GetUser(name);
            foreach (Ramo ramo in alumno.GetRamos())
            {
                comboBox_Ramos.Items.Add(ramo);
            }
        }