Ejemplo n.º 1
0
 public string GetCandidateName(LOT_Candidate_Exam objUI)
 {
     if (objUI.LOT_Exam.ExamType == 2)
         return dbContext.GetEmployeeFullName(objUI.EmployeeID, 1);
     if (objUI.LOT_Exam.ExamType == 1)
         return dbContext.GetCandidateFullName(objUI.CandidateID, 1);
     return string.Empty;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Update Programming mark & comment to db
        /// </summary>
        /// <param name="objDB"></param>
        /// <param name="objUI"></param>
        /// <returns></returns>
        private Message UpdateProgramingMark(LOT_Candidate_Exam objDB, LOT_Candidate_Exam objUI)
        {
            Message msg = null;
            objDB.UpdateDate = DateTime.Now;
            objDB.UpdatedBy = objUI.UpdatedBy;

            double totalProgramingMaxMark = candidateAnswerDAO.GetMaxWritingMark(objUI.ID, Constants.LOT_PROGRAMMING_SKILL_ID);
            // Round writing mark
            //if (objUI.ProgramingMark != null)
            //{
            //    objUI.ProgramingMark = Math.Round(objUI.ProgramingMark.Value);
            //}

            //if (objUI.ProgramingMark < 0)
            //{
            //    msg = new Message(MessageConstants.E0028, MessageType.Error, "Programming mark", "0");
            //}
            //else if (objUI.ProgramingMark > totalProgramingMaxMark)
            //{
            //    msg = new Message(MessageConstants.E0029, MessageType.Error, "Programming mark", "Programming max mark (" + totalProgramingMaxMark + ")");
            //}
            //else
            //{
            //    objDB.ProgramingMark = objUI.ProgramingMark;
            //    objDB.ProgramingComment = objUI.ProgramingComment;
                dbContext.SubmitChanges();

                string displayName = "";

                if (objDB.LOT_Exam.ExamType == Constants.LOT_CANDIDATE_EXAM_ID)
                {
                    if (string.IsNullOrEmpty(objDB.Candidate.MiddleName))
                    {
                        displayName = objDB.Candidate.FirstName + " " + objDB.Candidate.LastName;
                    }
                    else
                    {
                        displayName = objDB.Candidate.FirstName + " " + objDB.Candidate.MiddleName + " " + objDB.Candidate.LastName;
                    }
                }
                else
                {
                    if (string.IsNullOrEmpty(objDB.Employee.MiddleName))
                    {
                        displayName = objDB.Employee.FirstName + " " + objDB.Employee.LastName;
                    }
                    else
                    {
                        displayName = objDB.Employee.FirstName + " " + objDB.Employee.MiddleName + " " + objDB.Employee.LastName;
                    }
                }

                msg = new Message(MessageConstants.I0001, MessageType.Info, "Programming skill information of candidate '" + displayName + "'", "updated");
            //}
            return msg;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Update login date and IP of table candidate exam follow by objUI
        /// </summary>
        /// <param name="objUI">LOT_Candidate_Exam object that have been passed from view</param>
        /// <returns>Message</returns>
        public Message UpdateCandidateExam(LOT_Candidate_Exam objUI)
        {
            Message msg = null;
            try
            {
                LOT_Candidate_Exam candidate = this.GetItemByCandidatePin(objUI.CandidatePin);
                if (candidate != null)
                {
                    candidate.LoginDate = DateTime.Now;
                    candidate.IP = HttpContext.Current.Request.UserHostAddress;
                    dbContext.SubmitChanges();

                    // Show success message
                    msg = new Message(MessageConstants.I0001, MessageType.Info, "CandidateExam", "updated");
                }
            }
            catch (Exception ex)
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
                throw ex;
            }
            return msg;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Check update date whether is valid
        /// </summary>
        /// <param name="objUI"></param>
        /// <param name="objDb"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private bool IsValidUpdateDate(LOT_Candidate_Exam objUI, LOT_Candidate_Exam objDb, out Message msg)
        {
            bool isValid = false;
            msg = null;

            if (objUI != null && objDb != null)
            {
                if (objDb.UpdateDate.ToString().Equals(objUI.UpdateDate.ToString()))
                {
                    isValid = true;
                }
                else
                {
                    string displayName = "";
                    if (objDb.Candidate.MiddleName == null)
                    {
                        displayName = objDb.Candidate.FirstName + " " + objDb.Candidate.LastName;
                    }
                    else
                    {
                        displayName = objDb.Candidate.FirstName + " " + objDb.Candidate.MiddleName + " " + objDb.Candidate.LastName;
                    }
                    msg = new Message(MessageConstants.E0025, MessageType.Error, "Writing information of candidate '" + displayName + "'");
                }
            }

            return isValid;
        }
Ejemplo n.º 5
0
        public Message UpdateVerbalMark(LOT_Candidate_Exam candidateExam)
        {
            Message msg = null;
            try
            {
                if (candidateExam != null)
                {
                    LOT_Candidate_Exam objDB = GetCandidateExamById(candidateExam.ID);

                    //check valid update date
                    if (IsValidUpdateDate(candidateExam, objDB, out msg))
                    {
                        //objDB.VerbalMark = candidateExam.VerbalMark;
                        //objDB.VerbalMarkType = candidateExam.VerbalMarkType;
                        //objDB.VerbalComment = candidateExam.VerbalComment;
                        //objDB.VerbalTestedBy = candidateExam.VerbalTestedBy;
                        objDB.UpdateDate = DateTime.Now;
                        objDB.UpdatedBy = HttpContext.Current.User.Identity.Name;
                        dbContext.SubmitChanges();
                        msg = new Message(MessageConstants.I0001, MessageType.Info, "Verbal mark", "updated");
                    }
                }
            }
            catch (Exception)
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Update Programming mark & comment
 /// </summary>
 /// <param name="objUI"></param>
 /// <returns></returns>
 public Message UpdateProgramingMark(LOT_Candidate_Exam objUI)
 {
     Message msg = null;
     try
     {
         if (objUI != null)
         {
             LOT_Candidate_Exam objDB = GetCandidateExamById(objUI.ID);
             objUI.ExamID = objDB.ExamID;
             //check valid update date
             if (IsValidUpdateDate(objUI, objDB, out msg))
             {
                 msg = UpdateProgramingMark(objDB, objUI);
             }
         }
     }
     catch (Exception)
     {
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Update writing mark or Tc and bug mark and comment for cadidate exam
 /// </summary>
 /// <param name="objUI"></param>
 /// <returns></returns>
 public Message Update(LOT_Candidate_Exam objUI, int sectionID)
 {
     Message msg = null;
     try
     {
         if (objUI != null)
         {
             List<LOT_CandidateAnswer> candidateAnswers = dbContext.LOT_CandidateAnswers.ToList<LOT_CandidateAnswer>();
             LOT_Candidate_Exam objDB = GetCandidateExamById(objUI.ID);
             objUI.ExamID = objDB.ExamID;
             if (IsValidUpdateDate(objUI, objDB, out msg))
             {
                 msg = UpdateNotValidate(objUI, objDB, sectionID);
             }
         }
     }
     catch (Exception)
     {
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }
Ejemplo n.º 8
0
 public Message InsertCandidateForExam(LOT_Candidate_Exam objUI)
 {
     Message msg = null;
     try
     {
         LOT_Candidate_Exam objDb = dbContext.LOT_Candidate_Exams.Where(q=>q.EmployeeID==objUI.EmployeeID
             && q.ExamID==objUI.ExamID).FirstOrDefault();
         if (objDb == null)
         {
             if (objUI != null)
             {
                 // Set more info
                 dbContext.LOT_Candidate_Exams.InsertOnSubmit(objUI);
                 dbContext.SubmitChanges();
                 msg = new Message(MessageConstants.I0001, MessageType.Info, "Exam '" + objUI.EmployeeID + "'", "added");
             }
         }
         else
         {
             //objDb.WritingComment = objUI.WritingComment;
             //objDb.WritingMark = objUI.WritingMark;
             //objDb.VerbalComment = objUI.VerbalComment;
             //objDb.VerbalMark = objUI.VerbalMark;
             //objDb.VerbalMarkType = objUI.VerbalMarkType;
             //objDb.VerbalTestedBy = objUI.VerbalTestedBy;
             dbContext.SubmitChanges();
             msg = new Message(MessageConstants.I0001, MessageType.Info, "Exam '" + objUI.EmployeeID + "'", "added");
         }
     }
     catch (Exception)
     {
         // Show system error
         msg = new Message(MessageConstants.E0007, MessageType.Error);
     }
     return msg;
 }