public PatientTableSource FilterTable(UISearchBar searchBar,List<ProcedureItemGroup> sentTableItems,PatientListView patListControllerObj) { PatientTableSource tableSource; List<ProcedureItemGroup> filteredTableItems = new List<ProcedureItemGroup> (); ProcedureItemGroup tGroup; List<PatientProcedureDetails> inCompleteCases = new List<PatientProcedureDetails>(); List<PatientProcedureDetails> scheduledCases = new List<PatientProcedureDetails>(); List<PatientProcedureDetails> inProcessCases = new List<PatientProcedureDetails>(); List<PatientProcedureDetails> completedCases = new List<PatientProcedureDetails>(); List<PatientProcedureDetails> cancelledCases = new List<PatientProcedureDetails>(); if (searchBar.SelectedScopeButtonIndex == 0) { inCompleteCases = sentTableItems [0].PatientProcedureListItems.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); scheduledCases = sentTableItems [1].PatientProcedureListItems.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); inProcessCases = sentTableItems [2].PatientProcedureListItems.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); completedCases = sentTableItems [3].PatientProcedureListItems.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); cancelledCases = sentTableItems [4].PatientProcedureListItems.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); } if (searchBar.SelectedScopeButtonIndex == 1) { inCompleteCases = sentTableItems [0].PatientProcedureListItems.FindAll (x => x.surgeon != null && x.surgeon.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); scheduledCases = sentTableItems [1].PatientProcedureListItems.FindAll (x => x.surgeon != null && x.surgeon.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); inProcessCases = sentTableItems [2].PatientProcedureListItems.FindAll (x => x.surgeon != null && x.surgeon.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); completedCases = sentTableItems [3].PatientProcedureListItems.FindAll (x => x.surgeon != null && x.surgeon.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); cancelledCases = sentTableItems [4].PatientProcedureListItems.FindAll (x => x.surgeon != null && x.surgeon.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); } if (searchBar.SelectedScopeButtonIndex == 2) { inCompleteCases = sentTableItems [0].PatientProcedureListItems.FindAll (x => x.Anestheologist!=null && x.Anestheologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower())); scheduledCases = sentTableItems [1].PatientProcedureListItems.FindAll (x => x.Anestheologist!=null && x.Anestheologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower())); inProcessCases = sentTableItems [2].PatientProcedureListItems.FindAll (x => x.Anestheologist!=null && x.Anestheologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower())); completedCases = sentTableItems [3].PatientProcedureListItems.FindAll (x => x.Anestheologist!=null && x.Anestheologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower())); cancelledCases = sentTableItems [4].PatientProcedureListItems.FindAll (x => x.Anestheologist!=null && x.Anestheologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower())); } if (searchBar.SelectedScopeButtonIndex == 3 && !string.IsNullOrEmpty(iProPQRSPortableLib.Consts.mId)) { //NAHID Ahmed, July 23, 2015 //Need to discuss with Anand and get details related to Anesthesiologist1,2,3,4 and //CRNA1,2,3,4 and SRNA1 } if (searchBar.SelectedScopeButtonIndex == 3 ) { // inCompleteCases = sentTableItems [0].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); // scheduledCases = sentTableItems [1].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); // inProcessCases = sentTableItems [2].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); // completedCases = sentTableItems [3].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); // cancelledCases = sentTableItems [4].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ())); // string anestheologist = string.Empty; // if (iProPQRSPortableLib.Consts.LoginUserFullName.Trim () != string.Empty) { // string[] anesArr = iProPQRSPortableLib.Consts.LoginUserFullName.Split (','); // if(anesArr.Length > 1) // anestheologist = anesArr [1].Trim().ToLower() + " " + anesArr [0].Trim().ToLower(); // } // inCompleteCases = sentTableItems [0].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (anestheologist)); // scheduledCases = sentTableItems [1].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (anestheologist)); // inProcessCases = sentTableItems [2].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (anestheologist)); // completedCases = sentTableItems [3].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (anestheologist)); // cancelledCases = sentTableItems [4].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null && x.Anestheologist.Trim ().ToLower ().Contains (anestheologist)); inCompleteCases = sentTableItems [0].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null); scheduledCases = sentTableItems [1].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null); inProcessCases = sentTableItems [2].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null); completedCases = sentTableItems [3].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null); cancelledCases = sentTableItems [4].PatientProcedureListItems.FindAll (x => x.IsMyCase == true && x.Anestheologist!=null); } tGroup = new ProcedureItemGroup () { StatusName="Incomplete Cases" }; foreach (PatientProcedureDetails filtereditem in inCompleteCases) { tGroup.PatientProcedureListItems.Add (filtereditem); } filteredTableItems.Add (tGroup); tGroup = new ProcedureItemGroup () { StatusName="Scheduled Cases" }; foreach (PatientProcedureDetails filtereditem in scheduledCases) { tGroup.PatientProcedureListItems.Add (filtereditem); } filteredTableItems.Add (tGroup); tGroup = new ProcedureItemGroup () { StatusName="Inprocess Cases" }; foreach (PatientProcedureDetails filtereditem in inProcessCases) { tGroup.PatientProcedureListItems.Add (filtereditem); } filteredTableItems.Add (tGroup); tGroup = new ProcedureItemGroup () { StatusName="Completed Cases" }; foreach (PatientProcedureDetails filtereditem in completedCases) { tGroup.PatientProcedureListItems.Add (filtereditem); } filteredTableItems.Add (tGroup); tGroup = new ProcedureItemGroup () { StatusName="Cancelled Cases" }; foreach (PatientProcedureDetails filtereditem in cancelledCases) { tGroup.PatientProcedureListItems.Add (filtereditem); } filteredTableItems.Add (tGroup); tableSource = new PatientTableSource (filteredTableItems, patListControllerObj); return tableSource; }
protected void PopulateTableItems() { procTableItems = new List<ProcedureItemGroup> (); ProcedureItemGroup tGroup = new ProcedureItemGroup (); tGroup.StatusName = "Incomplete Cases"; if (iProPQRSPortableLib.Consts.PatientInfo.result != null) { List<PatientProcedureDetails> inCompleteCases = iProPQRSPortableLib.Consts.PatientInfo.result.FindAll ((PatientProcedureDetails obj) => obj.Status == "Incomplete"); foreach (PatientProcedureDetails patDet in inCompleteCases) { patDet.PatientName = patDet.LastName + ", " + patDet.FirstName; tGroup.PatientProcedureListItems.Add (patDet); } procTableItems.Add (tGroup); tGroup = new ProcedureItemGroup (); tGroup.StatusName = "Scheduled Cases"; List<PatientProcedureDetails> scheduledCases = iProPQRSPortableLib.Consts.PatientInfo.result.FindAll ((PatientProcedureDetails obj) => obj.Status == "Scheduled"); foreach (PatientProcedureDetails patDet in scheduledCases) { patDet.PatientName = patDet.LastName + ", " + patDet.FirstName; tGroup.PatientProcedureListItems.Add (patDet); } procTableItems.Add (tGroup); tGroup = new ProcedureItemGroup (); tGroup.StatusName = "In Process Cases"; List<PatientProcedureDetails> inProcessCases = iProPQRSPortableLib.Consts.PatientInfo.result.FindAll ((PatientProcedureDetails obj) => obj.Status == "In Process"); foreach (PatientProcedureDetails patDet in inProcessCases) { patDet.PatientName = patDet.LastName + ", " + patDet.FirstName; tGroup.PatientProcedureListItems.Add (patDet); } } procTableItems.Add (tGroup); tGroup = new ProcedureItemGroup (); tGroup.StatusName = "Completed Cases"; List<PatientProcedureDetails> completedCases = iProPQRSPortableLib.Consts.PatientInfo.result.FindAll ((PatientProcedureDetails obj) => obj.Status == "Completed"); foreach (PatientProcedureDetails patDet in completedCases) { patDet.PatientName = patDet.LastName + ", " + patDet.FirstName; tGroup.PatientProcedureListItems.Add (patDet); } procTableItems.Add (tGroup); tGroup = new ProcedureItemGroup (); tGroup.StatusName = "Cancelled Cases"; List<PatientProcedureDetails> cancelledCases = iProPQRSPortableLib.Consts.PatientInfo.result.FindAll ((PatientProcedureDetails obj) => obj.Status == "Cancelled"); foreach (PatientProcedureDetails patDet in cancelledCases) { patDet.PatientName = patDet.LastName + ", " + patDet.FirstName; tGroup.PatientProcedureListItems.Add (patDet); } procTableItems.Add (tGroup); tableSource = new PatientTableSource (procTableItems,this); }