Exemplo n.º 1
0
        public ActionResult GetMedicalConditions(string conditionTypeId)
        {
            if (String.IsNullOrEmpty(conditionTypeId))
            {
                throw new ArgumentNullException("moduleId");
            }

            switch (int.Parse(conditionTypeId))
            {
            case (int)MedicalConditionTypeEnum.Allergy:
                var allergyModel = new AllergyModel();
                var allergyList  = allergyModel.GetListOfAllergies();

                var result = (from c in allergyList
                              select new
                {
                    id = c.Allergy_Id,
                    name = c.Description
                }).ToList();

                return(Json(result, JsonRequestBehavior.AllowGet));

            case (int)MedicalConditionTypeEnum.ChronicIllness:
                var chronicIllnessModel = new ChronicIllnessModel();
                var chronicIllnessList  = chronicIllnessModel.GetListOfChronicIllnesses();

                var chronicIllnessResult = (from c in chronicIllnessList
                                            select new
                {
                    id = c.Chronic_Illness_Id,
                    name = c.Description
                }).ToList();

                return(Json(chronicIllnessResult, JsonRequestBehavior.AllowGet));

            case (int)MedicalConditionTypeEnum.Decease:
                var deceaseModel = new DeceaseModel();
                var deceasesList = deceaseModel.GetListOfDeseases();

                var deceasesResult = (from c in deceasesList
                                      select new
                {
                    id = c.Decease_Id,
                    name = c.Description
                }).ToList();

                return(Json(deceasesResult, JsonRequestBehavior.AllowGet));
            }

            return(null);
        }
Exemplo n.º 2
0
        public ActionResult Edit(string id, string personId, string medicalConditionTypeId)
        {
            var intakeMedicalConditionItem = new IntakeMedicalConditionItem();

            switch (int.Parse(medicalConditionTypeId))
            {
            case (int)MedicalConditionTypeEnum.Allergy:
                var allergyModel = new AllergyModel();
                var allergyList  = allergyModel.GetListOfAllergies();
                intakeMedicalConditionItem.Medical_Conditions = (from a in allergyList
                                                                 select new LookupDataItem()
                {
                    ItemId = a.Allergy_Id,
                    Description = a.Description
                }).ToList();
                break;

            case (int)MedicalConditionTypeEnum.ChronicIllness:
                var chronicIllnessModel = new ChronicIllnessModel();
                var chronicIllnessList  = chronicIllnessModel.GetListOfChronicIllnesses();
                intakeMedicalConditionItem.Medical_Conditions = (from c in chronicIllnessList
                                                                 select new LookupDataItem()
                {
                    ItemId = c.Chronic_Illness_Id,
                    Description = c.Description
                }).ToList();
                break;

            case (int)MedicalConditionTypeEnum.Decease:
                var deceasesModel = new DeceaseModel();
                var deceasesList  = deceasesModel.GetListOfDeseases();
                intakeMedicalConditionItem.Medical_Conditions = (from c in deceasesList
                                                                 select new LookupDataItem()
                {
                    ItemId = c.Decease_Id,
                    Description = c.Description
                }).ToList();
                break;
            }

            intakeMedicalConditionItem.Person_Id = int.Parse(personId);
            intakeMedicalConditionItem.Medical_Condition_Type_Id = int.Parse(medicalConditionTypeId);
            intakeMedicalConditionItem.Medical_Condition_Id      = int.Parse(id);
            intakeMedicalConditionItem.Remove_Item_Type_Id       = int.Parse(medicalConditionTypeId);
            intakeMedicalConditionItem.Remove_Item_Id            = int.Parse(id);

            return(PartialView("_MedicalDetailsEdit", intakeMedicalConditionItem));
        }