Example #1
0
        private void btnThemSV_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            nbcDSLopHocPhan.OptionsNavPane.NavPaneState = DevExpress.XtraNavBar.NavPaneState.Collapsed;
            frmThemSinhVien f = new frmThemSinhVien();

            if (f.ShowDialog() == DialogResult.OK)
            {
                string tenLop = f.tenLop;
                f.Close();
                try
                {
                    DataTable dtb = Lop_BUS.DSSV_Lop(tenLop);
                    for (int i = 0; i < dtb.Rows.Count; i++)
                    {
                        LHPbindingSource.AddNew();
                        gvLHP.SetFocusedRowCellValue(colMaSV, dtb.Rows[i][0].ToString());
                        gvLHP.SetFocusedRowCellValue(colTenSV, dtb.Rows[i][1].ToString());
                        if (dtb.Rows[i][3].ToString() != "")
                        {
                            gvLHP.SetFocusedRowCellValue(colNgaySinh, DateTime.Parse(dtb.Rows[i][3].ToString()));
                        }
                        if (dtb.Rows[i][5].ToString() != "")
                        {
                            gvLHP.SetFocusedRowCellValue(colNgayNhapHoc, DateTime.Parse(dtb.Rows[i][5].ToString()));
                        }
                    }
                    LopHocPhan_BUS.themDSSV_LHP(tenLop, tbMaLHP.Text);
                    MessageBox.Show("Thêm thành công");
                }
                catch
                {
                    MessageBox.Show("Thêm không thành công");
                }
            }
        }
Example #2
0
 private void gvDSLop_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     if (gvDSLop.FocusedRowHandle >= 0)
     {
         tbMaLop.Text                = gvDSLop.GetFocusedRowCellValue(colMaLop).ToString();
         tbTenLop.Text               = ChuanHoa(gvDSLop.GetFocusedRowCellValue(colTenLop).ToString().ToLower());
         cboTenKhoa.Text             = ChuanHoa(gvDSLop.GetFocusedRowCellValue(colTenKhoa).ToString().ToLower());
         tbSiSo.Text                 = gvDSLop.GetFocusedRowCellValue(colSiSo).ToString();
         LopbindingSource.DataSource = Lop_BUS.DSSV_Lop(tbTenLop.Text);
         gcLop.DataSource            = LopbindingSource;
     }
 }