private void lap_phieu()
 {
     if(!ControlUtility.ValidateControlEmpty(m_txt_so_phieu_nhap, m_dat_ngay_nhap_kho, m_le_nhap_vao_kho, m_sle_nhan_vien))
     {
         XtraMessageBox.Show("Hoàn thiện dữ liệu trước", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if(m_grv_ds_hang.RowCount <= 0)
     {
         XtraMessageBox.Show("Chưa có hàng để nhập", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     var phieu_nhap = new GD_PHIEU_NHAP()
     {
         SO_CHUNG_TU = m_txt_so_phieu_nhap.Text,
         NGAY_CHUNG_TU = m_dat_ngay_nhap_kho.DateTime,
         ID_NHAN_VIEN_LIEN_QUAN = (long) m_sle_nhan_vien.EditValue,
         NGAY_NHAP_PHAN_MEM = DateTime.Now.Date
     };
     BS_MAT_HANG.Instance.LapPhieuNhap(phieu_nhap, m_lst_hang);
     var dlg = XtraMessageBox.Show("Lập phiếu nhập thành công! Bạn muốn lập phiếu nhập mới?", "THÔNG BÁO", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
     if(dlg == System.Windows.Forms.DialogResult.OK)
     {
         reset_nhap_hang();
         reset_phieu_nhap();
         m_lst_hang = new BindingList<BO_HANG>();
     }
     else
     {
         Dispose();
     }
 }
        public void LapPhieuNhap(GD_PHIEU_NHAP phieu_nhap, BindingList<BO_HANG> ip_lst_to_insert)
        {
            using(var uow = new UnitOfWork())
            {
                uow.Repository<GD_PHIEU_NHAP>().Insert(phieu_nhap);

                foreach(var item in ip_lst_to_insert)
                {
                    var entity = convert_to_entity_insert(item);
                    uow.Repository<GD_HANG>().Insert(entity);

                    var chiTietPhieu = new GD_PHIEU_NHAP_CHI_TIET();
                    chiTietPhieu.ObjectState = MODEL.Common.ObjectState.Added;
                    uow.Repository<GD_PHIEU_NHAP_CHI_TIET>().SaveWithSyncObjectState(chiTietPhieu);
                    chiTietPhieu.GD_HANG = entity;

                }
                uow.Save();
            }
        }