コード例 #1
0
 /// <summary>
 /// Add or Update casesmartgoalprogress to database
 /// </summary>
 /// <param name="casesmartgoalprogress">data to save</param>
 public void InsertOrUpdate(CaseSmartGoalProgress casesmartgoalprogress)
 {
     casesmartgoalprogress.LastUpdateDate = DateTime.Now;
     if (casesmartgoalprogress.ID == default(int))
     {
         //set the date when this record was created
         casesmartgoalprogress.CreateDate = casesmartgoalprogress.LastUpdateDate;
         //set the id of the worker who has created this record
         casesmartgoalprogress.CreatedByWorkerID = casesmartgoalprogress.LastUpdatedByWorkerID;
         //add a new record to database
         context.CaseSmartGoalProgress.Add(casesmartgoalprogress);
     }
     else
     {
         //update an existing record to database
         context.Entry(casesmartgoalprogress).State = System.Data.Entity.EntityState.Modified;
     }
     Save();
     if (casesmartgoalprogress.ID > 0)
     {
         CaseSmartGoal caseSmartGoal = context.CaseSmartGoal.SingleOrDefault(item => item.ID == casesmartgoalprogress.CaseSmartGoalID);
         if (caseSmartGoal != null && caseSmartGoal.ServiceLevelOutcomeID != casesmartgoalprogress.ServiceLevelOutcomeID)
         {
             caseSmartGoal.ServiceLevelOutcomeID = casesmartgoalprogress.ServiceLevelOutcomeID;
             caseSmartGoal.LastUpdateDate        = DateTime.Today;
             caseSmartGoal.LastUpdatedByWorkerID = casesmartgoalprogress.LastUpdatedByWorkerID;
             context.Entry(caseSmartGoal).State  = System.Data.Entity.EntityState.Modified;
             Save();
         }
     }
 }
コード例 #2
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));
        }
コード例 #3
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));
        }