private void btnSearch_Click(object sender, EventArgs e) { int countryId = 0, departmentId = 0; DAL.Student student = new DAL.Student(); student.Name = txtSearch.Text; if (cmbCity.SelectedValue != null && cmbCity.SelectedValue.ToString() != "") { student.CityId = Convert.ToInt32(cmbCity.SelectedValue); } if (cmbCountry.SelectedValue != null && cmbCountry.SelectedValue.ToString() != "") { countryId = Convert.ToInt32(cmbCountry.SelectedValue); } if (cmbProgram.SelectedValue != null && cmbProgram.SelectedValue.ToString() != "") { student.ProgramId = Convert.ToInt32(cmbProgram.SelectedValue); } if (cmbDepartment.SelectedValue != null && cmbDepartment.SelectedValue.ToString() != "") { departmentId = Convert.ToInt32(cmbCountry.SelectedValue); } StudentdataGridView.DataSource = student.Select(countryId, departmentId).Tables[0]; }
private void frmStudentEducation_Load(object sender, EventArgs e2) { MinimumSize = this.Size; DAL.Student s = new DAL.Student(); cmbStudent.DataSource = s.Select().Tables[0]; cmbStudent.DisplayMember = "name"; cmbStudent.ValueMember = "id"; cmbStudent.SelectedValue = -1; DAL.Education e = new DAL.Education(); cmbEducation.DataSource = e.Select().Tables[0]; cmbEducation.DisplayMember = "name"; cmbEducation.ValueMember = "id"; cmbEducation.SelectedValue = -1; DAL.EducationBoard eb = new DAL.EducationBoard(); cmbEducationBoard.DataSource = eb.Select().Tables[0]; cmbEducationBoard.DisplayMember = "name"; cmbEducationBoard.ValueMember = "id"; cmbEducationBoard.SelectedValue = -1; }