Exemple #1
0
        public List <TestCheckBoxListModel> PopulatePatientTestForEdit(int PatientTestID)
        {
            using (EHMSEntities ent = new EHMSEntities())
            {
                List <TestCheckBoxListModel> tempList = new List <TestCheckBoxListModel>();
                List <TestCheckBoxListModel> tempListForPatientTest = new List <TestCheckBoxListModel>();

                var data = (from pt in ent.PatientTests
                            join ptd in ent.PatientTestDetails on pt.PatientTestID equals ptd.PatientTestID
                            join st in ent.SetupPathoTests on ptd.TestID equals st.TestId
                            where pt.PatientTestID == PatientTestID
                            select new TestCheckBoxListModel
                {
                    TestDate = ptd.TestDate,
                    TestTime = ptd.TestTime,
                    SectionId = ptd.SectionID,
                    TestId = ptd.TestID,
                    TestName = st.TestName,
                    Price = st.Price,
                    DeliveryDate = ptd.DeliveryDate,
                    isSelected = true
                }).ToList();
                foreach (var item in data)
                {
                    tempList.Add(item);
                }
                var testData = ent.SetupPathoTests.ToList();
                foreach (var item in testData)
                {
                    TestCheckBoxListModel model = new TestCheckBoxListModel();
                    var isExists = tempList.Where(x => x.TestId == item.TestId).FirstOrDefault();
                    model.SectionId = (int)item.SectionId;
                    model.Price     = item.Price;
                    model.TestName  = item.TestName;

                    if (isExists != null)
                    {
                        model.TestTime     = isExists.TestTime;
                        model.DeliveryDate = isExists.DeliveryDate;
                        model.isSelected   = true;
                        model.DeliveryDate = isExists.DeliveryDate;
                        model.TestDate     = isExists.TestDate;
                    }
                    tempListForPatientTest.Add(model);
                }
                return(tempListForPatientTest);
            }
        }
Exemple #2
0
        public List <TestCheckBoxListModel> GetAllTestWithCheckBoxes(int SectionID)
        {
            List <TestCheckBoxListModel> TestCheckBoxListModelList = new List <TestCheckBoxListModel>();

            using (EHMSEntities ent = new EHMSEntities())
            {
                var data = ent.SetupPathoTests.ToList();
                foreach (var i in data)
                {
                    TestCheckBoxListModel model = new TestCheckBoxListModel();
                    model.SectionId  = (Int32)i.SectionId;
                    model.TestId     = i.TestId;
                    model.TestName   = i.TestName;
                    model.Price      = i.Price;
                    model.isSelected = false;
                    TestCheckBoxListModelList.Add(model);
                }
                return(TestCheckBoxListModelList);
            }
        }