void RequestToDB_HT_KQXN() { if (!setting.HT_ThongTinKQXN) { return; } try { List <HT_KetQuaXetNghiem> kqxns = bnhtDB.GetAllKetQuaXetNghiem(); foreach (var xn in kqxns) { if (xn.FlagNeedSync && bnhtDB.CheckPatientApprove(xn.MaBN)) { var message = new MailMessage(smtpSetting.MailAddressSend, smtpSetting.MailAddressReceive, Utilities.Header_HT_KetQuaXetNghiem, xn.CreateFileDataXML().ToString()); //if (xn.FilePath != null) // AttachmentFile(ref message, "Kết quả xét nghiệm " + xn.MaBN + " " + xn.NgayTao.ToString("dd-MM-yyyy"), xn.FilePath); mailClient.Send(message); bnhtDB.ResetInforSync_KQXN(xn.Id); } } } catch (Exception ex) { throw ex; } }