private void OnEdit() { _isPrint = false; _ketQuaSieuAm = null; if (dgSieuAm.SelectedRows == null || dgSieuAm.SelectedRows.Count <= 0) { MsgBox.Show(Application.ProductName, "Vui lòng chọn 1 kết quả siêu âm.", IconType.Information); return; } if (Global.AllowEditKhamCTC && Global.TVHomeConfig.SuDungSieuAm && !File.Exists(Global.TVHomeConfig.Path)) { MsgBox.Show(Application.ProductName, "Đường dẫn TVHome không tồn tại, vui lòng kiểm tra lại.", IconType.Information); return; } string gioiTinh = _patientRow["GenderAsStr"].ToString(); DataRow drKetQuaSieuAm = (dgSieuAm.SelectedRows[0].DataBoundItem as DataRowView).Row; bool allowEdit = _isChuyenBenhAn ? false : Global.AllowEditSieuAm; dlgAddKetQuaSieuAm dlg = new dlgAddKetQuaSieuAm(_patientGUID, gioiTinh, drKetQuaSieuAm, allowEdit); if (dlg.ShowDialog() == DialogResult.OK) { _isPrint = dlg.IsPrint; _ketQuaSieuAm = dlg.KetQuaSieuAm; DisplayAsThread(); } }
private void OnAdd() { _isPrint = false; _ketQuaSieuAm = null; if (Global.TVHomeConfig.SuDungSieuAm && !File.Exists(Global.TVHomeConfig.Path)) { MsgBox.Show(Application.ProductName, "Đường dẫn TVHome không tồn tại, vui lòng kiểm tra lại.", IconType.Information); return; } string gioiTinh = _patientRow["GenderAsStr"].ToString(); dlgAddKetQuaSieuAm dlg = new dlgAddKetQuaSieuAm(_patientGUID, gioiTinh); if (dlg.ShowDialog() == DialogResult.OK) { _isPrint = dlg.IsPrint; _ketQuaSieuAm = dlg.KetQuaSieuAm; DisplayAsThread(); } }
public static Result InsertKetQuaSieuAm(KetQuaSieuAm ketQuaSieuAm) { Result result = new Result(); MMOverride db = null; try { db = new MMOverride(); string desc = string.Empty; using (TransactionScope t = new TransactionScope(TransactionScopeOption.RequiresNew)) { //Insert if (ketQuaSieuAm.KetQuaSieuAmGUID == null || ketQuaSieuAm.KetQuaSieuAmGUID == Guid.Empty) { ketQuaSieuAm.KetQuaSieuAmGUID = Guid.NewGuid(); db.KetQuaSieuAms.InsertOnSubmit(ketQuaSieuAm); db.SubmitChanges(); //Tracking desc += string.Format("- GUID: '{0}', Ngày siêu âm: '{1}', Bệnh nhân: '{2}', Bác sĩ siêu âm: '{3}', Bác sĩ chỉ định: '{4}', Loại siêu âm: '{5}'", ketQuaSieuAm.KetQuaSieuAmGUID.ToString(), ketQuaSieuAm.NgaySieuAm.Value.ToString("dd/MM/yyyy HH:mm:ss"), ketQuaSieuAm.Patient.Contact.FullName, ketQuaSieuAm.BacSiSieuAmGUID.ToString(), ketQuaSieuAm.BacSiChiDinhGUID.ToString(), ketQuaSieuAm.LoaiSieuAm.TenSieuAm); Tracking tk = new Tracking(); tk.TrackingGUID = Guid.NewGuid(); tk.TrackingDate = DateTime.Now; tk.DocStaffGUID = Guid.Parse(Global.UserGUID); tk.ActionType = (byte)ActionType.Add; tk.Action = "Thêm kết quả siêu âm"; tk.Description = desc; tk.TrackingType = (byte)TrackingType.None; tk.ComputerName = Utility.GetDNSHostName(); db.Trackings.InsertOnSubmit(tk); db.SubmitChanges(); } else //Update { KetQuaSieuAm kqsa = db.KetQuaSieuAms.SingleOrDefault <KetQuaSieuAm>(k => k.KetQuaSieuAmGUID == ketQuaSieuAm.KetQuaSieuAmGUID); if (kqsa != null) { kqsa.NgaySieuAm = ketQuaSieuAm.NgaySieuAm; kqsa.PatientGUID = ketQuaSieuAm.PatientGUID; kqsa.BacSiSieuAmGUID = ketQuaSieuAm.BacSiSieuAmGUID; kqsa.BacSiChiDinhGUID = ketQuaSieuAm.BacSiChiDinhGUID; kqsa.LoaiSieuAmGUID = ketQuaSieuAm.LoaiSieuAmGUID; kqsa.LamSang = ketQuaSieuAm.LamSang; kqsa.KetQuaSieuAm1 = ketQuaSieuAm.KetQuaSieuAm1; kqsa.Hinh1 = ketQuaSieuAm.Hinh1; kqsa.Hinh2 = ketQuaSieuAm.Hinh2; kqsa.UpdatedBy = ketQuaSieuAm.UpdatedBy; kqsa.UpdatedDate = ketQuaSieuAm.UpdatedDate; kqsa.Status = ketQuaSieuAm.Status; db.SubmitChanges(); //Tracking desc += string.Format("- GUID: '{0}', Ngày siêu âm: '{1}', Bệnh nhân: '{2}', Bác sĩ siêu âm: '{3}', Bác sĩ chỉ định: '{4}', Loại siêu âm: '{5}'", kqsa.KetQuaSieuAmGUID.ToString(), kqsa.NgaySieuAm.Value.ToString("dd/MM/yyyy HH:mm:ss"), kqsa.Patient.Contact.FullName, kqsa.BacSiSieuAmGUID.ToString(), kqsa.BacSiChiDinhGUID.ToString(), kqsa.LoaiSieuAm.TenSieuAm); Tracking tk = new Tracking(); tk.TrackingGUID = Guid.NewGuid(); tk.TrackingDate = DateTime.Now; tk.DocStaffGUID = Guid.Parse(Global.UserGUID); tk.ActionType = (byte)ActionType.Edit; tk.Action = "Sửa kết quả siêu âm"; tk.Description = desc; tk.TrackingType = (byte)TrackingType.None; tk.ComputerName = Utility.GetDNSHostName(); db.Trackings.InsertOnSubmit(tk); db.SubmitChanges(); } } t.Complete(); } } catch (System.Data.SqlClient.SqlException se) { result.Error.Code = (se.Message.IndexOf("Timeout expired") >= 0) ? ErrorCode.SQL_QUERY_TIMEOUT : ErrorCode.INVALID_SQL_STATEMENT; result.Error.Description = se.ToString(); } catch (Exception e) { result.Error.Code = ErrorCode.UNKNOWN_ERROR; result.Error.Description = e.ToString(); } finally { if (db != null) { db.Dispose(); db = null; } } return(result); }
public static Result ChuyenBenhAn(string patientGUID, List <DataRow> rows) { Result result = new Result(); MMOverride db = null; try { db = new MMOverride(); using (TransactionScope t = new TransactionScope(TransactionScopeOption.RequiresNew)) { foreach (DataRow row in rows) { string ketQuaSieuAmGUID = row["KetQuaSieuAmGUID"].ToString(); KetQuaSieuAm ketQuaSieuAm = (from s in db.KetQuaSieuAms where s.KetQuaSieuAmGUID.ToString() == ketQuaSieuAmGUID select s).FirstOrDefault(); if (ketQuaSieuAm == null) { continue; } //Tracking string desc = string.Format("- KetQuaSieuAmGUID: '{0}': PatientGUID: '{1}' ==> '{2}' (KetQuaSieuAm)", ketQuaSieuAmGUID, ketQuaSieuAm.PatientGUID.ToString(), patientGUID); ketQuaSieuAm.PatientGUID = Guid.Parse(patientGUID); Tracking tk = new Tracking(); tk.TrackingGUID = Guid.NewGuid(); tk.TrackingDate = DateTime.Now; tk.DocStaffGUID = Guid.Parse(Global.UserGUID); tk.ActionType = (byte)ActionType.Edit; tk.Action = "Chuyển bệnh án"; tk.Description = desc; tk.TrackingType = (byte)TrackingType.None; tk.ComputerName = Utility.GetDNSHostName(); db.Trackings.InsertOnSubmit(tk); } db.SubmitChanges(); t.Complete(); } } catch (System.Data.SqlClient.SqlException se) { result.Error.Code = (se.Message.IndexOf("Timeout expired") >= 0) ? ErrorCode.SQL_QUERY_TIMEOUT : ErrorCode.INVALID_SQL_STATEMENT; result.Error.Description = se.ToString(); } catch (Exception e) { result.Error.Code = ErrorCode.UNKNOWN_ERROR; result.Error.Description = e.ToString(); } finally { if (db != null) { db.Dispose(); db = null; } } return(result); }
public static Result DeleteKetQuaSieuAm(List <String> keys) { Result result = new Result(); MMOverride db = null; try { db = new MMOverride(); using (TransactionScope t = new TransactionScope(TransactionScopeOption.RequiresNew)) { string desc = string.Empty; foreach (string key in keys) { KetQuaSieuAm kqsa = db.KetQuaSieuAms.SingleOrDefault <KetQuaSieuAm>(k => k.KetQuaSieuAmGUID.ToString() == key); if (kqsa != null) { kqsa.DeletedDate = DateTime.Now; kqsa.DeletedBy = Guid.Parse(Global.UserGUID); kqsa.Status = (byte)Status.Deactived; desc += string.Format("- GUID: '{0}', Ngày siêu âm: '{1}', Bệnh nhân: '{2}', Bác sĩ siêu âm: '{3}', Bác sĩ chỉ định: '{4}', Loại siêu âm: '{5}'\n", kqsa.KetQuaSieuAmGUID.ToString(), kqsa.NgaySieuAm.Value.ToString("dd/MM/yyyy HH:mm:ss"), kqsa.Patient.Contact.FullName, kqsa.BacSiSieuAmGUID.ToString(), kqsa.BacSiChiDinhGUID.ToString(), kqsa.LoaiSieuAm.TenSieuAm); } } //Tracking desc = desc.Substring(0, desc.Length - 1); Tracking tk = new Tracking(); tk.TrackingGUID = Guid.NewGuid(); tk.TrackingDate = DateTime.Now; tk.DocStaffGUID = Guid.Parse(Global.UserGUID); tk.ActionType = (byte)ActionType.Delete; tk.Action = "Xóa kết quả siêu âm"; tk.Description = desc; tk.TrackingType = (byte)TrackingType.None; tk.ComputerName = Utility.GetDNSHostName(); db.Trackings.InsertOnSubmit(tk); db.SubmitChanges(); t.Complete(); } } catch (System.Data.SqlClient.SqlException se) { result.Error.Code = (se.Message.IndexOf("Timeout expired") >= 0) ? ErrorCode.SQL_QUERY_TIMEOUT : ErrorCode.INVALID_SQL_STATEMENT; result.Error.Description = se.ToString(); } catch (Exception e) { result.Error.Code = ErrorCode.UNKNOWN_ERROR; result.Error.Description = e.ToString(); } finally { if (db != null) { db.Dispose(); db = null; } } return(result); }