private void OnDisplayLoiKhuyenList() { Result result = LoiKhuyenBus.GetLoiKhuyenList(_patientGUID, _fromDate, _toDate); if (result.IsOK) { MethodInvoker method = delegate { ClearData(); dgLoiKhuyen.DataSource = result.QueryResult; }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("LoiKhuyenBus.GetLoiKhuyenList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LoiKhuyenBus.GetLoiKhuyenList")); } }
private void OnChuyenKetQuaKham() { if (!_isChuyenBenhAn) { return; } List <DataRow> deletedRows = new List <DataRow>(); DataTable dt = dgLoiKhuyen.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedRows.Add(row); } } if (dgLoiKhuyen.RowCount <= 0 || deletedRows == null || deletedRows.Count <= 0) { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu ít nhất 1 lời khuyên cần chuyển.", IconType.Information); return; } if (_patientRow2 == null) { MsgBox.Show(Application.ProductName, "Vui lòng chọn bệnh nhân nhận lời khuyên chuyển đến.", IconType.Information); return; } string fileNum = _patientRow2["FileNum"].ToString(); if (MsgBox.Question(Application.ProductName, string.Format("Bạn có muốn chuyển những lời khuyên đã chọn đến bệnh nhân: '{0}'?", fileNum)) == DialogResult.No) { return; } Result result = LoiKhuyenBus.ChuyenBenhAn(_patientRow2["PatientGUID"].ToString(), deletedRows); if (result.IsOK) { DisplayAsThread(); } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("LoiKhuyenBus.ChuyenBenhAn"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LoiKhuyenBus.ChuyenBenhAn")); } }
private void OnSaveInfo() { try { if (_isNew) { _loiKhuyen.CreatedDate = DateTime.Now; _loiKhuyen.CreatedBy = Guid.Parse(Global.UserGUID); } else { _loiKhuyen.UpdatedDate = DateTime.Now; _loiKhuyen.UpdatedBy = Guid.Parse(Global.UserGUID); } _loiKhuyen.PatientGUID = Guid.Parse(_patientGUID); MethodInvoker method = delegate { _loiKhuyen.Ngay = dtpkNgay.Value; _loiKhuyen.DocStaffGUID = Guid.Parse(cboDocStaff.SelectedValue.ToString()); _loiKhuyen.SymptomGUID = Guid.Parse(cboTrieuChung.SelectedValue.ToString()); Result result = LoiKhuyenBus.InsertLoiKhuyen(_loiKhuyen); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("LoiKhuyenBus.InsertLoiKhuyen"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LoiKhuyenBus.InsertLoiKhuyen")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } catch (Exception e) { MsgBox.Show(this.Text, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }
private void OnSaveInfo() { try { MethodInvoker method = delegate { List <string> checkedSympList = GetCheckedSymptomList(); foreach (string symptomGUID in checkedSympList) { LoiKhuyen loiKhuyen = new LoiKhuyen(); loiKhuyen.CreatedDate = DateTime.Now; loiKhuyen.CreatedBy = Guid.Parse(Global.UserGUID); loiKhuyen.PatientGUID = Guid.Parse(_patientGUID); loiKhuyen.Ngay = dtpkNgay.Value; loiKhuyen.DocStaffGUID = Guid.Parse(cboDocStaff.SelectedValue.ToString()); loiKhuyen.SymptomGUID = Guid.Parse(symptomGUID); Result result = LoiKhuyenBus.InsertLoiKhuyen(loiKhuyen); if (!result.IsOK) { MsgBox.Show(this.Text, result.GetErrorAsString("LoiKhuyenBus.InsertLoiKhuyen"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LoiKhuyenBus.InsertLoiKhuyen")); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; break; } } }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } catch (Exception e) { MsgBox.Show(this.Text, e.Message, IconType.Error); Utility.WriteToTraceLog(e.Message); } }
private void OnDelete() { List <string> deletedLoiKhuyenList = new List <string>(); List <DataRow> deletedRows = new List <DataRow>(); DataTable dt = dgLoiKhuyen.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedLoiKhuyenList.Add(row["LoiKhuyenGUID"].ToString()); deletedRows.Add(row); } } if (deletedLoiKhuyenList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn xóa những lời khuyên mà bạn đã đánh dấu ?") == DialogResult.Yes) { Result result = LoiKhuyenBus.DeleteLoiKhuyen(deletedLoiKhuyenList); if (result.IsOK) { foreach (DataRow row in deletedRows) { dt.Rows.Remove(row); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("LoiKhuyenBus.DeleteLoiKhuyen"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("LoiKhuyenBus.DeleteLoiKhuyen")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những lời khuyên.", IconType.Information); } }