public UserBaseInsulinCalcProfileModel ToUserBaseInsulinCalcProfileModel(UserBaseInsulinCalcProfile baseProfile) { UserBaseInsulinCalcProfileModel returnProfile = null; if (baseProfile != null) { if(baseProfile is PumpInsulinProfile) { returnProfile = new PumpInsulinProfileModel() { PumpType = (baseProfile as PumpInsulinProfile).PumpType }; } else if(baseProfile is RapidInsulinProfile) { returnProfile = new RapidInsulinProfileModel() { BasalInsulinAmount = (baseProfile as RapidInsulinProfile).BasalInsulinAmount }; } returnProfile.BirthDate = baseProfile.BirthDate; returnProfile.DosageUnits = baseProfile.DosageUnits; returnProfile.InsulinCarbohydrateRatio = baseProfile.InsulinCarbohydrateRatio; returnProfile.MaxSugarRange = baseProfile.MaxSugarRange; returnProfile.MinSugarRange = baseProfile.MinSugarRange; returnProfile.Sex = baseProfile.Sex; returnProfile.UnitReductionValue = baseProfile.UnitReductionValue; returnProfile.UnitReductionUnits = baseProfile.UnitReductionUnits; returnProfile.Weight = baseProfile.Weight; } return returnProfile; }
public ActionResult InsulinCalcProfileEdit(string pumpUsage = null) { UserBaseInsulinCalcProfileModel insulinCalcProfile = UserProfileFacade.GetUserInsulinCalcProfileModel(); if (insulinCalcProfile == null) { return RedirectToAction("InsulinCalcProfileCreate"); } if (pumpUsage == null) { pumpUsage = (insulinCalcProfile is PumpInsulinProfileModel) ? "yes" : "no"; } else { if (pumpUsage == "yes") { if (insulinCalcProfile is RapidInsulinProfileModel) { insulinCalcProfile = new PumpInsulinProfileModel(insulinCalcProfile); } } else { if (pumpUsage == "no") { if (insulinCalcProfile is PumpInsulinProfileModel) { insulinCalcProfile = new RapidInsulinProfileModel(insulinCalcProfile); } } } } ViewBag.pumpUsage = pumpUsage; ViewData["reductionUnits"] = DropDownListForHelper.GetSelectListForEnumType<UnitReductionUnits>(UnitReductionUnits.mmolL); ViewData["dosageUnits"] = DropDownListForHelper.GetSelectListForEnumType<DosageUnits>(DosageUnits.mg); ViewData["pumps"] = DropDownListForHelper.GetSelectListForEnumType<PumpType>(PumpType.RocheAccuChekCombo); ViewData["sexes"] = DropDownListForHelper.GetSelectListForEnumType<Sex>(Sex.Male); return View(insulinCalcProfile); }
public ActionResult InsulinCalcProfileCreate(string pumpUsage = "no") { log.InfoFormat("[InsulinCalcProfileCreate]."); UserBaseInsulinCalcProfileModel userInsulineProfile = null; if (pumpUsage == "yes") { userInsulineProfile = new PumpInsulinProfileModel(); ViewBag.pumpUsage = pumpUsage; } else { if (pumpUsage == "no") { userInsulineProfile = new RapidInsulinProfileModel(); ViewBag.pumpUsage = pumpUsage; } } ViewData["reductionUnits"] = DropDownListForHelper.GetSelectListForEnumType<UnitReductionUnits>(); ViewData["dosageUnits"] = DropDownListForHelper.GetSelectListForEnumType<DosageUnits>(); ViewData["pumps"] = DropDownListForHelper.GetSelectListForEnumType<PumpType>(); ViewData["sexes"] = DropDownListForHelper.GetSelectListForEnumType<Sex>(); return View(userInsulineProfile); }