Esempio n. 1
0
        /// <summary>
        /// 返回考生考试试卷
        /// </summary>
        /// <param name="examineeId">
        /// 考生编号
        /// </param>
        /// <returns>试卷列表</returns>
        public IList <ExamResult> GetExamResults(int examineeId)
        {
            IList <ExamResult> examResults = new List <ExamResult>();

            Database db = DatabaseFactory.CreateDatabase();

            //string sqlCommand = "USP_EXAM_RESULT_S";
            string    sqlCommand = "USP_EXAM_RESULT_G_USER";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);

            db.AddInParameter(dbCommand, "p_examinee_id", DbType.Int32, examineeId);
            db.AddInParameter(dbCommand, "p_can_see_score", DbType.Int32, 1);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                ExamResult result = null;
                while (dataReader.Read())
                {
                    result = CreateModelObject(dataReader);
                    result.ExamBeginTime = Convert.ToDateTime(dataReader[GetMappingFieldName("ExamBeginTime")]);
                    result.ExamEndTime   = Convert.ToDateTime(dataReader[GetMappingFieldName("ExamEndTime")]);
                    result.ExamType      = Convert.ToInt32(dataReader[GetMappingFieldName("ExamType")].ToString());
                    examResults.Add(result);
                }
            }

            return(examResults);
        }
Esempio n. 2
0
        /// <summary>
        /// Get Exams
        /// </summary>
        /// <param name="startDate">The Begin Date of the ClassregEvents to filter</param>
        /// <param name="endDate">The End Date of the ClassregEvents to filter</param>
        /// <param name="examTypeId">The Exam Type ID</param>
        /// <returns>The Exam(s)</returns>
        public async Task <Exam[]> GetExams(long startDate, long endDate, int examTypeId)
        {
            //Get the JSON
            RequestExams requestExams = new RequestExams {
                @params =
                {
                    [0] = new RequestExams.Params {
                        startDate  = startDate,
                        endDate    = endDate,
                        examTypeId = examTypeId
                    }
                }
            };

            //Send and receive JSON from WebUntis
            string requestJson  = JsonConvert.SerializeObject(requestExams);
            string responseJson = await SendJsonAndWait(requestJson, _url, SessionId);

            //Parse JSON to Class
            ExamResult result = JsonConvert.DeserializeObject <ExamResult>(responseJson);

            string errorMsg = wus.LastError.Message;

            if (!SuppressErrors && errorMsg != null)
            {
                Logger.Append(Logger.LogLevel.Error, errorMsg);
                throw new WebUntisException(errorMsg);
            }

            //Return the Exams(s)
            return(result.result);
        }
Esempio n. 3
0
    public override ExamResult Check()
    {
        /// No need to check if score is in range, because we did it in constructor(by making the object and using the property)
        ExamResult examResult = new ExamResult(this.Score, 0, 100, "Exam results calculated by score.");

        return(examResult);
    }
Esempio n. 4
0
        public async Task CreateGradings()
        {
            var users = await _users.GetUsers();

            var students   = users.FindAll(s => s.RoleId == 3);
            var allAnswers = await _service.GetQuestionAnswers();

            var exams    = allAnswers.Select(e => e.ExamId).Distinct().ToArray();
            var gradings = new List <ExamResult>();

            foreach (var student in students)
            {
                foreach (var eid in exams)
                {
                    var correct = allAnswers.FindAll(ua => ua.Correct == 1 && ua.UserId == student.UserId);
                    var points  = correct.Select(ua => ua.Points).Sum();

                    ExamResult result = new ExamResult()
                    {
                        ExamScore = points.ToString(), StudentId = student.UserId, ProfessorsCommentary = "You are dumb", TimeScored = DateTime.Now, ExamId = eid
                    };
                    gradings.Add(result);
                }
            }

            await _service.InsertResults(gradings);
        }
Esempio n. 5
0
    public override ExamResult Check()
    {
        ExamResult examResult;
        const int  MinGrade = 2;
        const int  MaxGrade = 6;

        if (this.ProblemsSolvedCount == 0)
        {
            examResult = new ExamResult(2, MinGrade, MaxGrade, "Bad result: nothing done.");
        }
        else if (this.ProblemsSolvedCount == 1)
        {
            examResult = new ExamResult(3, MinGrade, MaxGrade, "Average result: 1 problem solved.");
        }
        else if (this.ProblemsSolvedCount == 2)
        {
            examResult = new ExamResult(4, MinGrade, MaxGrade, "Good result: 2 problems solved.");
        }
        else if (this.ProblemsSolvedCount == 3)
        {
            examResult = new ExamResult(5, MinGrade, MaxGrade, "Very Good result: 3 problems solved.");
        }
        else if (this.ProblemsSolvedCount == 4)
        {
            examResult = new ExamResult(6, MinGrade, MaxGrade, "Excellent result: 4 problems solved.");
        }
        else // if (this.ProblemsSolvedCount > 4)
        {
            examResult = new ExamResult(6, MinGrade, MaxGrade, "Excellent result: more than 4 problems solved. You get an extra bonus");
        }

        return(examResult);
    }
Esempio n. 6
0
        public IList <ExamResult> GetExamResultsByOrgID(int examId, string strOrganizationName, string examineeName, string workno,
                                                        decimal paperTotalScoreLower, decimal paperTotalScoreUpper, int examResultStatusId, int orgID)
        {
            IList <ExamResult> examResults = new List <ExamResult>();

            Database db = DatabaseFactory.CreateDatabase();

            string    sqlCommand = "USP_EXAM_RESULT_GRADE_ORG";
            DbCommand dbCommand  = db.GetStoredProcCommand(sqlCommand);


            db.AddInParameter(dbCommand, "p_exam_id", DbType.Int32, examId);
            db.AddInParameter(dbCommand, "p_organization_name", DbType.String, strOrganizationName);
            db.AddInParameter(dbCommand, "p_examinee_name", DbType.String, examineeName);
            db.AddInParameter(dbCommand, "p_work_no", DbType.String, workno);
            db.AddInParameter(dbCommand, "p_score_lower", DbType.Decimal, paperTotalScoreLower);
            db.AddInParameter(dbCommand, "p_score_upper", DbType.Decimal, paperTotalScoreUpper);
            db.AddInParameter(dbCommand, "p_exam_result_status_id", DbType.Int32, examResultStatusId);
            db.AddInParameter(dbCommand, "p_org_id", DbType.Int32, orgID);
            //db.AddOutParameter(dbCommand, "p_net_name", DbType.String, 50);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                ExamResult er = null;
                while (dataReader.Read())
                {
                    er          = CreateModelObject(dataReader);
                    er.WorkNo   = DataConvert.ToString(dataReader[GetMappingFieldName("WorkNo")]);
                    er.PostName = DataConvert.ToString(dataReader[GetMappingFieldName("PostName")]);
                    examResults.Add(er);
                }
            }

            return(examResults);
        }
 public bool UpdateResult(ExamResult examResult)
 {
     //Add or update
     using (var context = new Context())
     {
         try
         {
             var temp = context.Results.FirstOrDefault(r => r.Key == examResult.Key);
             if (temp != null)
             {
                 temp.Result = examResult.Result;
             }
             else
             {
                 context.Results.Add(examResult);
             }
             context.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
        public ActionResult Create(ExamResultVM examResult)
        {
            if (ModelState.IsValid)
            {
                StudentSubject studentSubject = db.StudentSubjects.FirstOrDefault(s =>
                                                                                  s.StudentId == examResult.StudentId && s.SubjectId == examResult.SubjectId);
                if (studentSubject != null)
                {
                    ExamResult result = new ExamResult()
                    {
                        StudentId = examResult.StudentId,
                        SubjectId = examResult.SubjectId,
                        //Status = "Pass"
                    };
                    db.ExamResults.Add(result);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "You have to assign subject first!!");
                    ViewBag.StudentId = new SelectList(db.Students, "Id", "Student_Id");
                    ViewBag.SubjectId = db.Subjects.ToList();
                    return(View(examResult));
                }
            }

            //ViewBag.StudentSubjectId = new SelectList(db.StudentSubjects, "Id", "Id", examResult.StudentSubjectId);
            ViewBag.StudentId = new SelectList(db.Students, "Id", "Student_Id");
            ViewBag.SubjectId = db.Subjects.ToList();
            return(View(examResult));
        }
Esempio n. 9
0
        /// <summary>
        /// Get result of all subjects for a particular examination
        /// </summary>
        /// <param name="examinationId"></param>
        /// <returns></returns>
        public ExamResult GetExamResult(int examinationId)
        {
            ExamResult result = new ExamResult();

            result.ResultList = new List <SubjectResult>();
            try
            {
                query           = "StudentExamResult";
                cmd             = new SqlCommand(query, con);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@studentId", System.Data.SqlDbType.Int)).Value = id;
                cmd.Parameters.Add(new SqlParameter("@examId", System.Data.SqlDbType.Int)).Value    = examinationId;
                con.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    result.ResultList.Add(new SubjectResult()
                    {
                        Subject        = new Subject((int)reader[0], con.ConnectionString),
                        MarksObtained  = (decimal)reader[1],
                        TotalMarks     = (decimal)reader[2],
                        TeacherRemarks = (string)reader[3]
                    });
                    result.PositionInClass = (long)reader[4];
                }
                con.Close();
            }
            catch (SqlException ex)
            {
                Exception e = new Exception("Error Occured in Database processing. CodeIndex:154", ex);
                throw e;
            }
            return(result);
        }
Esempio n. 10
0
        private void View_turnInTheExam(object sender, EventArgs e)
        {
            int correct            = 0;
            var answerListFromUser = sender as List <dynamic>;

            correct = calculateNumberOfCorrectAnswers(answerListFromUser);

            string studentId = view.StudentInfo.StudentId;
            var    examTake  = context.ExamTakes
                               .SingleOrDefault(s => s.StudentId == studentId &&
                                                s.ExamDetailId == examDetailId);

            //insert exam result
            var examResult = new ExamResult()
            {
                ExamDetailId = examTake.ExamDetailId,
                StudentId    = examTake.StudentId,
                ExamCodeId   = examTake.ExamCodeId,
                NumberOfQuestionsAnswered = view.ExamCode.NumberOfQuestions,
                NumberOfCorrectAnswers    = correct,
                Mark = ((float)10 / view.ExamCode.NumberOfQuestions) * correct
            };

            context.ExamResults.InsertOnSubmit(examResult);
            context.SubmitChanges();
        }
Esempio n. 11
0
    public override ExamResult Check()
    {
        /// No need to check if score is in range, because we did it in constructor(by making the object and using the property)
        ExamResult examResult = new ExamResult(this.Score, 0, 100, "Exam results calculated by score.");

        return examResult;
    }
        public async Task <IActionResult> Edit(int id, [Bind("ResultId,TotalMarks,ExamId,StudentId")] ExamResult examResult)
        {
            if (id != examResult.ResultId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(examResult);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExamResultExists(examResult.ResultId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ExamId"]    = new SelectList(_context.Exams, "ExamId", "ExamId", examResult.ExamId);
            ViewData["StudentId"] = new SelectList(_context.Students, "StudentId", "StudentId", examResult.StudentId);
            return(View(examResult));
        }
Esempio n. 13
0
 private void ExamList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == this.colFilePath.Index)
     {
         ExamResult examResult = this.ExamList.Rows[e.RowIndex].Cells[this.colFilePath.Index].Tag as ExamResult;
         if (examResult == null)
         {
             return;
         }
         if (string.IsNullOrEmpty(examResult.FILE_PATH))
         {
             return;
         }
         string dstFilePath = string.Format("{0}\\{1}\\{2}\\{3}\\{4}.pdf"
                                            , SystemParam.Instance.WorkPath
                                            , "temp"
                                            , SystemParam.Instance.PatVisitInfo.PATIENT_ID
                                            , SystemParam.Instance.PatVisitInfo.VISIT_ID
                                            , examResult.EXAM_ID);
         if (!File.Exists(dstFilePath))
         {
             bool result = ShareFolderRead.Download(examResult.FILE_PATH, dstFilePath);
             if (!result)
             {
                 MessageBoxEx.ShowError("报告下载失败");
                 return;
             }
         }
         CommandHandler.Instance.SendCommand("报告查看", this.MainForm, dstFilePath);
     }
 }
Esempio n. 14
0
        public void TestExamResult()
        {
            int userId = 1;

            QuestionAnswer answer1  = new QuestionAnswer("Ostrava", true);
            QuestionAnswer answer2  = new QuestionAnswer("Praha", false);
            Question       question = QuestionTable.InsertQuestion(this.connection, userId, "test", "closed", new List <QuestionAnswer>()
            {
                answer1, answer2
            });

            Exam exam = ExamTable.InsertExam(this.connection, userId, "test exam", 10, 1, 1, DateTime.Now.AddDays(-1), DateTime.Now.AddDays(1));

            exam.AddQuestion(question.Id, 20);
            ExamTable.UpdateExam(this.connection, exam);

            int        examResultId = ExamResultTable.InsertExamResult(this.connection, exam.Id, userId);
            ExamResult examResult   = ExamResultTable.GetExamResultById(this.connection, examResultId);

            Assert.AreEqual(examResultId, examResult.Id);
            Assert.AreEqual(userId, examResult.OwnerId);
            Assert.AreEqual("created", examResult.State);

            ExamAnswer answer = new ExamAnswer(question.Id, "Ostrava");

            Assert.IsTrue(ExamResultTable.HandInExamResult(this.connection, examResult, new List <ExamAnswer>()
            {
                answer
            }));

            examResult = ExamResultTable.GetExamResultById(this.connection, examResult.Id);

            Assert.AreEqual("finished", examResult.State);
            Assert.AreEqual(exam.Questions[0].Points, examResult.Points);
        }
Esempio n. 15
0
        public void FinishCapture()
        {
            // bgdProgressStatus.ReportProgress(0);

            lblSensorReady.BeginInvoke(
                new Action(() => { lblSensorReady.Text = ""; })
                );

            btnStopCapture.BeginInvoke(
                new Action(() => { btnStopCapture.Enabled = false; })
                );;


            if (!shouldCancel)
            {
                formatedCoordinates = captureService.formatedCoordinates;

                bool success = communicationService.CommunicateExam(formatedCoordinates);

                ExamResult result = new ExamResult(currentMovement.Name, success);

                examResults.Add(result);
                UpdateGrid();
                movementCount++;

                HasNextMovement();
            }
        }
        public async Task <IActionResult> Edit(int id, ExamResult examResult)
        {
            if (id != examResult.Exam_Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(examResult);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExamResultExists(examResult.Exam_Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(examResult));
        }
Esempio n. 17
0
 private void SetEvaluation(ExamResult resultModel)
 {
     if (resultModel.Total < 55)
     {
         resultModel.Evaluation = 5;
     }
     else if (resultModel.Total >= 55 && resultModel.Total < 65)
     {
         resultModel.Evaluation = 6;
     }
     else if (resultModel.Total >= 65 && resultModel.Total < 75)
     {
         resultModel.Evaluation = 7;
     }
     else if (resultModel.Total >= 75 && resultModel.Total < 85)
     {
         resultModel.Evaluation = 8;
     }
     else if (resultModel.Total >= 85 && resultModel.Total < 95)
     {
         resultModel.Evaluation = 9;
     }
     else if (resultModel.Total >= 95 && resultModel.Total <= 100)
     {
         resultModel.Evaluation = 10;
     }
 }
Esempio n. 18
0
        public async Task <IActionResult> Detail(string examId)
        {
            if (answerRepository.IsUserLocked(User.Identity.Name))
            {
                return(NotFound("Locked"));
            }


            string language = Request.GetLanguage(config.DefaultLocalization);
            var    exam     = examRepository.GetById(examId, language);

            if (exam == null)
            {
                return(NotFound("Exam"));
            }

            if (!exam.CanOpen)
            {
                return(BadRequest("Timeout"));
            }

            if (await answerRepository.CreateMissingAnswers(User.Identity.Name, exam))
            {
                exam = examRepository.GetById(examId, language);
            }
            var examResult = ExamResult.FromEntity(exam, language);
            var answers    = await answerRepository.GetAll(User.Identity.Name, examResult.Id);

            examResult.SetScore(answers);
            return(Ok(examResult));
        }
Esempio n. 19
0
    public override ExamResult Check()
    {
        ExamResult curentResult = new ExamResult();

        switch (this.ProblemsSolved % 6)
        {
            case 0:
                curentResult =  new ExamResult(2, minGrade,
                    maxGrade, "Bad result: nothing is done.");;
                break;
            case 1:
                curentResult = new ExamResult(3, minGrade,
                    maxGrade, "Bad result: vary little is done."); ;
                break;
            case 2:
                curentResult = new ExamResult(4, minGrade,
                    maxGrade, "Average result: half of the work is done."); ;
                break;
            case 3:
                curentResult = new ExamResult(5, minGrade,
                    maxGrade, "Good result: more than half of the work is done."); ;
                break;
            case 4:
                curentResult = new ExamResult(6, minGrade,
                    maxGrade, "Vary Good result: all work is done."); ;
                break;
            default:
                throw new ArgumentException("ProblemsSolved", "Number of solved problems " +
                    "can not be less than 0 and more than 10");
                break;
        }
        return curentResult;
    }
Esempio n. 20
0
        public async Task <ActionResult> Results()
        {
            var submissions = await db_.AuditExamSubmissions.Where(u => u.User.UserName == User.Identity.Name).ToListAsync();

            IEnumerable <ExamResult> results = null;

            if (submissions != null)
            {
                results = submissions.Select(submission =>
                {
                    ExamResult result;
                    if (submission.RawResult == null)
                    {
                        result = new ExamResult();
                    }
                    else
                    {
                        result = JsonConvert.DeserializeObject <ExamResult>(submission.RawResult);
                    }
                    result.ExamVersion = submission.Version;
                    result.IsSubmitted = submission.IsSubmitted;
                    result.SubmitTime  = submission.SubmitTime;
                    result.Score       = submission.Score;
                    result.ExamAnswers = null;
                    return(result);
                });
            }
            return(Json(results));
        }
Esempio n. 21
0
    public override ExamResult Check()
    {
        ExamResult result;

        switch (this.ProblemsSolved)
        {
        case 0:
            result = new ExamResult(2, 2, 6, "Bad result: nothing done.");
            break;

        case 1:
            result = new ExamResult(4, 2, 6, "Average result: nothing done.");
            break;

        case 2:
            result = new ExamResult(6, 2, 6, "Average result: nothing done.");
            break;

        default:
            // This should never happen.
            throw new NotImplementedException("The given number of ProblemsSolved is not implemented.");
        }

        return(result);
    }
        public IActionResult Add(AddExamResultViewModel model)
        {
            if (CheckAccess())
            {
                ViewData["ReturnUrl"] = ReturnUrl;
                if (ModelState.IsValid)
                {
                    var userId = this.userManager.GetUserId(this.User);

                    var examResult = new ExamResult
                    {
                        Student_Id = model.Student_Id,
                        Course_Id  = model.Course_Id,
                        Grade      = model.Grade,
                        Created_At = DateTime.UtcNow,
                        Created_By = userId,
                        Updated_By = null,
                    };

                    Student student = db.Student.Find(model.Student_Id);
                    var     name    = student.FirstName + " " + student.LastName;
                    db.ExamResult.Add(examResult);
                    db.SaveChanges();
                    return(RedirectToAction("List", "ExamResult", new { studName = name, studId = model.Student_Id }));
                }

                // If we got this far, something failed, redisplay form
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Denied", "Access"));
            }
        }
        public JsonResult Submit(List <ObjectiveTest> answers)
        {
            int    answeredTime    = 0;
            int?   score           = 0;
            string explanation     = "";
            bool   failedImportant = false;

            foreach (var answer in answers)
            {
                answeredTime = answer.TimeTaken;

                if (answer.CorrectAnswerID == answer.Answered)
                {
                    decimal?responsePercentage  = ERDal.ResponsePercentage(answer.AllowedTime, answeredTime);
                    int?    scoreByResponseTime = ERDal.CalculateScoreByResponseTime(responsePercentage, answer.Score);
                    score = score + scoreByResponseTime;
                }
                else
                {
                    if (answer.Priority == "Important")
                    {
                        failedImportant = true;
                        string       CandidateAnswer = "";
                        AnswerOption ansOp           = new AnswerOption();
                        if (answer.Answered != null)
                        {
                            ansOp = TD.AnswerOptions.Find(answer.Answered == null ? 0 : answer.Answered);

                            CandidateAnswer = ". <br /> You have answered " + ansOp.AnswerOptionsDescription;
                        }


                        ansOp = TD.AnswerOptions.Find(answer.CorrectAnswerID);
                        string correctAnswer = ansOp.AnswerOptionsDescription;
                        explanation = explanation + "You have failed to answer an important question " + answer.Question + CandidateAnswer + ". <br /> The correct answer is " + correctAnswer + ". <br /> Unfortunately this time you lost your score as you have to ..... ";
                    }
                    score = score - 1;
                }
            }
            // Session["CandidateId"] = 4;
            if (failedImportant == true)
            {
                score = 0;
            }
            int Grade       = ERDal.CalculateGrade(score);
            int CandidateId = Convert.ToInt32(Session["CandidateId"]);

            int        ExamId = ERDal.ExamTypeId("Objective");
            ExamResult ER     = new ExamResult();

            ER.CandidateId = CandidateId;
            ER.ExamId      = ExamId;
            ER.Date        = DateTime.Now.ToString("dd/MM/yyyy");
            ER.Score       = score;
            ER.Grade       = Grade;
            ER.Explanation = explanation;
            int examResults = ERDal.SaveScore(ER);

            return(Json("OK", JsonRequestBehavior.AllowGet));
        }
Esempio n. 24
0
        private void button1_Click(object sender, EventArgs e)
        {
            ExamResult ex1 = new ExamResult();

            ex1.ExamName  = (ExamName)comboBox1.SelectedIndex;
            ex1.ExamLevel = radioButton4.Checked ? ExamLevel.BASIC : ExamLevel.ADVANCED;
            ex1.Result    = (int)numericUpDown1.Value;
            ExamResult ex2 = new ExamResult();

            ex2.ExamLevel = radioButton1.Checked ? ExamLevel.BASIC : ExamLevel.ADVANCED;
            ex2.ExamName  = (ExamName)comboBox2.SelectedIndex;
            ex2.Result    = (int)numericUpDown2.Value;
            ExamResult ex3 = new ExamResult();

            ex3.ExamName  = (ExamName)comboBox3.SelectedIndex;
            ex3.ExamLevel = radioButton5.Checked ? ExamLevel.BASIC : ExamLevel.ADVANCED;
            ex3.Result    = (int)numericUpDown3.Value;
            List <ExamResult> ls = new List <ExamResult>()
            {
                ex1, ex2, ex3
            };
            InferenceEngine engine = new InferenceEngine();
            var             ret    = engine.Run(ls);

            ret.Result.Sort((x, y) => { return(x.Item2.CompareTo(y.Item2)); });
            ret.Result.Reverse();
            string txt = "> Welcome in our app which helps you to choose best University and course!!! \r\n> Choose your  3 best matura exam scores \r\n> \r\n> \r\n>";

            foreach (var el in ret.Result)
            {
                txt += ("You will " + el.Item2.ToString() + " get into " + el.Item1.CourseName + " on " + el.Item1.CollegeName + "\r\n>");
            }
            textBox1.Text = txt;
        }
    public override ExamResult Check()
    {
        if (this.ProblemsSolved == 0)
        {
            var result = new ExamResult(2, 2, 6, "Bad result: nothing done.");
            return(result);
        }

        if (this.ProblemsSolved == 1)
        {
            var result = new ExamResult(3, 2, 6, "Average result: Not bad, keep trying.");
            return(result);
        }

        if (this.ProblemsSolved == 2)
        {
            var result = new ExamResult(4, 2, 6, "Good result. You are on the right path.");
            return(result);
        }

        if (this.ProblemsSolved == 3)
        {
            var result = new ExamResult(5, 2, 6, "Very good result. Good job! Almost there!");
            return(result);
        }

        return(new ExamResult(6, 2, 6, "Great result: Well done."));
    }
        public ActionResult DeleteConfirmed(int id)
        {
            ExamResult examResult = db.ExamResults.Find(id);

            db.ExamResults.Remove(examResult);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ExamResult getExamResultByID(string examResultID)
 {
     using (ISession session = getSession())
     {
         ExamResult er = (ExamResult)session.Get(typeof(ExamResult), examResultID);
         return(er);
     }
 }
Esempio n. 28
0
        public int UpdateExamResultAndItsAnswers(ExamResult examResult, IList <ExamResultAnswer> examResultAnswers)
        {
            Database  db        = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand("USP_EXAM_RESULT_U");

            db.AddInParameter(dbCommand, "p_exam_result_id", DbType.Int32, examResult.ExamResultId);
            db.AddInParameter(dbCommand, "p_org_id", DbType.Int32, examResult.OrganizationId);
            db.AddInParameter(dbCommand, "p_exam_id", DbType.Int32, examResult.ExamId);
            db.AddInParameter(dbCommand, "p_paper_id", DbType.Int32, examResult.PaperId);
            db.AddInParameter(dbCommand, "p_examinee_id", DbType.Int32, examResult.ExamineeId);
            db.AddInParameter(dbCommand, "p_begin_time", DbType.DateTime, examResult.BeginDateTime);
            db.AddInParameter(dbCommand, "p_current_time", DbType.DateTime, examResult.CurrentDateTime);
            db.AddInParameter(dbCommand, "p_end_time", DbType.DateTime, examResult.EndDateTime);
            db.AddInParameter(dbCommand, "p_exam_time", DbType.Int32, examResult.ExamTime);
            db.AddInParameter(dbCommand, "p_auto_score", DbType.Decimal, examResult.AutoScore);
            db.AddInParameter(dbCommand, "p_score", DbType.Decimal, examResult.Score);
            db.AddInParameter(dbCommand, "p_judge_id", DbType.Int32, examResult.JudgeId);
            db.AddInParameter(dbCommand, "p_judge_begin_time", DbType.DateTime, examResult.JudgeBeginDateTime);
            db.AddInParameter(dbCommand, "p_judge_end_time", DbType.DateTime, examResult.JudgeEndDateTime);
            db.AddInParameter(dbCommand, "p_correct_rate", DbType.Decimal, examResult.CorrectRate);
            db.AddInParameter(dbCommand, "p_is_pass", DbType.Int32, 0);
            db.AddInParameter(dbCommand, "p_status_id", DbType.Int32, examResult.StatusId);
            db.AddInParameter(dbCommand, "p_memo", DbType.String, examResult.Memo);

            DbConnection connection = db.CreateConnection();

            connection.Open();
            DbTransaction transaction = connection.BeginTransaction();

            try
            {
                db.ExecuteNonQuery(dbCommand, transaction);

                foreach (ExamResultAnswer answer in examResultAnswers)
                {
                    dbCommand = db.GetStoredProcCommand("USP_EXAM_RESULT_ANSWER_U");

                    db.AddInParameter(dbCommand, "p_exam_result_id", DbType.Int32, answer.ExamResultId);
                    db.AddInParameter(dbCommand, "p_paper_item_id", DbType.Int32, answer.PaperItemId);
                    db.AddInParameter(dbCommand, "p_answer", DbType.String, answer.Answer);
                    db.AddInParameter(dbCommand, "p_exam_time", DbType.Int32, answer.ExamTime);
                    db.AddInParameter(dbCommand, "p_judge_score", DbType.Decimal, answer.JudgeScore);
                    db.AddInParameter(dbCommand, "p_judge_status_id", DbType.Int32, answer.JudgeStatusId);
                    db.AddInParameter(dbCommand, "p_judge_remark", DbType.String, answer.JudgeRemark);
                    db.ExecuteNonQuery(dbCommand, transaction);
                }

                transaction.Commit();
            }
            catch (System.SystemException ex)
            {
                transaction.Rollback();
                throw ex;
            }
            connection.Close();

            return(0);
        }
    protected virtual void RaiseResultFound(ExamData arg1, ExamResult arg2)
    {
        Action <ExamData, ExamResult> handler = ResultFound;

        if (handler != null)
        {
            handler(arg1, arg2);
        }
    }
    protected virtual void RaiseExceptionalResultFound(ExamData arg1, ExamResult arg2)
    {
        var handler = ExceptionalResultFound;

        if (handler != null)
        {
            handler(arg1, arg2);
        }
    }
Esempio n. 31
0
 public override ExamResult Check()
 {
     string comment = "Exam results calculated by score.";
     var examResult = new ExamResult(
                          this.Score,
                          MIN_SCORE,
                          MAX_SCORE,
                          comment);
     return examResult;
 }
Esempio n. 32
0
        protected void Bind_AllExamResult_List()
        {
            ExamResult ExResult = new ExamResult();

            ExResult.StudentCode = txt_StudentID.Text;
            ExResult.ExamID      = drpdwn_ExamResultSeheduleID.SelectedValue == "" ? 0 : int.Parse(drpdwn_ExamResultSeheduleID.SelectedValue);
            gridview_ViewExamResult.DataSource = ExamResultManagement.GetInstance.GetExamResultList(ExResult); //PageVariables.SehedulesList;
            gridview_ViewExamResult.DataBind();
            ExamResults_Multi.SetActiveView(view_Grid);
        }
 public ActionResult Edit([Bind(Include = "Id,StudentId,SubjectId,Status")] ExamResult examResult)
 {
     if (ModelState.IsValid)
     {
         db.Entry(examResult).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //ViewBag.StudentSubjectId = new SelectList(db.StudentSubjects, "Id", "Id", examResult.StudentSubjectId);
     return(View(examResult));
 }
Esempio n. 34
0
    public override ExamResult Check()
    {
        ExamResult examResultToReturn = null;

        switch (this.ProblemsSolved)
        {
            case 0: examResultToReturn = new ExamResult(2, 2, 6, BadResultExamComment);
                break;
            case 1: examResultToReturn = new ExamResult(4, 2, 6, AverageResultExamComment);
                break;
            case 2: examResultToReturn = new ExamResult(6, 2, 6, ExcellentResultExamComment);
                break;
            default: break;
        }

        return examResultToReturn;
    }
Esempio n. 35
0
    public override ExamResult Check()
    {
        ExamResult result;
        if (this.ProblemsSolved == 0)
        {
            result = new ExamResult(2, 2, 6, "Bad result: nothing done.");
        }
        else if (this.ProblemsSolved == 1)
        {
            result = new ExamResult(4, 2, 6, "Average result: nothing done.");
        }
        else // if (ProblemsSolved == 2)
        {
            result = new ExamResult(6, 2, 6, "Excelent result: everything done.");
        }

        return result;
    }
    public override ExamResult Check()
    {
        ExamResult examResult = null;

        if (this.ProblemsSolved == 0)
        {
            examResult = new ExamResult(2, 2, 6, "Bad result: nothing done.");
        }
        else if (this.ProblemsSolved == 1)
        {
            examResult = new ExamResult(4, 2, 6, "Average result: nothing done.");
        }
        else if (this.ProblemsSolved == 2)
        {
            examResult = new ExamResult(6, 2, 6, "Average result: nothing done.");
        }

        return examResult;
    }
Esempio n. 37
0
    public override ExamResult Check()
    {
        ExamResult result;
        switch (this.ProblemsSolved)
        {
            case 0:
                result = new ExamResult(2, 2, 6, "Bad result: nothing done.");
                break;
            case 1:
                result = new ExamResult(4, 2, 6, "Average result: nothing done.");
                break;
            case 2:
                result = new ExamResult(6, 2, 6, "Average result: nothing done.");
                break;
            default:
                // This should never happen.
                throw new NotImplementedException("The given number of ProblemsSolved is not implemented.");
        }

        return result;
    }
    public override ExamResult Check()
    {
        ExamResult result = null;

        switch (this.ProblemsSolved)
        {
            case 0:
                result = new ExamResult(2, MinGrade, MaxGrade, "Bad result: nothing done.");
                break;
            case 1:
                result = new ExamResult(4, MinGrade, MaxGrade, "Average result: nothing done.");
                break;
            case 2:
                result = new ExamResult(6, MinGrade, MaxGrade, "Average result: nothing done.");
                break;
            default:
                throw new ArgumentException("Invalid number of problems solved!");
                break;
        }

        return result;
    }
Esempio n. 39
0
    public override ExamResult Check()
    {
        string examOverview = string.Empty;
        int actualGrade = 0;

        if (this.ProblemsSolved == this.minimumProblemstoSolve)
        {
            actualGrade = MinGrade;
            examOverview = "Failed the exam";
        }
        else if (this.ProblemsSolved == 1)
        {
            actualGrade = 4;
            examOverview = "Passed with average result.";
        }
        else if (this.ProblemsSolved == this.maximumProblemsToSolve)
        {
            actualGrade = MaxGrade;
            examOverview = "Excellent result: all done.";
        }

        var result = new ExamResult(actualGrade, MinGrade, MaxGrade, examOverview);
        return result;
    }
        public override ExamResult Check()
        {
             var resultExam = new ExamResult(this.Score, MinGrade, MaxGrade, "Exam results calculated by score.");

            return resultExam;
        }
    public override ExamResult Check()
    {
        ExamResult result = new ExamResult(this.Score, MinScore, MaxScore, "Exam results calculated by score.");

        return result;
    }
Esempio n. 42
0
 public override ExamResult Check()
 {
     ExamResult result = new ExamResult(this.Score, 0, 100, "C# exam results calculated by score.");
     return result;
 }