private void buttonInsert_Click(object sender, EventArgs e)
        {
            PhuKienNo inserted = new PhuKienNo();

            inserted.MaPhuKien  = textBoxMaPhuKien2.Text;
            inserted.TenPhuKien = textBoxTenPhuKien2.Text;
            if (textBoxDonViTinh2.Text != String.Empty)
            {
                inserted.DonViTinh_PK = double.Parse(textBoxDonViTinh2.Text);
            }
            if (textBoxGiaThanh2.Text != String.Empty)
            {
                inserted.GiaThanh_PK = double.Parse(textBoxGiaThanh2.Text);
            }
            try
            {
                BS_PhuKienNo.ThemPhuKienNo(inserted);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            ShowPanel(1);
            HienThiDuLieu_PhuKienNo();
        }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            List <PhuKienNo> dsXoa = new List <PhuKienNo>();

            foreach (int value in gridViewMain.GetSelectedRows())
            {
                dsXoa.Add(gridViewMain.GetRow(value) as PhuKienNo);
            }
            try
            {
                BS_PhuKienNo.XoaPhuKienNo(dsXoa);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            HienThiDuLieu_PhuKienNo();
        }
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            PhuKienNo updated = gridViewMain.GetFocusedRow() as PhuKienNo;

            updated.TenPhuKien = textBoxTenPhuKien.Text;
            if (textBoxDonViTinh.Text != String.Empty)
            {
                updated.DonViTinh_PK = double.Parse(textBoxDonViTinh.Text);
            }
            if (textBoxGiaThanh.Text != String.Empty)
            {
                updated.GiaThanh_PK = double.Parse(textBoxGiaThanh.Text);
            }
            try
            {
                BS_PhuKienNo.CapNhatPhuKienNo(updated);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            ShowPanel(1);
            HienThiDuLieu_PhuKienNo();
        }
        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_PhuKienNo()
        {
            List <PhuKienNo> dsPhuKienNo = BS_PhuKienNo.DanhSachPhuKienNo();

            gridControlMain.DataSource = dsPhuKienNo;
        }
 private void buttonPrint_Click(object sender, EventArgs e)
 {
     BS_Main.PrintData <PhuKienNo>(BS_PhuKienNo.DanhSachPhuKienNo());
 }
 private void buttonExport_Click(object sender, EventArgs e)
 {
     BS_Main.ExcelExport <PhuKienNo>(BS_PhuKienNo.DanhSachPhuKienNo());
 }