public ActionResult CPPost(int?participantid, int?sessionid)
        {
            if (participantid != null)
            {
                var participant         = new ParticipiantRepository().Get(participantid.Value);
                evaluation_cp_post ecpp = new EvaluationCpPostRepository()
                                          .Get().FirstOrDefault(x => x.SessionId == sessionid && x.StudentId == participantid);
                if (ecpp == null)
                {
                    ecpp = new evaluation_cp_post();
                }
                ecpp.F1        = participant.Name + " " + participant.FatherName + " " + participant.Family;
                ecpp.StudentId = participantid.Value;
                ecpp.SessionId = sessionid.Value;
                if (participant.DateOfBirth != null)
                {
                    string date = participant.DateOfBirth.Value.ToString("ddMMyyyy");
                    ecpp.F2_1 = date.ToArray()[1] + "";
                    ecpp.F2_2 = date.ToArray()[0] + "";
                    ecpp.F2_3 = date.ToArray()[3] + "";
                    ecpp.F2_4 = date.ToArray()[2] + "";
                    ecpp.F2_5 = date.ToArray()[7] + "";
                    ecpp.F2_6 = date.ToArray()[6] + "";
                    ecpp.F2_7 = date.ToArray()[5] + "";
                    ecpp.F2_8 = date.ToArray()[4] + "";
                }
                ecpp.F3 = participant.Gender;

                return(View(ecpp));
            }
            return(View());
        }
Exemple #2
0
        private bool CheckIsEvaluationFilled(string eveCat, int participantId, int sessionid)
        {
            bool isPrefilled  = false;
            bool isPostfilled = false;

            switch (eveCat)
            {
            case "CP":
                isPrefilled  = new EvaluationCpPreRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                isPostfilled = new EvaluationCpPostRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                break;

            case "LP":
                isPrefilled  = new EvaluationCpPreRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                isPostfilled = new EvaluationCpPostRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                break;

            case "SYC":
                isPrefilled  = new EvaluationSycPreePart1Repository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                isPostfilled = new EvaluationSycPrePart2Repository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                break;

            case "Murshdee":
                isPrefilled  = new EvaluationMurshadeeBeforeRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                isPostfilled = new EvaluationMurshadeeAfterRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                break;

            case "Safeer":
                isPrefilled  = new EvaluationSafeerPreRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                isPostfilled = new EvaluationSafeerPreRepository().Get().Any(x => x.StudentId == participantId && x.SessionId == sessionid);
                break;
            }
            return(isPrefilled && isPostfilled);
        }
        public ActionResult CPPost(evaluation_cp_post ecpp)
        {
            var repo = new EvaluationCpPostRepository();

            ecpp.RowId     = Guid.NewGuid();
            ecpp.CreatedAt = DateTime.Now;
            repo.Post(ecpp);
            var sessionrepo = new SessionRepository();

            sessionrepo.SetPostEvaluationStatus(ecpp.StudentId, ecpp.SessionId);
            return(RedirectToAction("Index", "Session"));
        }