private void DeleteChungTu() { try { if (MessageBox.Show("Bạn có chắc chắn muốn hủy đơn hàng này không (Yes/No)?", "Cảnh báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { ConnectionUtil.Instance.BeginTransaction(); if (Business.ChungTu.IdChungTu > 0) { //restore trang thai don hang cu Business.ChungTu.TrangThai = (int)OrderStatus.DE_NGHI_TRA_LAI_HANG_BAN; Business.ChungTu.Draft = 0; Business.CancelChungTu(); } ConnectionUtil.Instance.CommitTransaction(); MessageBox.Show("Hủy đơn hàng thành công!"); this.Close(); } } catch (Exception ex) { ConnectionUtil.Instance.RollbackTransaction(); EventLogProvider.Instance.WriteLog(ex.ToString() + "\nUser: "******"\nMay: " + Declare.TenMay, this.Name); #if DEBUG MessageBox.Show("Lỗi thực hiện Xóa đơn hàng\n" + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error); #else MessageBox.Show("Lỗi thực hiện Xóa đơn hàng", Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error); #endif } }