示例#1
0
 public void AddStudent(String Name, String Surname, String Email, int Phone, String PassportNumber, String Citizenship,
                        String CityOfBirth, int YearOfBirth, String Faculty, int IndexNumber, int YearOfRegistration, String Photo)
 {
     this.db.AddStudent(Name, Surname, Email, Phone, PassportNumber, Citizenship,
                        CityOfBirth, YearOfBirth, Faculty, IndexNumber, YearOfRegistration, Photo);
     StudentsDataGridView.DataSource = db.GetStudents("select * from Student");
     StudentsDataGridView.Update();
     StudentsDataGridView.Refresh();
 }
示例#2
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewCell cell in StudentsDataGridView.SelectedCells)
     {
         if (cell.Selected && cell.RowIndex >= 0)
         {
             int RowIndex = StudentsDataGridView.CurrentCell.RowIndex;
             this.db.RemoveStudent(StudentsDataGridView.Rows[RowIndex].Cells[9].Value.ToString());
             break;
         }
     }
     StudentsDataGridView.DataSource = db.GetStudents("select * from Student");
     StudentsDataGridView.Update();
     StudentsDataGridView.Refresh();
 }
示例#3
0
        private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            String semesterCB = SemesterComboBox.Text;

            if (semesterCB.Equals("All"))
            {
                StudentsDataGridView.DataSource = db.GetStudents("select * from Student");
            }
            else if (int.TryParse(semesterCB, out int n))
            {
                StudentsDataGridView.DataSource = db.GetStudents("select s.Name, s.Surname, s.Email, s.Phone, s.PassportNumber, s.Citizenship, s.CityOfBirth, s.YearOfBirth, s.Faculty, s.IndexNumber, s.YearOfRegistration, s.Photo" +
                                                                 " from Student s left join Semester sem " +
                                                                 "on s.IndexNumber=sem.StudentsIndexNumber " +
                                                                 "where sem.SemesterNumber=" + semesterCB);
            }
            StudentsDataGridView.Update();
            StudentsDataGridView.Refresh();
        }
示例#4
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            string SearchPhrase = searchPhraseTB.Text;

            if (LastNameCheckBox.Checked == true)
            {
                StudentsDataGridView.DataSource = db.GetStudents("select * from Student where Surname like '" + SearchPhrase + "%'");
            }
            else if (StudentNumberCheckBox.Checked == true && int.TryParse(SearchPhrase, out int n))
            {
                StudentsDataGridView.DataSource = db.GetStudents("select * from Student where IndexNumber=" + SearchPhrase);
            }
            else
            {
                StudentsDataGridView.DataSource = db.GetStudents("select * from Student");
            }
            StudentsDataGridView.Update();
            StudentsDataGridView.Refresh();
        }