private void RefreshData(String _idLoKhoan)
        {
            LoKhoan loKhoan = BS_LoKhoan.ThongTinLoKhoan(idHoChieu, _idLoKhoan);

            //hiển thị thông tin
            labelValue_MaHoChieu.Text       = BS_HoChieu.HoChieu(loKhoan.MaHoChieu).TenHoChieu;
            labelValue_MaBanVe.Text         = loKhoan.MaBanVe;
            labelValue_MaMayKhoan.Text      = BS_MayKhoan.MayKhoan(loKhoan.MaMayKhoan).TenMayKhoan;
            labelValue_MaLK.Text            = loKhoan.MaLoKhoan;
            comboBox_MayKhoan.DataSource    = BS_MayKhoan.DanhSachMayKhoan();
            comboBox_MayKhoan.DisplayMember = "TenMayKhoan";
            comboBox_MayKhoan.Text          = BS_MayKhoan.MayKhoan(loKhoan.MaMayKhoan).TenMayKhoan;
            //hiển thị thông số
            labelValue_DuongKinh.Text  = (Math.Round(loKhoan.BanKinh * 2, 2)).ToString();
            textBox_DuongKinh.Text     = (Math.Round(loKhoan.BanKinh * 2, 2)).ToString();
            labelValue_ChieuSauLK.Text = (Math.Round(loKhoan.ChieuSau, 2)).ToString();
            textBox_ChieuSauLK.Text    = (Math.Round(loKhoan.ChieuSau, 2)).ToString();
            labelValue_HuongKhoan.Text = comboBox_HuongKhoan.Text = loKhoan.HuongKhoan;
            labelValue_ToaDoX.Text     = textBox_ToaDoX.Text = (Math.Round(loKhoan.ToaDoX, 2)).ToString();
            labelValue_ToaDoY.Text     = textBox_ToaDoY.Text = (Math.Round(loKhoan.ToaDoY, 2)).ToString();
            labelValue_Lt.Text         = textBox1.Text = loKhoan.Lt.ToString();
            labelValue_Lkk.Text        = textBox2.Text = loKhoan.Lkk.ToString();
            labelValue_L0.Text         = textBox3.Text = loKhoan.L0.ToString();
            labelValue_Lbua.Text       = textBox4.Text = loKhoan.Lbua.ToString();
        }
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            LoKhoan updated = gridViewMain.GetFocusedRow() as LoKhoan;

            updated.BanKinh  = double.Parse(textBoxBanKinh.Text);
            updated.ChieuSau = double.Parse(textBoxChieuSau.Text);
            updated.Lt       = double.Parse(textBoxLt.Text);
            updated.Lkk      = double.Parse(textBoxLkk.Text);
            updated.L0       = double.Parse(textBoxL0.Text);
            updated.Lbua     = double.Parse(textBoxLbua.Text);
            if (comboBox_HuongKhoan.Text != String.Empty)
            {
                updated.HuongKhoan = comboBox_HuongKhoan.Text;
            }
            if (comboBox_MayKhoan.Text != String.Empty)
            {
                updated.MaMayKhoan = (comboBox_MayKhoan.SelectedValue as MayKhoan).MaMayKhoan;
            }
            try
            {
                BS_LoKhoan.CapNhatLoKhoan(updated);
            }
            catch (Exception exc)
            {
                MessageBox.Show("Lỗi - " + exc.Message);
            }
            ShowPanel(1);
            HienThiDuLieu_LoKhoan();
        }
        private void gridViewMain_DoubleClick(object sender, EventArgs e)
        {
            ShowPanel(3);
            LoKhoan focusedRow = gridViewMain.GetFocusedRow() as LoKhoan;

            textBoxMaHoChieu.Text    = focusedRow.MaHoChieu;
            textBoxMaBanVe.Text      = focusedRow.MaBanVe;
            textBoxMaLoKhoan.Text    = focusedRow.MaLoKhoan;
            comboBox_MayKhoan.Text   = BS_MayKhoan.MayKhoan(focusedRow.MaMayKhoan).TenMayKhoan;
            textBoxBanKinh.Text      = focusedRow.BanKinh.ToString();
            textBoxChieuSau.Text     = focusedRow.ChieuSau.ToString();
            comboBox_HuongKhoan.Text = focusedRow.HuongKhoan;
            textBoxToaDoX.Text       = focusedRow.ToaDoX.ToString();
            textBoxToaDoY.Text       = focusedRow.ToaDoY.ToString();
            textBoxLt.Text           = focusedRow.Lt.ToString();
            textBoxLkk.Text          = focusedRow.Lkk.ToString();
            textBoxL0.Text           = focusedRow.L0.ToString();
            textBoxLbua.Text         = focusedRow.Lbua.ToString();
        }
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            LoKhoan loKhoan = BS_LoKhoan.ThongTinLoKhoan(idHoChieu, (comboBox_MaLK.SelectedItem as LoKhoan).MaLoKhoan);

            if (comboBox_MayKhoan.SelectedItem != null)
            {
                loKhoan.MaMayKhoan = (comboBox_MayKhoan.SelectedItem as MayKhoan).MaMayKhoan;
            }
            loKhoan.BanKinh    = double.Parse(textBox_DuongKinh.Text) / 2;
            loKhoan.ChieuSau   = double.Parse(textBox_ChieuSauLK.Text);
            loKhoan.HuongKhoan = comboBox_HuongKhoan.Text;
            loKhoan.ToaDoX     = double.Parse(textBox_ToaDoX.Text);
            loKhoan.ToaDoY     = double.Parse(textBox_ToaDoY.Text);
            loKhoan.Lt         = double.Parse(textBox1.Text);
            loKhoan.Lkk        = double.Parse(textBox2.Text);
            loKhoan.L0         = double.Parse(textBox3.Text);
            loKhoan.Lbua       = double.Parse(textBox4.Text);
            BS_LoKhoan.CapNhatLoKhoan(loKhoan);
            ChangeView(false);
            RefreshData((comboBox_MaLK.SelectedItem as LoKhoan).MaLoKhoan);
        }