Esempio n. 1
0
        private void layDanhSachLop()
        {
            try
            {
                if (cbxTatCaNamHoc.Checked)
                {
                    if (rdTenLop.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoTenLop(txtSearchInfo.Text);
                    }
                    if (rdGiangDuong.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangDuong(txtSearchInfo.Text);
                    }
                    if (rdGiangVien.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangVien(txtSearchInfo.Text);
                    }
                    if (rdGiangDuongThiLan1.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangDuongThiL1(txtSearchInfo.Text);
                    }
                    if (rdGiangDuongThiLan2.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangDuongThiL2(txtSearchInfo.Text);
                    }
                    if (rdCanBoCoiThiLan1.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoCanBoCoiThiL1(txtSearchInfo.Text);
                    }
                    if (rdCanBoCoiThiLan2.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoCanBoCoiThiL2(txtSearchInfo.Text);
                    }
                }
                else
                {
                    int maNamHoc = (cmbNamHoc.SelectedItem as NamHocDTO).MaNamHoc;

                    if (rdTenLop.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoTenLop(txtSearchInfo.Text, maNamHoc);
                    }
                    if (rdGiangDuong.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangDuong(txtSearchInfo.Text, maNamHoc);
                    }
                    if (rdGiangVien.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangVien(txtSearchInfo.Text, maNamHoc);
                    }
                    if (rdGiangDuongThiLan1.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangDuongThiL1(txtSearchInfo.Text, maNamHoc);
                    }
                    if (rdGiangDuongThiLan2.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoGiangDuongThiL2(txtSearchInfo.Text, maNamHoc);
                    }
                    if (rdCanBoCoiThiLan1.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoCanBoCoiThiL1(txtSearchInfo.Text, maNamHoc);
                    }
                    if (rdCanBoCoiThiLan2.Checked)
                    {
                        listLop.DataSource = LopBUS.TimLopTheoCanBoCoiThiL2(txtSearchInfo.Text, maNamHoc);
                    }
                }

                if (listLop.Items.Count == 0)
                {
                    txtTenLop.Text               = "";
                    txtSoLuongSinhVien.Text      = "";
                    txtSoLuongNgoaiNganSach.Text = "";
                    txtSoLuongTrongNganSach.Text = "";
                    cmbNamHocCuaLop.DataSource   = null;
                    groupBox2.Visible            = false;
                }
                listLop.DisplayMember = "TenLop";
                listLop.ValueMember   = "MaLop";
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }