private void buttonDelete_Click(object sender, EventArgs e) { List <DatDa> dsXoa = new List <DatDa>(); foreach (int value in gridViewMain.GetSelectedRows()) { dsXoa.Add(gridViewMain.GetRow(value) as DatDa); } try { BS_DatDa.XoaDatDa(dsXoa); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } HienThiDuLieu_DatDa(); }
private void buttonUpdate_Click(object sender, EventArgs e) { DatDa updated = gridViewMain.GetFocusedRow() as DatDa; updated.TenDatDa = textBoxTenDatDa.Text; updated.HS_KienCo_TB = double.Parse(textBoxHeSoKienCo.Text); updated.HeSoDatDa = double.Parse(textBoxHeSoDatDa.Text); updated.TinhChat = textBoxTinhChat.Text; updated.DungTrong = double.Parse(textBoxDungTrong.Text); updated.KCTB_KhoiNut = double.Parse(textBoxKCTB.Text); updated.KT_HAT_MAX = double.Parse(textBoxKT_HAT_MAX.Text); try { BS_DatDa.CapNhatDatDa(updated); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_DatDa(); }
private void buttonInsert_Click(object sender, EventArgs e) { DatDa inserted = new DatDa(); inserted.MaDatDa = textBoxMaDatDa2.Text; inserted.TenDatDa = textBoxTenDatDa2.Text; if (textBoxHeSoKienCo2.Text != String.Empty) { inserted.HS_KienCo_TB = double.Parse(textBoxHeSoKienCo2.Text); } if (textBoxHeSoDatDa2.Text != String.Empty) { inserted.HeSoDatDa = double.Parse(textBoxHeSoDatDa2.Text); } inserted.TinhChat = textBoxTinhChat2.Text; if (textBoxDungTrong2.Text != String.Empty) { inserted.DungTrong = double.Parse(textBoxDungTrong2.Text); } if (textBoxKCTB2.Text != String.Empty) { inserted.KCTB_KhoiNut = double.Parse(textBoxKCTB2.Text); } if (textBoxKT_HAT_MAX2.Text != String.Empty) { inserted.KT_HAT_MAX = double.Parse(textBoxKT_HAT_MAX2.Text); } try { BS_DatDa.ThemDatDa(inserted); } catch (Exception exc) { MessageBox.Show("Lỗi - " + exc.Message); } ShowPanel(1); HienThiDuLieu_DatDa(); }
private void gridViewMain_DoubleClick(object sender, EventArgs e) { ShowPanel(3); HoChieu focusedRow = gridViewMain.GetFocusedRow() as HoChieu; textBoxMaBanVe.Text = focusedRow.MaBanVe; textBoxMaHoChieu.Text = focusedRow.MaHoChieu; textBoxTenHoChieu.Text = focusedRow.TenHoChieu; textBoxNgayLap.Text = focusedRow.NgayLap; comboBox_CongTruong.Text = BS_CongTruong.CongTruong(focusedRow.MaCongTruong).TenCongTruong; comboBox_DatDa.Text = BS_DatDa.DatDa(focusedRow.MaDatDa).TenDatDa; comboBox_MayKhoan.Text = BS_MayKhoan.MayKhoan(focusedRow.MaMayKhoan).TenMayKhoan; comboBox_KipNo.Text = BS_KipNo.KipNo(focusedRow.MaMayKhoan).TenKipNo; comboBox_ThuocNo.Text = BS_ThuocNo.ThuocNo(focusedRow.MaThuocNo).TenThuocNo; comboBox_PhuongPhapNo.Text = BS_PhuongPhapNo.PhuongPhapNo(focusedRow.MaPPNo).TenPPNo; comboBox_PhuKien.Text = BS_PhuKienNo.PhuKienNo(focusedRow.MaPhuKien).TenPhuKien; comboBox_CapDo.Text = BS_CapDoNo.CapDoNo(focusedRow.MaCapDo).TenCapDo; textBoxHeSoKC.Text = focusedRow.HeSoKC.ToString(); textBoxChieuCaoTang.Text = focusedRow.ChieuCaoTang.ToString(); textBoxQuyMoDotNo.Text = focusedRow.QuyMoDotNo.ToString(); textBoxKichThuoc_X.Text = focusedRow.KichThuoc_X.ToString(); textBoxKichThuoc_Y.Text = focusedRow.KichThuoc_Y.ToString(); //textBoxThoiDiemNo.Text = ...; }
private void HienThiDuLieu_HoChieu() { List <HoChieu> dsHoChieu = BS_HoChieu.DanhSachHoChieu(); gridControlMain.DataSource = dsHoChieu; //panel insert + update comboBox_CongTruong.DataSource = comboBox_CongTruong2.DataSource = BS_CongTruong.DanhSachCongTruong(); comboBox_CongTruong.DisplayMember = comboBox_CongTruong2.DisplayMember = "TenCongTruong"; comboBox_DatDa.DataSource = comboBox_DatDa2.DataSource = BS_DatDa.DanhSachDatDa(); comboBox_DatDa.DisplayMember = comboBox_DatDa2.DisplayMember = "TenDatDa"; comboBox_MayKhoan.DataSource = comboBox_MayKhoan2.DataSource = BS_MayKhoan.DanhSachMayKhoan(); comboBox_MayKhoan.DisplayMember = comboBox_MayKhoan2.DisplayMember = "TenMayKhoan"; comboBox_KipNo.DataSource = comboBox_KipNo2.DataSource = BS_KipNo.DanhSachKipNo(); comboBox_KipNo.DisplayMember = comboBox_KipNo2.DisplayMember = "TenKipNo"; comboBox_ThuocNo.DataSource = comboBox_ThuocNo2.DataSource = BS_ThuocNo.DanhSachThuocNo(); comboBox_ThuocNo.DisplayMember = comboBox_ThuocNo2.DisplayMember = "TenThuocNo"; comboBox_PhuongPhapNo.DataSource = comboBox_PhuongPhapNo2.DataSource = BS_PhuongPhapNo.DanhSachPPNo(); comboBox_PhuongPhapNo.DisplayMember = comboBox_PhuongPhapNo2.DisplayMember = "TenPPNo"; comboBox_PhuKien.DataSource = comboBox_PhuKien2.DataSource = BS_PhuKienNo.DanhSachPhuKienNo(); comboBox_PhuKien.DisplayMember = comboBox_PhuKien2.DisplayMember = "TenPhuKien"; comboBox_CapDo.DataSource = comboBox_CapDo2.DataSource = BS_CapDoNo.DanhSachCapDoNo(); comboBox_CapDo.DisplayMember = comboBox_CapDo2.DisplayMember = "TenCapDo"; textBoxNgayLap2.Text = DateTime.Now.ToString(); }
private void HienThiDuLieu_DatDa() { List <DatDa> dsDatDa = BS_DatDa.DanhSachDatDa(); gridControlMain.DataSource = dsDatDa; }
private void buttonPrint_Click(object sender, EventArgs e) { BS_Main.PrintData <DatDa>(BS_DatDa.DanhSachDatDa()); }
private void buttonExport_Click(object sender, EventArgs e) { BS_Main.ExcelExport <DatDa>(BS_DatDa.DanhSachDatDa()); }