Пример #1
0
        private void Luu(int Trang_thai)
        {
            int rs = 0;

            KiemTraDuLieu(ref rs);

            if (rs == 1)
            {
                rs = PhieuNhapCtrl.Insert(ledNhanVienNhap.EditValue, ledNhaCungCap.EditValue, ledKhoNhap.EditValue, txtChungTuGoc.Text, dteNgayNhap.EditValue, mmoGhiChu.Text, 6);

                if (rs == 0)
                {
                    NotifyHelper.ShowError("Thêm phiếu nhập không thành công", "Lỗi thêm phiếu nhập");
                    return;
                }

                rs = PhieuNhapCtrl.AddDetails(rs, Trang_thai, grvPhieuNhapCT);

                if (rs == 0)
                {
                    NotifyHelper.ShowError("Thêm các chi tiết phiếu nhập không thành công", "Lỗi thêm chi tiết phiếu nhập");
                    PhieuNhapCtrl.Delete(rs);

                    return;
                }

                NotifyHelper.ShowInfo("Thêm phiếu nhập thành công", "Thêm phiếu nhập");

                btnLamLai.PerformClick();
            }
        }