Ejemplo n.º 1
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            string makhoa, machuongtrinhhoc, magv, maphonghoc, mangayhoc, maca;

            makhoa           = new KhoaHocBUS().GetMa_TheoTen(cbKhoaHoc.Text);
            machuongtrinhhoc = new ChuongTrinhHocBUS().GetMa_TheoTen(cbChuongTrinhHoc.Text);
            magv             = new GiangVienBUS().GetMa_TheoTen(cbGiangVien.Text);
            maphonghoc       = new PhongHocBUS().GetMa_TheoTen_PhongHoc(cbPhongHoc.Text);
            mangayhoc        = new NgayHocBUS().GetMa_TheoTen(cbNgayHoc.Text);
            maca             = new CaHocBUS().GetMa_TheoTen(cbCaHoc.Text);
            _objlop          = new Lop(
                dataGridViewX1.CurrentRow.Cells[0].Value.ToString(),
                txtTenLop.Text,
                makhoa,
                machuongtrinhhoc,
                DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString()),
                DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString()),
                maca,
                mangayhoc,
                magv,
                maphonghoc);
            //MessageBox.Show(dataGridViewX1.CurrentRow.Cells[0].Value.ToString() +
            //    txtTenLop.Text+
            //    makhoa+
            //    machuongtrinhhoc+
            //    DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString())+
            //    DateTime.Parse(dtipNgayBatDau.Value.ToShortDateString())+
            //    maca+
            //    mangayhoc+
            //    magv+
            //    maphonghoc);

            if (_objlopbus.EditLop(_objlop))
            {
                MessageBox.Show("Cập nhật thành công ", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadData();
                resettextbox();
            }
            else
            {
                MessageBox.Show("Cập Nhật thất bại", "Thông báo ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }