Пример #1
0
        public ActionResult AddBeneficary(int id,int programId = -1)
        {
            var request = _regionalRequestService.FindById(id);
            ViewBag.RegionID = new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 2), "AdminUnitID", "Name");
            ViewBag.programId = programId;
            ViewBag.ZoneID = programId != -1 ? new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 3), "AdminUnitID", "Name") : new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 3 && t.ParentID == request.RegionID), "AdminUnitID", "Name");

            ViewBag.WoredaID = new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 4), "AdminUnitID", "Name");
            ViewBag.FDPID = new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 4), "AdminUnitID", "Name");
            var addFDPWithBeneficary = new AddFDPViewModel();
            addFDPWithBeneficary.RegionalRequestID = request.RegionalRequestID;
            addFDPWithBeneficary.RegionID = request.RegionID;
            ViewBag.CurrentRegion = request.RegionID;
            return PartialView(addFDPWithBeneficary);
        }
Пример #2
0
 private RegionalRequestDetail GetRequestDetail(AddFDPViewModel addFdpViewModel)
 {
     var requestdetail = new RegionalRequestDetail()
         {
             RegionalRequestID = addFdpViewModel.RegionalRequestID,
             Fdpid = addFdpViewModel.FDPID,
             Beneficiaries = addFdpViewModel.Beneficiaries,
         };
     return requestdetail;
 }
Пример #3
0
        public ActionResult AddBeneficary(AddFDPViewModel requestDetail,int _programId = -1)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ViewBag.programId = _programId;
                    var detail = GetRequestDetail(requestDetail);
                    _regionalRequestDetailService.AddCommodityFdp(detail);
                    return RedirectToAction("Allocation", new { id = requestDetail.RegionalRequestID, programId = _programId });
                }

                catch (Exception ex)
                {
                    ModelState.AddModelError("Errors", "Unable to Add new fpd");
                    ViewBag.ZoneID = new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 3), "AdminUnitID", "Name");
                    ViewBag.WoredaID = new SelectList(_commonService.GetAminUnits(t => t.AdminUnitTypeID == 4), "AdminUnitID", "Name");
                    ViewBag.FDPID = new SelectList(_commonService.GetFDPs(2), "FDPID", "FDPName");
                    return RedirectToAction("Allocation", new { id = requestDetail.RegionalRequestID, programId = _programId });
                }

            }
            return PartialView(requestDetail);
        }