using System; using System.Collections.Generic; using Datalib.EntityClasses; using System.Linq; using Datalib.HelperClasses; using DevExpress.XtraGrid.Views.Grid; using System.Drawing; using Datalib.Linq; using System.Windows.Forms; namespace PatientMan.Forms { public partial class frmExamWaitingList : PatientMan.BasicForms.frmCommon { private EntityCollection ExamInfo { get; set; } public EntityCollection WaitingList = new EntityCollection(); private hsphgrid focugrid; public frmExamWaitingList() { InitializeComponent(); } private void frmExamWaitingList_Load(object sender, EventArgs e) { xtraTabControl.SelectedTabPageIndex = 0; } private void gridViewExam_DoubleClick(object sender, EventArgs e) { string _PatientID; _PatientID = gridViewExam.GetFocusedRowCellValue(PatientId).ToString(); var frm = new frmPatientInfo(); frm.PatientsCollection = new EntityCollection(); var PatientInfo = new TblPatientEntity(_PatientID); adapter.FetchEntity(PatientInfo); frm.PatientsCollection.Add(PatientInfo); frm.PatientInfo = PatientInfo; frm.LoadData(); frm.gotoExam(); frm.ShowDialog(); } public override void LoadData() { var exams = new EntityCollection(); var patients = new EntityCollection(); var testcd4 = new EntityCollection(); var followup = new EntityCollection(); var referrals = new EntityCollection(); adapter.FetchEntityCollection(exams, null); adapter.FetchEntityCollection(patients, null); adapter.FetchEntityCollection(testcd4, null); adapter.FetchEntityCollection(followup, null); adapter.FetchEntityCollection(referrals, null); var res = (from element in exams group element by element.PatientId into groups select groups.OrderBy(p => p.ExamDate).Last()).ToList(); var prev = (from q in res join p in patients on q.PatientId equals p.PatientId where (q.EndExamDate == null && q.ReExamDate >= (DateTime)barBeginDate.EditValue && q.ReExamDate <= (DateTime)barEndDate.EditValue) select new { ARV = p.DateofArv != null ? true : false, p.TelephoneNo, p.PatientId, PatientName = strUtil.Decrypt(p.PatientName), q.ExamDate, q.ReExamDate, q.LateTimes }).ToList(); var cd4 = (from element in testcd4 where element.Testid == "01" group element by element.PatientId into groups select new { PatientId = groups.Key, maxCD4 = groups.Max(m => m.QuantityResult), lastCD4 = groups.Last().QuantityResult, firstCD4 = groups.First().QuantityResult, FirstTestDate = groups.OrderBy(m =>m.TestDate).First().TestDate, LastTestDate = groups.OrderBy(m =>m.TestDate).Last().TestDate } ).ToList(); var VL = (from element in testcd4 where element.Testid == "02" group element by element.PatientId into groups select new { PatientId = groups.Key, lastVL = groups.Last().QuantityResult, } ).ToList(); var folowInfo = (from q in followup group q by q.PatientId into groups select new { PatientId = groups.Key, FollowNum = groups.Count(), lastFolowResult = groups.LastOrDefault().Result }).ToList(); var preresult = (from p in prev join q in cd4 on p.PatientId equals q.PatientId into r from g in r.DefaultIfEmpty() select new { p.ARV, p.PatientId, p.TelephoneNo, p.PatientName, p.ExamDate, p.ReExamDate, FirstTestDate=(g==null)?null:g.FirstTestDate, LastTestDate= (g==null)?null:g.LastTestDate, CD4 = (g==null)?null:(g.LastTestDate != null ? (DateTime.Today - g.LastTestDate.Value).Days.ToString() : "N/A"), firstCD4=(g==null)?null:g.firstCD4, maxCD4=(g==null)?null:g.maxCD4, lastCD4=(g==null)?null:g.lastCD4, TreatmentDays = (g == null) ? 0 : ((DateTime)barEndDate.EditValue - g.FirstTestDate.Value).Days, Warning1 = (g == null) ? false : (((DateTime)barEndDate.EditValue - g.FirstTestDate.Value).Days > 365 && g.lastCD4 < 100 ? true : false), Warning2 = (g == null) ? false : (g.lastCD4 < g.maxCD4 / 2 ? true : false), Warning3 = (g == null) ? false : (g.lastCD4 < g.firstCD4 ? true : false), LateTimes = p.LateTimes }).ToList(); var result1 = (from p in preresult join q in folowInfo on p.PatientId equals q.PatientId into g from m in g.DefaultIfEmpty() select new { p.ARV, p.PatientId, p.TelephoneNo, p.PatientName, p.ExamDate, p.ReExamDate, p.FirstTestDate, p.LastTestDate, p.CD4, p.firstCD4, p.maxCD4, p.lastCD4, p.TreatmentDays, p.Warning1, p.Warning2, p.Warning3, p.LateTimes, FollowNum = (m == null) ? 0 : m.FollowNum, LastFollowResult = (m == null) ? null : m.lastFolowResult } ).ToList(); var result = (from p in result1 join q in VL on p.PatientId equals q.PatientId into g from m in g.DefaultIfEmpty() select new { p.ARV, p.PatientId, p.TelephoneNo, p.PatientName, p.ExamDate, p.ReExamDate, p.FirstTestDate, p.LastTestDate, p.CD4, p.firstCD4, p.maxCD4, p.lastCD4, p.TreatmentDays, p.Warning1, p.Warning2, p.Warning3, p.LateTimes, p.FollowNum, p.LastFollowResult, vl = (m == null) ? null : m.lastVL } ).ToList(); grdIndaysExams.DataSource = result; grdIndaysExams.Patients = result.Select(q => q.PatientId).ToList(); } public void GetToDayExamPatientList() { var exams = new EntityCollection(); var patients = new EntityCollection(); var Follows = new EntityCollection(); var referrals = new EntityCollection(); DateTime Today = DateTime.Today; adapter.FetchEntityCollection(referrals, null); adapter.FetchEntityCollection(exams, null); adapter.FetchEntityCollection(patients, null); adapter.FetchEntityCollection(Follows, null); LinqMetaData meta = new LinqMetaData(adapter); var exclusive = (from q in referrals select q.PatientId).ToList(); var folowInfo = Follows.GroupBy(m => m.PatientId).Select(g => new { PatientId = g.Key, FollowNum = g.Count(), lastFolowResult = g.OrderBy(q => q.EventDate).Last().Result }).ToList(); var res = (from element in exams orderby element.ExamDate group element by element.PatientId into groups select groups.OrderBy(p => p.ExamDate).Last()).Where(p=>p.EndExamDate==null).ToList(); var prev = (from q in res join p in patients on q.PatientId equals p.PatientId where ( q.ReExamDate != null && ((Today - q.ReExamDate.Value).Days >= 0) && (Today - q.ReExamDate.Value).Days > 0 && ((Today - q.ReExamDate.Value).Days <= (p.DateofArv != null ? 90 : 180))) select new { ARV = p.DateofArv != null ? true : false, p.PatientId, PatientName = strUtil.Decrypt(p.PatientName), p.TelephoneNo, q.ExamDate, q.ReExamDate, Status = (Today - q.ReExamDate.Value).Days, LateTimes = q.LateTimes }).ToList(); var result = (from q in prev join p in folowInfo on q.PatientId equals p.PatientId into g from m in g.DefaultIfEmpty() select new { q.ARV, q.PatientId, q.PatientName, q.TelephoneNo, q.ExamDate, q.ReExamDate, q.Status, FollowNum = (m == null) ? "N/A" : m.FollowNum.ToString(), lastFolowResult = (m == null) ? "0" : m.lastFolowResult, q.LateTimes }).ToList(); this.grdWaitingClients.DataSource = result; //WaitingList.Clear(); //adapter.FetchEntityCollection(WaitingList, null); //adapter.DeleteEntityCollection(WaitingList); //foreach (var g in result) //{ // TblWaitingListEntity w = new TblWaitingListEntity(); // w.PatientId = g.PatientId; // w.PatientName = g.PatientName; // w.ReExamDate = g.ReExamDate; // w.FollowNum = g.FollowNum; // w.LastFolowResult = g.lastFolowResult; // w.LateTimes = g.LateTimes; // w.TelephoneNo = g.TelephoneNo; // w.Status = g.Status.ToString(); // w.Selected = false; // w.Arv = g.ARV; // adapter.SaveEntity(w, true, true); //} } private void barSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (xtraTabControl.SelectedTabPageIndex == 0) { LoadData(); } else { LoadDataExam(); } } private void gridItervalView_DoubleClick(object sender, EventArgs e) { string _PatientID; _PatientID = gridItervalView.GetFocusedRowCellValue(PatientId).ToString(); var frm = new frmPatientInfo(); frm.PatientsCollection = new EntityCollection(); var PatientInfo = new TblPatientEntity(_PatientID); adapter.FetchEntity(PatientInfo); frm.PatientsCollection.Add(PatientInfo); frm.PatientInfo = PatientInfo; frm.LoadData(); frm.gotoExam(); frm.ShowDialog(); } private void FillLostFollowUp() { var exams = new EntityCollection(); var patients = new EntityCollection(); DateTime thisToday = DateTime.Today; adapter.FetchEntityCollection(exams, null); adapter.FetchEntityCollection(patients, null); var presult = (from element in exams group element by element.PatientId into groups select groups.OrderBy(p => p.ExamDate).Last()).ToList(); var result = (from q in presult join p in patients on q.PatientId equals p.PatientId where (q.EndExamDate == null && q.ReExamDate != null && ((thisToday - q.ReExamDate.Value).Days >= 0) && (thisToday - q.ReExamDate.Value).Days > 0 && ((thisToday - q.ReExamDate.Value).Days > (p.DateofArv != null ? 90 : 180))) select new { ARV = p.DateofArv != null ? true : false, p.PatientId, PatientName = strUtil.Decrypt(p.PatientName), p.Sex, p.BirthYear, p.TelephoneNo }).ToList(); grdLostClients.DataSource = result; grdLostClients.Patients = result.Select(q => q.PatientId).ToList(); grdLostClients.Enabled = true; } private void barLoadToDay_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { GetToDayExamPatientList(); LoadData(); } public void LoadWaitingList() { var patients = new EntityCollection(); adapter.FetchEntityCollection(patients, null); WaitingList.Clear(); adapter.FetchEntityCollection(WaitingList, null); this.grdWaitingClients.DataSource = null; this.grdWaitingClients.DataSource = WaitingList.Join(patients, p => p.PatientId, q => q.PatientId, (p, q) => new { p.PatientId, PatientName = strUtil.Decrypt(p.PatientName), p.ReExamDate, p.FollowNum, p.LastFolowResult, p.LateTimes, p.TelephoneNo, p.Status, p.Selected, p.Arv, q.SupporterInfo }).ToList(); grdWaitingClients.Patients = WaitingList.Select(q => q.PatientId).ToList(); } public void FirstLoad() { LoadData(); GetToDayExamPatientList(); FillLostFollowUp(); } private void xtraTabControl_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { switch (xtraTabControl.SelectedTabPageIndex) { case 1: this.barLoadToDay.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barExamList.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barTransfer.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barBeginDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientId.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientName.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndTreat.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; focugrid = (hsphgrid)grdWaitingClients; break; case 0: this.barLoadToDay.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barExamList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barTransfer.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barBeginDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barEndDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barEndTreat.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientId.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientName.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndTreat.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; focugrid = (hsphgrid)grdIndaysExams; break; case 2: this.barExamList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barLoadToDay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barTransfer.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barBeginDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientId.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientName.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndTreat.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; focugrid = (hsphgrid)grdLostClients; break; case 3: this.barExamList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barLoadToDay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barTransfer.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barBeginDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barEndTreat.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientId.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barPatientName.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barPatientSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; focugrid = (hsphgrid)grdPatientSearch; break; case 4: this.barLoadToDay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barExamList.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barTransfer.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barBeginDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barEndDate.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barFilter.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; this.barEndTreat.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientId.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientName.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; this.barPatientSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; focugrid = (hsphgrid)this.grdInterExam; break; } } private void frmExamWaitingList_FormClosing(object sender, FormClosingEventArgs e) { this.BindingContext[WaitingList].EndCurrentEdit(); adapter.SaveEntityCollection(WaitingList,true,true); } private void LostFollowupEnd() { for (int i = 0; i < gridLostView.DataRowCount; i++) { string Patientid = gridLostView.GetRowCellValue(i, colPatientId).ToString(); var ARV = (Boolean)gridLostView.GetRowCellValue(i, colLostArv); LinqMetaData metadata = new LinqMetaData(); metadata.AdapterToUse = adapter; DateTime EndDate = ARV == true ? metadata.TblExaminationInfo.Where(m => m.PatientId == Patientid).OrderByDescending(m => m.ExamDate).First().ReExamDate.Value.AddMonths(3) : metadata.TblExaminationInfo.Where(m => m.PatientId == Patientid).OrderByDescending(m => m.ExamDate).First().ReExamDate.Value.AddMonths(6); if (metadata.TblTreatmentInfo.Where(m => m.PatientId == Patientid).Where(m => m.TreatmentId == "01").Count() > 0) { string Unique = metadata.TblTreatmentInfo.Where(m => m.PatientId == Patientid).Where(m => m.TreatmentId == "01").OrderByDescending(m => m.TreatmentSdate).First().UniqueKey; TblTreatmentInfoEntity TreatmentInfo = new TblTreatmentInfoEntity(Unique); adapter.FetchEntity(TreatmentInfo); TreatmentInfo.TreatmentEdate = EndDate; TreatmentInfo.ReasonId = "10"; adapter.SaveEntity(TreatmentInfo); } if (metadata.TblExaminationInfo.Where(m => m.PatientId == Patientid).Count() > 0) { string Unique = metadata.TblExaminationInfo.Where(m => m.PatientId == Patientid).OrderByDescending(m => m.ExamDate).First().UniqueKey; TblExaminationInfoEntity Exam = new TblExaminationInfoEntity(Unique); adapter.FetchEntity(Exam); Exam.EndExamDate = EndDate; Exam.ReasonEnd = "10"; adapter.SaveEntity(Exam); } if (metadata.TblReferralsTo.Where(m => m.PatientId == Patientid).Where(m => m.EndDate.Value == EndDate).Where(m => m.TypeId == "2").Count() == 0) { TblReferralsToEntity Referral = new TblReferralsToEntity(Guid.NewGuid().ToString("N")); adapter.FetchEntity(Referral); Referral.EndDate = EndDate; Referral.PatientId = Patientid; Referral.TypeId = "10"; adapter.SaveEntity(Referral); } } } private void barPatientSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { LinqMetaData metadata = new LinqMetaData(); metadata.AdapterToUse = adapter; EntityCollection Patients = new EntityCollection(); adapter.FetchEntityCollection(Patients, null); try { if (this.barPatientId.EditValue!=null && this.barPatientId.EditValue.ToString() != "") { var q = this.barPatientId.EditValue; var result = Patients.Where(m => m.PatientId.Contains(q.ToString())).ToList(); foreach(var r in result) { r.PatientName = strUtil.Decrypt(r.PatientName); } this.grdPatientSearch.DataSource = result; return; } if (this.barPatientName.EditValue.ToString() != string.Empty) { var q = this.barPatientName.EditValue; var result = Patients.Where(m => strUtil.Decrypt(m.PatientName).Contains(q.ToString())).ToList(); foreach (var r in result) { r.PatientName = strUtil.Decrypt(r.PatientName); } this.grdPatientSearch.DataSource = result; return; } } catch(Exception er) { MessageBox.Show(er.Message); } } private void gridClientSearchView_DoubleClick(object sender, EventArgs e) { string _PatientID; _PatientID = gridClientSearchView.GetFocusedRowCellValue(SearchPatientId).ToString(); var frm = new frmPatientInfo(); frm.PatientsCollection = new EntityCollection(); var PatientInfo = new TblPatientEntity(_PatientID); adapter.FetchEntity(PatientInfo); frm.PatientsCollection.Add(PatientInfo); frm.PatientInfo = PatientInfo; frm.LoadData(); frm.gotoExam(); frm.ShowDialog(); } private void gridView_DoubleClick(object sender, EventArgs e) { string _PatientID = ""; _PatientID = gridLostView.GetFocusedRowCellValue(colPatientId).ToString(); var frm = new frmPatientInfo(); frm.PatientsCollection = new EntityCollection(); var PatientInfo = new TblPatientEntity(_PatientID); adapter.FetchEntity(PatientInfo); frm.PatientsCollection.Add(PatientInfo); frm.PatientInfo = PatientInfo; frm.LoadData(); frm.gotoExam(); frm.ShowDialog(); } public void LoadDataExam() { var exams = new EntityCollection(); var patients = new EntityCollection(); var testcd4 = new EntityCollection(); var followup = new EntityCollection(); var referrals = new EntityCollection(); adapter.FetchEntityCollection(exams, null); adapter.FetchEntityCollection(patients, null); adapter.FetchEntityCollection(testcd4, null); adapter.FetchEntityCollection(followup, null); adapter.FetchEntityCollection(referrals, null); var prev = (from q in exams join p in patients on q.PatientId equals p.PatientId where (q.ExamDate >= (DateTime)barBeginDate.EditValue && q.ExamDate <= (DateTime)barEndDate.EditValue) select new { ARV = p.DateofArv != null ? true : false, p.TelephoneNo, p.PatientId, PatientName = strUtil.Decrypt(p.PatientName), q.ExamDate, q.ReExamDate, q.LateTimes }).ToList(); var cd4 = (from element in testcd4 where element.Testid == "01" group element by element.PatientId into groups select new { PatientId = groups.Key, maxCD4 = groups.Max(m => m.QuantityResult), lastCD4 = groups.Last().QuantityResult, firstCD4 = groups.First().QuantityResult, FirstTestDate = groups.OrderBy(m => m.TestDate).First().TestDate, LastTestDate = groups.OrderBy(m => m.TestDate).Last().TestDate } ).ToList(); var VL = (from element in testcd4 where element.Testid == "02" group element by element.PatientId into groups select new { PatientId = groups.Key, lastVL = groups.Last().QuantityResult, } ).ToList(); var folowInfo = (from q in followup group q by q.PatientId into groups select new { PatientId = groups.Key, FollowNum = groups.Count(), lastFolowResult = groups.LastOrDefault().Result }).ToList(); var preresult = (from p in prev join q in cd4 on p.PatientId equals q.PatientId into r from g in r.DefaultIfEmpty() select new { p.ARV, p.PatientId, p.TelephoneNo, p.PatientName, p.ExamDate, p.ReExamDate, FirstTestDate = (g == null) ? null : g.FirstTestDate, LastTestDate = (g == null) ? null : g.LastTestDate, CD4 = (g == null) ? null : (g.LastTestDate != null ? (DateTime.Today - g.LastTestDate.Value).Days.ToString() : "N/A"), firstCD4 = (g == null) ? null : g.firstCD4, maxCD4 = (g == null) ? null : g.maxCD4, lastCD4 = (g == null) ? null : g.lastCD4, TreatmentDays = (g == null) ? 0 : ((DateTime)barEndDate.EditValue - g.FirstTestDate.Value).Days, Warning1 = (g == null) ? false : (((DateTime)barEndDate.EditValue - g.FirstTestDate.Value).Days > 365 && g.lastCD4 < 100 ? true : false), Warning2 = (g == null) ? false : (g.lastCD4 < g.maxCD4 / 2 ? true : false), Warning3 = (g == null) ? false : (g.lastCD4 < g.firstCD4 ? true : false), LateTimes = p.LateTimes }).ToList(); var result1 = (from p in preresult join q in folowInfo on p.PatientId equals q.PatientId into g from m in g.DefaultIfEmpty() select new { p.ARV, p.PatientId, p.TelephoneNo, p.PatientName, p.ExamDate, p.ReExamDate, p.FirstTestDate, p.LastTestDate, p.CD4, p.firstCD4, p.maxCD4, p.lastCD4, p.TreatmentDays, p.Warning1, p.Warning2, p.Warning3, p.LateTimes, FollowNum = (m == null) ? 0 : m.FollowNum, LastFollowResult = (m == null) ? null : m.lastFolowResult } ).ToList(); var result = (from p in result1 join q in VL on p.PatientId equals q.PatientId into g from m in g.DefaultIfEmpty() select new { p.ARV, p.PatientId, p.TelephoneNo, p.PatientName, p.ExamDate, p.ReExamDate, p.FirstTestDate, p.LastTestDate, p.CD4, p.firstCD4, p.maxCD4, p.lastCD4, p.TreatmentDays, p.Warning1, p.Warning2, p.Warning3, p.LateTimes, p.FollowNum, p.LastFollowResult, vl = (m == null) ? null : m.lastVL } ).ToList(); grdInterExam.DataSource = result; grdInterExam.Patients = result.Select(q => q.PatientId).ToList(); } private void barEndTreat_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MessageBox.Show("Bạn chắc chắn liệt các bệnh nhân trên trong danh sách vào đối tượng mất dấu", "Khẳng định mất dấu", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { LostFollowupEnd(); FillLostFollowUp(); } } private void grdInterExam_Click(object sender, EventArgs e) { focugrid = (hsphgrid) sender; } private void barEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { string _PatientID; _PatientID = ((GridView)this.focugrid.MainView).GetFocusedRowCellValue(PatientId).ToString(); var frm = new frmPatientInfo(); frm.PatientsCollection = new EntityCollection(); var PatientInfo = new TblPatientEntity(_PatientID); adapter.FetchEntity(PatientInfo); frm.PatientsCollection.Add(PatientInfo); frm.PatientInfo = PatientInfo; frm.LoadData(); frm.gotoExam(); frm.ShowDialog(); } private void grdWaitintClients_Click(object sender, EventArgs e) { focugrid = (hsphgrid)sender; } private void grdLostClients_Click(object sender, EventArgs e) { focugrid = (hsphgrid)sender; } private void grdPatientSearch_Click(object sender, EventArgs e) { focugrid = (hsphgrid)sender; } private void grdIndaysExams_Click(object sender, EventArgs e) { focugrid = (hsphgrid)sender; } } }