public ActionResult CreateRequisitionForIDPS(int id, int programId = -1)
        {
            try
            {
                var planID = _regionalRequestService.FindById(id).PlanID;
                if (programId == (int)Programs.IDPS)
                {
                    var planToBeEdited = _planService.FindBy(p => p.PlanID == planID).Single();
                    if (planToBeEdited != null)
                    {
                        //var datePref = _userAccountService.GetUserInfo(HttpContext.User.Identity.Name).DatePreference;
                        //var planViewModel = new PlanViewModel()
                        //                        {
                        //                            planID = planToBeEdited.PlanID,
                        //                            planName = planToBeEdited.PlanName,
                        //                            StartDate = planToBeEdited.StartDate.ToCTSPreferedDateFormat(datePref),
                        //                            EndDate = planToBeEdited.EndDate.ToCTSPreferedDateFormat(datePref),
                        //                            ProgramID = planToBeEdited.ProgramID,
                        //                            Program = planToBeEdited.Program.Name,
                        //                            StatusID = planToBeEdited.Status,
                        //                        };

                        return(PartialView(planToBeEdited));
                    }
                }

                return(null);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Example #2
0
        public ActionResult CancelChanges(int id)
        {
            var requisitions = _reliefRequisitionService.FindBy(t => t.RegionalRequestID == id);

            foreach (var reliefRequisition in requisitions)
            {
                var deatils = _reliefRequisitionDetailService.FindBy(t => t.RequisitionID == reliefRequisition.RequisitionID);
                foreach (var detail in deatils)
                {
                    _reliefRequisitionDetailService.DeleteReliefRequisitionDetail(detail);
                }
                _reliefRequisitionService.DeleteReliefRequisition(reliefRequisition);
            }

            var request = _regionalRequestService.FindById(id);

            request.Status = (int)RegionalRequestStatus.Approved;
            _regionalRequestService.EditRegionalRequest(request);

            return(RedirectToAction("Details", "Request", new { id = id }));
        }