public void xemdulieu() { BUL_ChiTietBaoCaoThang bUL_ChiTietBaoCaoThang = new BUL_ChiTietBaoCaoThang(); dGVchiTietBCThang.DataSource = bUL_ChiTietBaoCaoThang.getCTBaoCaoThang(); dGVchiTietBCThang.Refresh(); dGVchiTietBCThang.Columns[0].HeaderText = "STT"; dGVchiTietBCThang.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVchiTietBCThang.Columns[1].HeaderText = "Mã chuyến bay"; dGVchiTietBCThang.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVchiTietBCThang.Columns[2].HeaderText = "Số vé"; dGVchiTietBCThang.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVchiTietBCThang.Columns[3].HeaderText = "Doanh thu"; dGVchiTietBCThang.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVchiTietBCThang.Columns[4].HeaderText = "Tỉ lệ"; dGVchiTietBCThang.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dGVchiTietBCThang.Columns[5].HeaderText = "Mã báo cáo tháng"; dGVchiTietBCThang.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
private void btnXacNhan_Click(object sender, EventArgs e) { BUL_ChiTietBaoCaoThang bUL_ChiTietBaoCaoThang = new BUL_ChiTietBaoCaoThang(); if (txtMaCB.Text != "" && txtBCThang.Text != "") { ChiTietBaoCaoThang ctbct = new ChiTietBaoCaoThang(txtMaCB.Text, txtBCThang.Text); if (bUL_ChiTietBaoCaoThang.themCTBaoCaoThang(ctbct)) { MessageBox.Show("Thêm thành công"); dGVchiTietBCThang.DataSource = bUL_ChiTietBaoCaoThang.getCTBaoCaoThang(); // refresh datagridview } else { MessageBox.Show("Đã có lỗi xảy ra", "Lỗi"); } } else { MessageBox.Show("Xin hãy nhập đầy đủ"); } }
private void btnSua_Click(object sender, EventArgs e) { BUL_ChiTietBaoCaoThang bUL_ChiTietBaoCaoThang = new BUL_ChiTietBaoCaoThang(); if (txtSTT.Text != "") { ChiTietBaoCaoThang ctbct = new ChiTietBaoCaoThang(Convert.ToInt32(txtSTT.Text), txtMaCB.Text, Convert.ToInt32(txtSoVe.Text), Convert.ToInt32(txtDoanhThu.Text), txtMaBCThang.Text); if (bUL_ChiTietBaoCaoThang.suaCTBaoCaoThang(ctbct)) { MessageBox.Show("Sửa thành công"); xemdulieu(); addbinding(); } else { MessageBox.Show("Đã có lỗi xảy ra", "Lỗi"); } } else { MessageBox.Show("Kiểm tra lại"); } }