Example #1
0
        public List<PatientItemGroup> Gettab2Surgeon(RootObject rootObj)
        {
            List<PatientItemGroup> tableItems = new List<PatientItemGroup> ();

            // declare vars
            PatientItemGroup tGroup = new PatientItemGroup();
            tGroup.Name = "Incomplete Cases";
            if (rootObj.Patients.IncompleteCases != null) {
                foreach (IncompleteCases inCompleteCase in rootObj.Patients.IncompleteCases.FindAll(u=>u.Surgeon!=null || u.Surgeon2!=null|| u.Surgeon3!=null)) {
                    tGroup.ListItems.Add (inCompleteCase);
                }
            }
            tableItems.Add (tGroup);

            PatientItemGroup tGroup2 = new PatientItemGroup();
            tGroup2.Name = "Scheduled Cases";
            if (rootObj.Patients.ScheduledCases != null) {
                foreach (ScheduledCases scheduledCase in rootObj.Patients.ScheduledCases.FindAll(u=>u.Surgeon!=null || u.Surgeon2!=null|| u.Surgeon3!=null)) {
                    tGroup2.ListItems.Add (scheduledCase);
                }
            }
            tableItems.Add (tGroup2);

            PatientItemGroup tGroup3 = new PatientItemGroup();
            tGroup3.Name = "In Process Cases";
            if (rootObj.Patients.InProcessCases != null) {
                foreach (InProcessCases inProcessCase in rootObj.Patients.InProcessCases.FindAll(u=>u.Surgeon!=null || u.Surgeon2!=null|| u.Surgeon3!=null)) {
                    tGroup3.ListItems.Add (inProcessCase);
                }
            }
            tableItems.Add (tGroup3);

            PatientItemGroup tGroup4 = new PatientItemGroup();
            tGroup4.Name = "Completed Cases";
            if (rootObj.Patients.CompletedCases != null) {
                foreach (CompletedCases completeCase in rootObj.Patients.CompletedCases.FindAll(u=>u.Surgeon!=null || u.Surgeon2!=null|| u.Surgeon3!=null)) {
                    tGroup4.ListItems.Add (completeCase);
                }
            }
            tableItems.Add (tGroup4);

            PatientItemGroup tGroup5 = new PatientItemGroup();
            tGroup5.Name = "Cancelled Cases";
            if (rootObj.Patients.CancelledCases != null) {
                foreach (CancelledCases cancelCase in rootObj.Patients.CancelledCases.FindAll(u=>u.Surgeon!=null || u.Surgeon2!=null|| u.Surgeon3!=null)) {
                    tGroup5.ListItems.Add (cancelCase);
                }
            }
            tableItems.Add (tGroup5);

            return tableItems;
        }
        public PatientTableSource Filter(UISearchBar searchBar,List<PatientItemGroup> tableItems,PatientListView patListControllerObj)
        {
            PatientTableSource tableSource;

            //if (searchBar.Text.Trim () != string.Empty) {
                List<PatientItemGroup> filteredTableItems = new List<PatientItemGroup> ();

                List<IncompleteCases> incompList = (tableItems [0].ListItems).Cast<IncompleteCases> ().ToList ();

                if(searchBar.SelectedScopeButtonIndex ==0)
                    incompList = incompList.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()));

                if (searchBar.SelectedScopeButtonIndex == 1) {
                    List<IncompleteCases> surgeonIncompList = new List<IncompleteCases> ();
                    foreach (IncompleteCases inCompCase in incompList) {
                        Dictionary<string, int?> lstSurgeon = new Dictionary<string, int?> ();
                        lstSurgeon.Add ("Surgeon", inCompCase.Surgeon);
                        lstSurgeon.Add ("Surgeon2", inCompCase.Surgeon2);
                        lstSurgeon.Add ("Surgeon3", inCompCase.Surgeon3);

                        string surgeonName = iProPQRSPortableLib.Consts.GetSurgeon (lstSurgeon);

                        if(surgeonName.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty )
                            surgeonIncompList.Add(inCompCase);
                    }
                    incompList = surgeonIncompList;
                }

                if (searchBar.SelectedScopeButtonIndex == 2) {
                    List<IncompleteCases> anesthesioIncompList = new List<IncompleteCases> ();
                    foreach (IncompleteCases inCompCase in incompList) {
                        Dictionary<string, int?> lstAnesthesiologists = new Dictionary<string, int?> ();
                        lstAnesthesiologists.Add ("Anesthesiologist1", inCompCase.Anesthesiologist1);
                        lstAnesthesiologists.Add ("Anesthesiologist2", inCompCase.Anesthesiologist2);
                        lstAnesthesiologists.Add ("Anesthesiologist3", inCompCase.Anesthesiologist3);
                        lstAnesthesiologists.Add ("Anesthesiologist4", inCompCase.Anesthesiologist4);

                        string anesthesiologist = iProPQRSPortableLib.Consts.GetAnesthesiologist (lstAnesthesiologists);

                        if(anesthesiologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            anesthesioIncompList.Add(inCompCase);
                    }
                    incompList = anesthesioIncompList;
                }

                if (searchBar.SelectedScopeButtonIndex == 3 && !string.IsNullOrEmpty(iProPQRSPortableLib.Consts.mId)) {
                    List<IncompleteCases> anesthesioIncompList = new List<IncompleteCases> ();
                    foreach (IncompleteCases myCase in incompList.FindAll(u=>u.Anesthesiologist1.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.Anesthesiologist2.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.Anesthesiologist3.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.Anesthesiologist4.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.CRNA1.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.CRNA2.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.CRNA3.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.CRNA4.ToString()==iProPQRSPortableLib.Consts.mId
                    ||u.SRNA1.ToString()==iProPQRSPortableLib.Consts.mId)) {
                        if (searchBar.Text.Trim() == string.Empty|| myCase.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()))
                            anesthesioIncompList.Add (myCase);
                    }
                    incompList = anesthesioIncompList;
                }

                PatientItemGroup tGroup = new PatientItemGroup () {
                    Name="Incomplete Cases"
                };
                foreach (IncompleteCases filtereditem in incompList) {
                    tGroup.ListItems.Add (filtereditem);
                }
                filteredTableItems.Add (tGroup);

                List<ScheduledCases> schedList = (tableItems [1].ListItems).Cast<ScheduledCases> ().ToList ();
                if(searchBar.SelectedScopeButtonIndex ==0)
                    schedList = schedList.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()));

                if (searchBar.SelectedScopeButtonIndex == 1) {
                    List<ScheduledCases> surgeonSchedList = new List<ScheduledCases> ();
                    foreach (ScheduledCases schedCase in schedList) {
                        Dictionary<string, int?> lstSurgeon = new Dictionary<string, int?> ();
                        lstSurgeon.Add ("Surgeon", schedCase.Surgeon);
                        lstSurgeon.Add ("Surgeon2", schedCase.Surgeon2);
                        lstSurgeon.Add ("Surgeon3", schedCase.Surgeon3);

                        string surgeonName = iProPQRSPortableLib.Consts.GetSurgeon (lstSurgeon);

                        if(surgeonName.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            surgeonSchedList.Add(schedCase);
                    }
                    schedList = surgeonSchedList;
                }

                if (searchBar.SelectedScopeButtonIndex == 2) {
                    List<ScheduledCases> anesthesioSchedList = new List<ScheduledCases> ();
                    foreach (ScheduledCases schedCase in schedList) {
                        Dictionary<string, int?> lstAnesthesiologists = new Dictionary<string, int?> ();
                        lstAnesthesiologists.Add ("Anesthesiologist1", schedCase.Anesthesiologist1);
                        lstAnesthesiologists.Add ("Anesthesiologist2", schedCase.Anesthesiologist2);
                        lstAnesthesiologists.Add ("Anesthesiologist3", schedCase.Anesthesiologist3);
                        lstAnesthesiologists.Add ("Anesthesiologist4", schedCase.Anesthesiologist4);

                        string anesthesiologist = iProPQRSPortableLib.Consts.GetAnesthesiologist (lstAnesthesiologists);

                        if(anesthesiologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            anesthesioSchedList.Add(schedCase);
                    }
                    schedList = anesthesioSchedList;
                }
            if (searchBar.SelectedScopeButtonIndex == 3 && !string.IsNullOrEmpty(iProPQRSPortableLib.Consts.mId)) {

                List<ScheduledCases> ScheduledCasesList = new List<ScheduledCases> ();
                foreach (ScheduledCases myCase in ScheduledCasesList.FindAll(u=>u.Anesthesiologist1.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist2.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist3.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist4.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA1.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA2.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA3.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA4.ToString()==iProPQRSPortableLib.Consts.mId||u.SRNA1.ToString()==iProPQRSPortableLib.Consts.mId)) {
                    if (searchBar.Text.Trim() == string.Empty|| myCase.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()))
                        ScheduledCasesList.Add (myCase);
                }
                schedList = ScheduledCasesList;
            }

                PatientItemGroup tGroup2 = new PatientItemGroup () {
                    Name="Scheduled Cases"
                };
                foreach (ScheduledCases filtereditem in schedList) {
                    tGroup2.ListItems.Add (filtereditem);
                }
                filteredTableItems.Add (tGroup2);

                //In Processs Cases

                List<InProcessCases> inProcesssList = (tableItems [2].ListItems).Cast<InProcessCases> ().ToList ();
                if(searchBar.SelectedScopeButtonIndex ==0)
                    inProcesssList = inProcesssList.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()));

                if (searchBar.SelectedScopeButtonIndex == 1) {
                    List<InProcessCases> surgeonInProcessList = new List<InProcessCases> ();
                    foreach (InProcessCases inProcessCase in inProcesssList) {
                        Dictionary<string, int?> lstSurgeon = new Dictionary<string, int?> ();
                        lstSurgeon.Add ("Surgeon", inProcessCase.Surgeon);
                        lstSurgeon.Add ("Surgeon2", inProcessCase.Surgeon2);
                        lstSurgeon.Add ("Surgeon3", inProcessCase.Surgeon3);

                        string surgeonName = iProPQRSPortableLib.Consts.GetSurgeon (lstSurgeon);

                        if(surgeonName.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            surgeonInProcessList.Add(inProcessCase);
                    }
                    inProcesssList = surgeonInProcessList;
                }

                if (searchBar.SelectedScopeButtonIndex == 2) {
                    List<InProcessCases> anesthesioInProcessList = new List<InProcessCases> ();
                    foreach (InProcessCases inProcessCase in inProcesssList) {
                        Dictionary<string, int?> lstAnesthesiologists = new Dictionary<string, int?> ();
                        lstAnesthesiologists.Add ("Anesthesiologist1", inProcessCase.Anesthesiologist1);
                        lstAnesthesiologists.Add ("Anesthesiologist2", inProcessCase.Anesthesiologist2);
                        lstAnesthesiologists.Add ("Anesthesiologist3", inProcessCase.Anesthesiologist3);
                        lstAnesthesiologists.Add ("Anesthesiologist4", inProcessCase.Anesthesiologist4);

                        string anesthesiologist = iProPQRSPortableLib.Consts.GetAnesthesiologist (lstAnesthesiologists);

                        if(anesthesiologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            anesthesioInProcessList.Add(inProcessCase);
                    }
                    inProcesssList = anesthesioInProcessList;
                }
            if (searchBar.SelectedScopeButtonIndex == 3 && !string.IsNullOrEmpty(iProPQRSPortableLib.Consts.mId)) {

                List<InProcessCases> InProcessCasesList = new List<InProcessCases> ();
                foreach (InProcessCases myCase in InProcessCasesList.FindAll(u=>u.Anesthesiologist1.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist2.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist3.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist4.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA1.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA2.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA3.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA4.ToString()==iProPQRSPortableLib.Consts.mId||u.SRNA1.ToString()==iProPQRSPortableLib.Consts.mId)) {
                        if (searchBar.Text.Trim() == string.Empty|| myCase.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()))
                        InProcessCasesList.Add (myCase);
                    }
                inProcesssList = InProcessCasesList;
                }
                PatientItemGroup tGroup3 = new PatientItemGroup () {
                    Name="In Processs Cases"
                };
                foreach (InProcessCases filtereditem in inProcesssList) {
                    tGroup3.ListItems.Add (filtereditem);
                }
                filteredTableItems.Add (tGroup3);

                // Completed Cases

                List<CompletedCases> CompletedList = (tableItems [3].ListItems).Cast<CompletedCases> ().ToList ();
                if(searchBar.SelectedScopeButtonIndex ==0)
                    CompletedList = CompletedList.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()));

                if (searchBar.SelectedScopeButtonIndex == 1) {
                    List<CompletedCases> surgeonCompleteList = new List<CompletedCases> ();
                    foreach (CompletedCases completeCase in CompletedList) {
                        Dictionary<string, int?> lstSurgeon = new Dictionary<string, int?> ();
                        lstSurgeon.Add ("Surgeon", completeCase.Surgeon);
                        lstSurgeon.Add ("Surgeon2", completeCase.Surgeon2);
                        lstSurgeon.Add ("Surgeon3", completeCase.Surgeon3);

                        string surgeonName = iProPQRSPortableLib.Consts.GetSurgeon (lstSurgeon);

                        if(surgeonName.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            surgeonCompleteList.Add(completeCase);
                    }
                    CompletedList = surgeonCompleteList;
                }

                if (searchBar.SelectedScopeButtonIndex == 2) {
                    List<CompletedCases> anesthesioCompleteList = new List<CompletedCases> ();
                    foreach (CompletedCases completeCase in CompletedList) {
                        Dictionary<string, int?> lstAnesthesiologists = new Dictionary<string, int?> ();
                        lstAnesthesiologists.Add ("Anesthesiologist1", completeCase.Anesthesiologist1);
                        lstAnesthesiologists.Add ("Anesthesiologist2", completeCase.Anesthesiologist2);
                        lstAnesthesiologists.Add ("Anesthesiologist3", completeCase.Anesthesiologist3);
                        lstAnesthesiologists.Add ("Anesthesiologist4", completeCase.Anesthesiologist4);

                        string anesthesiologist = iProPQRSPortableLib.Consts.GetAnesthesiologist (lstAnesthesiologists);

                        if(anesthesiologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            anesthesioCompleteList.Add(completeCase);
                    }
                    CompletedList = anesthesioCompleteList;
                }
            if (searchBar.SelectedScopeButtonIndex == 3 && !string.IsNullOrEmpty(iProPQRSPortableLib.Consts.mId)) {

                List<CompletedCases> CompletedCasesList = new List<CompletedCases> ();
                foreach (CompletedCases myCase in CompletedCasesList.FindAll(u=>u.Anesthesiologist1.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist2.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist3.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist4.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA1.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA2.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA3.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA4.ToString()==iProPQRSPortableLib.Consts.mId||u.SRNA1.ToString()==iProPQRSPortableLib.Consts.mId)) {
                        if (searchBar.Text.Trim() == string.Empty|| myCase.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()))
                        CompletedCasesList.Add (myCase);
                    }
                CompletedList = CompletedCasesList;
                }
                PatientItemGroup tGroup4 = new PatientItemGroup () {
                    Name="Completed Cases"
                };
                foreach (CompletedCases filtereditem in CompletedList) {
                    tGroup4.ListItems.Add (filtereditem);
                }
                filteredTableItems.Add (tGroup4);

                //Cancelled cases

                List<CancelledCases> CancelledList = (tableItems [4].ListItems).Cast<CancelledCases> ().ToList ();
                if(searchBar.SelectedScopeButtonIndex ==0)
                    CancelledList = CancelledList.FindAll (x => x.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()));

                if (searchBar.SelectedScopeButtonIndex == 1) {
                    List<CancelledCases> surgeonCancelledList = new List<CancelledCases> ();
                    foreach (CancelledCases cancelledCase in CancelledList) {
                        Dictionary<string, int?> lstSurgeon = new Dictionary<string, int?> ();
                        lstSurgeon.Add ("Surgeon", cancelledCase.Surgeon);
                        lstSurgeon.Add ("Surgeon2", cancelledCase.Surgeon2);
                        lstSurgeon.Add ("Surgeon3", cancelledCase.Surgeon3);

                        string surgeonName = iProPQRSPortableLib.Consts.GetSurgeon (lstSurgeon);

                        if(surgeonName.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            surgeonCancelledList.Add(cancelledCase);
                    }
                    CancelledList = surgeonCancelledList;
                }

                if (searchBar.SelectedScopeButtonIndex == 2) {
                    List<CancelledCases> anesthesioCancelledList = new List<CancelledCases> ();
                    foreach (CancelledCases cancelledCase in CancelledList) {
                        Dictionary<string, int?> lstAnesthesiologists = new Dictionary<string, int?> ();
                        lstAnesthesiologists.Add ("Anesthesiologist1", cancelledCase.Anesthesiologist1);
                        lstAnesthesiologists.Add ("Anesthesiologist2", cancelledCase.Anesthesiologist2);
                        lstAnesthesiologists.Add ("Anesthesiologist3", cancelledCase.Anesthesiologist3);
                        lstAnesthesiologists.Add ("Anesthesiologist4", cancelledCase.Anesthesiologist4);

                        string anesthesiologist = iProPQRSPortableLib.Consts.GetAnesthesiologist (lstAnesthesiologists);

                        if(anesthesiologist.Trim().ToLower().Contains(searchBar.Text.Trim().ToLower()) || searchBar.Text.Trim() == string.Empty)
                            anesthesioCancelledList.Add(cancelledCase);
                    }
                    CancelledList = anesthesioCancelledList;
                }
            if (searchBar.SelectedScopeButtonIndex == 3 && !string.IsNullOrEmpty(iProPQRSPortableLib.Consts.mId)) {

                List<CancelledCases> CancelledCasesList = new List<CancelledCases> ();
                foreach (CancelledCases myCase in CancelledCasesList.FindAll(u=>u.Anesthesiologist1.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist2.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist3.ToString()==iProPQRSPortableLib.Consts.mId||u.Anesthesiologist4.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA1.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA2.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA3.ToString()==iProPQRSPortableLib.Consts.mId||u.CRNA4.ToString()==iProPQRSPortableLib.Consts.mId||u.SRNA1.ToString()==iProPQRSPortableLib.Consts.mId)) {
                        if (searchBar.Text.Trim() == string.Empty|| myCase.PatientName.Trim ().ToLower ().Contains (searchBar.Text.Trim ().ToLower ()))
                        CancelledCasesList.Add (myCase);
                    }
                CancelledList = CancelledCasesList;
                }
                PatientItemGroup tGroup5 = new PatientItemGroup () {
                    Name="Cancelled cases"
                };
                foreach (CancelledCases filtereditem in CancelledList) {
                    tGroup4.ListItems.Add (filtereditem);
                }
                filteredTableItems.Add (tGroup5);

                tableSource = new PatientTableSource (filteredTableItems, patListControllerObj);
            //}else
            //	tableSource = new PatientTableSource (tableItems, patListControllerObj);

            return tableSource;
        }