private void frm_DanhSachPhieuXuatTieuHao_Load(object sender, EventArgs e)
 {
     liDM = XuatTieuHaoProvider.GetListXuatTieuHao();
     grcDanhSach.DataSource = liDM;
     btnMoPhieu.Enabled     = true;
     btnMoPhieu.Text        = Resources.btnInfor;
     btnDong.Text           = Resources.btnClose;
     LoadTrangThai();
     this.Text = this.Text + " - " + VerBase.CurrentVersion;
 }
        private void btnMoPhieu_Click(object sender, EventArgs e)
        {
            if (grvDanhSach.FocusedRowHandle < 0)
            {
                return;
            }
            ChungTuXuatTieuHaoInfor item = (ChungTuXuatTieuHaoInfor)grvDanhSach.GetRow(grvDanhSach.FocusedRowHandle);
            frm_PhieuXuatTieuHao    frm  = new frm_PhieuXuatTieuHao(item.IdChungTu, item.SoChungTu, item.NgayLap.ToString(), item.SoChungTuGoc, item.IdChungTuGoc, item.TrangThai, item.HoTen);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                liDM = XuatTieuHaoProvider.GetListXuatTieuHao();
                grcDanhSach.DataSource = liDM;
            }
        }
        private void grvDanhSach_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (grvDanhSach.FocusedRowHandle < 0)
                {
                    return;
                }
                ChungTuXuatTieuHaoInfor item = (ChungTuXuatTieuHaoInfor)grvDanhSach.GetRow(grvDanhSach.FocusedRowHandle);
                if (item == null)
                {
                    return;
                }
                frm_PhieuXuatTieuHao frm = new frm_PhieuXuatTieuHao(item.IdChungTu, item.SoChungTu, item.NgayLap.ToString(), item.SoChungTuGoc, item.IdChungTuGoc, item.TrangThai, item.HoTen);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    liDM = XuatTieuHaoProvider.GetListXuatTieuHao();
                    grcDanhSach.DataSource = liDM;
                }
            }
            catch (ManagedException ex)
            {
#if DEBUG
                MessageBox.Show(ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show(ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
            catch (Exception ex)
            {
#if DEBUG
                MessageBox.Show(ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show(ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
                EventLogProvider.Instance.WriteLog(ex.ToString()
                                                   + "\nUser: "******"\nKho: " + Declare.IdKho,
                                                   this.Name);
            }
        }