public ActionResult XoaThongTinPhieu(RisPhieuCdinhCtiet[] arrPhieuChiTiet) { try { using (var scope = new TransactionScope()) { using (var sh = new SharedDbConnectionScope()) { foreach (RisPhieuCdinhCtiet objPhieuCdinhCtiet in arrPhieuChiTiet) { RisPhieuCdinhCtiet.Delete(objPhieuCdinhCtiet.IdPhieuCtiet); SqlQuery sqlQuery = new Select().From(RisPhieuCdinhCtiet.Schema) .Where(RisPhieuCdinhCtiet.Columns.IdPhieu).IsEqualTo(objPhieuCdinhCtiet.IdPhieu); log.Info("Xoa thong tin cua chi tiet ="+objPhieuCdinhCtiet.IdPhieuCtiet+" nguoi xoa la="+globalVariables.UserName); if(sqlQuery.GetRecordCount()<=0) { log.Info("kiem tra phieu bi xoa het thi xoa luon phieu kia di="+objPhieuCdinhCtiet .IdPhieu); RisPhieuCdinh.Delete(objPhieuCdinhCtiet.IdPhieu); } } } scope.Complete(); log.Info("Xoa thong tin thanh cong cua ban ghi="+arrPhieuChiTiet.Count()); return ActionResult.Success; } } catch (Exception exception) { log.Error("Loi trong qua trinh them moi benh nhan {0}", exception.ToString()); VietBaIT.CommonLibrary.ErrorLog.InsertErrorlog(exception.ToString(), Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().FullName); return ActionResult.Error; } }