예제 #1
0
 private void SetStudents()
 {
     foreach (var Student in DM.GetAllStudents())
     {
         string Nombre = Student.Nombre + " " + Student.Second_Name + " " + Student.Second_Name2;
         AlumnosList.SetItemSubItems(Student.Matricula.ToString(), Nombre);
         AlumnosList.SetItemSubItems(Student.Matricula.ToString(), Student.Carrera);
         AlumnosList.SetItemSubItems(Student.Matricula.ToString(), Student.Semestre.ToString());
         AlumnosList.SetItemSubItems(Student.Matricula.ToString(), Student.Periodo);
         AlumnosList.SetItemSubItems(Student.Matricula.ToString(), Student.T_Servicio);
     }
 }
예제 #2
0
        private void SetSingleStudent(int matricula)
        {
            Student temp   = DM.GetStudentByMatricula(matricula);
            string  Nombre = temp.Nombre + " " + temp.Second_Name + " " + temp.Second_Name2;

            AlumnosList.SetItemSubItems(temp.Matricula.ToString(), Nombre);
            AlumnosList.SetItemSubItems(temp.Matricula.ToString(), temp.Carrera);
            AlumnosList.SetItemSubItems(temp.Matricula.ToString(), temp.Semestre.ToString());
            AlumnosList.SetItemSubItems(temp.Matricula.ToString(), temp.Periodo);
            AlumnosList.SetItemSubItems(temp.Matricula.ToString(), temp.T_Servicio);

            A_Matricula.Text = temp.Matricula.ToString();
            A_Nombre.Text    = temp.Nombre;
            A_ApellidoP.Text = temp.Second_Name;
            A_ApellidoM.Text = temp.Second_Name2;
            Carrera.Text     = temp.Carrera;
            Semestre.Text    = temp.Semestre.ToString();
            tipoServicio     = temp.T_Servicio;
            periodo          = temp.Periodo;
        }
예제 #3
0
        private void AddStudent_Click(object sender, EventArgs e)
        {
            if (A_Matricula.TextLength < 7)
            {
                MessageBox.Show("La matricula tiene que tener minimo 7 caracteres");
            }
            else
            {
                if (Becario.Checked)
                {
                    tipoServicio = "B";
                }
                else
                {
                    if (ServicioSocial.Checked)
                    {
                        tipoServicio = "SS";
                    }
                }

                if (Verano.Checked)
                {
                    periodo = "EJ";
                }
                else
                {
                    if (Invierno.Checked)
                    {
                        periodo = "AD";
                    }
                }

                student.Matricula    = int.Parse(A_Matricula.Text);
                student.Nombre       = A_Nombre.Text.ToUpper();
                student.Second_Name  = A_ApellidoP.Text.ToUpper();
                student.Second_Name2 = A_ApellidoM.Text.ToUpper();
                student.Carrera      = Carrera.Text;
                student.Semestre     = int.Parse(Semestre.Text);
                student.T_Servicio   = tipoServicio.ToString();
                student.Periodo      = periodo.ToString();

                if (!DM.StudentExistByMatricula(int.Parse(A_Matricula.Text)))
                {
                    DM.InsertStudent(student);

                    string Nombre = A_Nombre.Text.ToUpper() + " " + A_ApellidoP.Text.ToUpper() + " " + A_ApellidoM.Text.ToUpper();
                    AlumnosList.SetItemSubItems(A_Matricula.Text, Nombre);
                    AlumnosList.SetItemSubItems(A_Matricula.Text, Carrera.Text);
                    AlumnosList.SetItemSubItems(A_Matricula.Text, Semestre.Text);
                    AlumnosList.SetItemSubItems(A_Matricula.Text, periodo.ToString());
                    AlumnosList.SetItemSubItems(A_Matricula.Text, tipoServicio.ToString());

                    StateText.Text = "Alumno Agregado...";

                    A_Matricula.Text       = "";
                    A_Nombre.Text          = "";
                    A_ApellidoP.Text       = "";
                    A_ApellidoM.Text       = "";
                    Carrera.SelectedIndex  = 0;
                    Semestre.SelectedIndex = 0;
                    Becario.Checked        = true;
                    Verano.Checked         = true;
                }
                else
                {
                    MessageBox.Show("El alumno ya existe en la base de datos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }