public void LookUps() { var userRegionID = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).RegionID; var regions = _commonService.GetRegions(); if (userRegionID != null) { regions = _commonService.FindBy(m => m.AdminUnitID == userRegionID); } var lossReasons = _lossReasonService.GetAllLossReason().Select(t => new { name = t.LossReasonCodeEg + "-" + t.LossReasonEg, Id = t.LossReasonId }); ViewData["LossReasons"] = lossReasons; ViewBag.Region = new SelectList(regions, "AdminUnitID", "Name", "--Select Region--"); ViewBag.Zone = new SelectList(_commonService.FindBy(m => m.AdminUnitTypeID == 3 && m.ParentID == 3), "AdminUnitID", "Name"); ViewBag.Woreda = new SelectList(_commonService.FindBy(m => m.AdminUnitTypeID == 4 && m.ParentID == 19), "AdminUnitID", "Name"); ViewBag.ProgramID = new SelectList(_commonService.GetPrograms(), "ProgramID", "Name"); //ViewBag.Month = new SelectList(RequestHelper.GetMonthList(), "Id", "Name"); ViewBag.SupportTypeID = new SelectList(_commonService.GetAllSupportType(), "SupportTypeID", "Description"); }
public JsonResult GetAdminUnits() { var r = (from region in _commonService.GetRegions() select new { RegionID = region.AdminUnitID, RegionName = region.Name, Zones = from zone in _commonService.GetZones(region.AdminUnitID) select new { ZoneID = zone.AdminUnitID, ZoneName = zone.Name, Woredas = from woreda in _commonService.GetWoreda(zone.AdminUnitID) select new { WoredaID = woreda.AdminUnitID, WoredaName = woreda.Name } } } ); return(Json(r, JsonRequestBehavior.AllowGet)); }