Пример #1
0
        public ViewResult Index(int casesmartgoalId, int caseId, int?caseMemberId)
        {
            CaseSmartGoal caseSmartGoal = casesmartgoalRepository.Find(casesmartgoalId);

            if (caseSmartGoal != null)
            {
                List <CaseSmartGoalAssignment> goalAssignmentList = casesmartgoalRepository.FindAllCaseSmartGoalAssignmentByCaseSmargGoalID(caseSmartGoal.ID);
                if (goalAssignmentList != null)
                {
                    foreach (CaseSmartGoalAssignment goalAssignment in goalAssignmentList)
                    {
                        caseSmartGoal.SmartGoalName = caseSmartGoal.SmartGoalName.Concate(",", goalAssignment.SmartGoal.Name);
                    }
                }
            }
            caseSmartGoal.CaseID = caseId;
            CaseSmartGoalProgress caseSmartGoalProgress = new CaseSmartGoalProgress();

            caseSmartGoalProgress.CaseSmartGoal      = caseSmartGoal;
            caseSmartGoalProgress.CaseSmartGoalID    = casesmartgoalId;
            caseSmartGoalProgress.PendingActionCount = caseactionRepository.FindPendingActionCount(casesmartgoalId);

            if (caseMemberId.HasValue && caseMemberId.Value > 0)
            {
                caseSmartGoalProgress.CaseMemberID = caseMemberId.Value;
                CaseMember caseMember = casememberRepository.Find(caseSmartGoalProgress.CaseMemberID);
                if (caseMember != null)
                {
                    ViewBag.DisplayID = caseMember.DisplayID;
                }
            }
            else
            {
                var varCase = caseRepository.Find(caseId);
                if (varCase != null)
                {
                    ViewBag.DisplayID = varCase.DisplayID;
                }
            }
            return(View(caseSmartGoalProgress));
        }
Пример #2
0
        public ActionResult Index(int casesmartgoalId, int caseId, int?caseMemberId, int?casesmartgoalserviceproviderId)
        {
            //<JL:add:06/02/2017>
            var  varCase   = caseRepository.Find(caseId);
            bool hasAccess = workerroleactionpermissionnewRepository.HasPermission(caseId, CurrentLoggedInWorkerRoleIDs, CurrentLoggedInWorker.ID, varCase.ProgramID, varCase.RegionID, varCase.SubProgramID, varCase.JamatkhanaID, Constants.Areas.CaseManagement, Constants.Controllers.CaseSmartGoalServiceProvider, Constants.Actions.Index, true);

            if (!hasAccess)
            {
                WebHelper.CurrentSession.Content.ErrorMessage = "You are not eligible to do this action";
                return(RedirectToAction(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty }));
            }
            //<JL:add:06/02/2017>

            //create a new instance of caseSmartGoalServiceProvider
            CaseSmartGoalServiceProvider caseSmartGoalServiceProvider = new CaseSmartGoalServiceProvider();

            if (casesmartgoalserviceproviderId.HasValue)
            {
                caseSmartGoalServiceProvider = casesmartgoalserviceproviderRepository.Find(casesmartgoalserviceproviderId.Value);
                if (caseSmartGoalServiceProvider != null)
                {
                    casesmartgoalId = caseSmartGoalServiceProvider.CaseSmartGoalID;
                }
            }
            caseSmartGoalServiceProvider.CaseID          = caseId;
            caseSmartGoalServiceProvider.CaseSmartGoalID = casesmartgoalId;
            if (caseMemberId.HasValue)
            {
                caseSmartGoalServiceProvider.CaseMemberID = caseMemberId.Value;
            }
            CaseSmartGoal caseSmartGoal = casesmartgoalRepository.Find(casesmartgoalId);

            if (caseSmartGoal != null)
            {
                caseSmartGoalServiceProvider.QualityOfLifeCategoryID = caseSmartGoal.QualityOfLifeCategoryID;
            }
            if (caseSmartGoalServiceProvider.CaseMemberID == 0 && caseSmartGoal != null && caseSmartGoal.CaseGoal != null)
            {
                caseSmartGoalServiceProvider.CaseMemberID = caseSmartGoal.CaseGoal.CaseMemberID;
            }
            if (caseSmartGoal != null)
            {
                List <CaseSmartGoalAssignment> goalAssignmentList = casesmartgoalRepository.FindAllCaseSmartGoalAssignmentByCaseSmargGoalID(caseSmartGoal.ID);
                if (goalAssignmentList != null)
                {
                    foreach (CaseSmartGoalAssignment goalAssignment in goalAssignmentList)
                    {
                        caseSmartGoal.SmartGoalName = caseSmartGoal.SmartGoalName.Concate(",", goalAssignment.SmartGoal.Name);
                    }
                }
            }
            if (caseSmartGoal != null && caseSmartGoal.CaseGoal != null && caseSmartGoal.CaseGoal.CaseMember != null)
            {
                caseSmartGoal.CaseMemberName = caseSmartGoal.CaseGoal.CaseMember.FirstName + " " + caseSmartGoal.CaseGoal.CaseMember.LastName;
            }
            caseSmartGoalServiceProvider.CaseSmartGoal = caseSmartGoal;
            caseSmartGoalServiceProvider.ServiceTypeID = 1;
            caseSmartGoalServiceProvider.CaseSmartGoalServiceLevelOutcome = new CaseSmartGoalServiceLevelOutcome();
            caseSmartGoalServiceProvider.CaseSmartGoalServiceLevelOutcome.CaseSmartGoalID = casesmartgoalId;

            caseSmartGoalServiceProvider.CaseAction = new CaseAction();
            //return view result
            ViewBag.ServiceProviderID = casesmartgoalserviceproviderId.ToString(true);
            if (caseMemberId.HasValue && caseMemberId.Value > 0)
            {
                caseSmartGoalServiceProvider.CaseMemberID = caseMemberId.Value;
                CaseMember caseMember = casememberRepository.Find(caseSmartGoalServiceProvider.CaseMemberID);
                if (caseMember != null)
                {
                    ViewBag.DisplayID = caseMember.DisplayID;
                    if (caseMember.Case != null)
                    {
                        caseSmartGoalServiceProvider.RegionID = caseMember.Case.RegionID;
                    }
                }
            }
            else
            {
                //var varCase = caseRepository.Find(caseId);
                if (varCase != null)
                {
                    ViewBag.DisplayID = varCase.DisplayID;
                    caseSmartGoalServiceProvider.RegionID = varCase.RegionID;
                }
            }
            //if (!caseSmartGoalServiceProvider.IsUsed)
            //{
            //    caseSmartGoalServiceProvider.IsProposed = true;
            //}
            return(View(caseSmartGoalServiceProvider));
        }