private void OnRaPhongCho() { List <string> deletedPhongChoList = new List <string>(); DataTable dt = dgPatient.DataSource as DataTable; foreach (DataRow row in dt.Rows) { if (Boolean.Parse(row["Checked"].ToString())) { deletedPhongChoList.Add(row["PhongChoGUID"].ToString()); } } if (deletedPhongChoList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn cho những bệnh nhân đã đánh dấu ra khỏi phòng chờ ?") == DialogResult.Yes) { Result result = PhongChoBus.DeletePhongCho(deletedPhongChoList); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PhongChoBus.DeletePhongCho"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PhongChoBus.DeletePhongCho")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những bệnh nhân ra khỏi phòng chờ.", IconType.Information); } }
private void OnVaoPhongCho() { List <string> addedPatientList = new List <string>(); foreach (DataRow row in _dictPatient.Values.ToList()) { string patientGUID = row["PatientGUID"].ToString(); addedPatientList.Add(patientGUID); } if (addedPatientList.Count > 0) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn thêm những bệnh nhân đã đánh dấu vào phòng chờ ?") == DialogResult.Yes) { Result result = PhongChoBus.AddPhongCho(addedPatientList); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PhongChoBus.AddPhongCho"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PhongChoBus.AddPhongCho")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng đánh dấu những bệnh nhân cần đưa vào phòng chờ.", IconType.Information); } }
private void OnDisplayPhongChoList() { Result result = PhongChoBus.GetPhongChoList(); if (result.IsOK) { MethodInvoker method = delegate { DataTable dt = dgPatient.DataSource as DataTable; if (dt == null) { dgPatient.DataSource = result.QueryResult; } else { int selectedIndex = 0; if (dgPatient.SelectedRows != null && dgPatient.SelectedRows.Count > 0) { selectedIndex = dgPatient.SelectedRows[0].Index; } DataTable dt2 = result.QueryResult as DataTable; foreach (DataRow row in dt2.Rows) { string patientGUID = row["PatientGUID"].ToString(); DataRow[] rows = dt.Select(string.Format("PatientGUID='{0}'", patientGUID)); if (rows != null && rows.Length > 0) { row["Checked"] = rows[0]["Checked"]; } } ClearData(); dgPatient.DataSource = dt2; if (selectedIndex <= dgPatient.RowCount - 1) { dgPatient.CurrentCell = dgPatient[1, selectedIndex]; dgPatient.Rows[selectedIndex].Selected = true; } } RefreshNo(); }; if (InvokeRequired) { BeginInvoke(method); } else { method.Invoke(); } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PhongChoBus.GetPhongChoList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PhongChoBus.GetPhongChoList")); } }
private void OnVaoPhongCho() { _patientRow = _uSearchPatient.PatientRow; if (_patientRow != null) { if (MsgBox.Question(Application.ProductName, "Bạn có muốn thêm bệnh nhân đã chọn vào phòng chờ ?") == DialogResult.Yes) { List <string> addedPatientList = new List <string>(); addedPatientList.Add(((DataRow)_patientRow)["PatientGUID"].ToString()); Result result = PhongChoBus.AddPhongCho(addedPatientList); if (!result.IsOK) { MsgBox.Show(Application.ProductName, result.GetErrorAsString("PhongChoBus.AddPhongCho"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("PhongChoBus.AddPhongCho")); } } } else { MsgBox.Show(Application.ProductName, "Vui lòng chọn bệnh nhân mà bạn muốn đưa vào phòng chờ.", IconType.Information); } }