/// <summary> /// This method Load all levels /// </summary> /// <returns> It returns Result Object </returns> public Result LoadAllLevels() { logger.Info("Start LoadAllLevels LevelDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; List<Level> oListLevel = new List<Level>(); try { sSelect = "select EX_Label.LabelID,EX_Label.LabelName,EX_Label.LabelPrerequisite from" +" EX_Label order by EX_Label.LabelName"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { Level oLevel = new Level(); oLevel.LevelID = new Guid(oSqlDataReader["LabelID"].ToString()); oLevel.LevelName = oSqlDataReader["LabelName"].ToString(); oLevel.LevelDescription = oSqlDataReader["LabelPrerequisite"].ToString(); oListLevel.Add(oLevel); } oSqlDataReader.Close(); oResult.ResultObject = oListLevel; oResult.ResultMessage = "Load All Levels Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Load All Levels Exception..."; logger.Info("Exception LoadAllLevels LevelDAO+DAO", oEx); } finally { if (oSqlDataReader != null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End LoadAllLevels LevelDAO+DAO"); return oResult; }
/// <summary> /// This method show the questions according to category,type,questionlevel. /// And these questions are shown to setup them for an exam /// </summary> /// <param name="oQuestion"> It takes Question Object </param> /// <param name="oExam"> It takes Exam Object </param> /// <returns> It returns Result Object </returns> public Result QuestionListShowForSetupByQuestionLevel(Question oQuestion, Exam oExam) { logger.Info("Start QuestionListShowForSetupByQuestionLevel QuestionDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; String sChoiceSelect = String.Empty; List<QuestionSetup> oListQuestionSetup = new List<QuestionSetup>(); try { //sSelect = "select distinct QuestionID,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID," // + " QuestionTypeID,QuestionPossibleAnswerTime,QuestionLabelID,EX_Label.LabelName,EX_Label.LabelPrerequisite" // + " from EX_Question left join EX_Label on EX_Question.QuestionLabelID=EX_Label.LabelID where QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + // "' and QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "'"; if (oQuestion.QuestionCreator.SystemUserName.ToLower().Equals("administrator")) { //sSelect = "select distinct EX_Question.QuestionID as EntryQuestionID,EX_QuestionGeneration.QuestionID as GeneratedQuestionID,EX_QuestionGeneration.SetupQuestionMark,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID,QuestionTypeID,EX_Question.QuestionPossibleAnswerTime from EX_Question left join EX_QuestionGeneration on EX_Question.QuestionID=EX_QuestionGeneration.QuestionID where EX_Question.QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + "' and EX_Question.QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "'"; //sSelect = "select distinct QuestionID,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID," + //"QuestionTypeID,QuestionPossibleAnswerTime,QuestionLabelID from EX_Question where QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + //"' and QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "' and QuestionLabelID='"+oQuestion.QuestionLevel.LevelID+"'"; sSelect = "select distinct QuestionID,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID," + " QuestionTypeID,QuestionPossibleAnswerTime,QuestionLabelID,EX_Label.LabelName,EX_Label.LabelPrerequisite" + " from EX_Question inner join EX_Label on EX_Question.QuestionLabelID=EX_Label.LabelID where QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + "' and QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "' and QuestionLabelID='" + oQuestion.QuestionLevel.LevelID + "'"; } else { //sSelect = "select distinct EX_Question.QuestionID as EntryQuestionID,EX_QuestionGeneration.QuestionID as GeneratedQuestionID,EX_QuestionGeneration.SetupQuestionMark,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID,QuestionTypeID,EX_Question.QuestionPossibleAnswerTime from EX_Question left join EX_QuestionGeneration on EX_Question.QuestionID=EX_QuestionGeneration.QuestionID where EX_Question.QuestionCreatorID='" + oQuestion.QuestionCreator.SystemUserID + "' and EX_Question.QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + "' and EX_Question.QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "'"; //sSelect = "select distinct QuestionID,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID," + //"QuestionTypeID,QuestionPossibleAnswerTime,QuestionLabelID from EX_Question where QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + //"' and QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "' and QuestionLabelID='" + oQuestion.QuestionLevel.LevelID + "'"; sSelect = "select distinct QuestionID,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID," + " QuestionTypeID,QuestionPossibleAnswerTime,QuestionLabelID,EX_Label.LabelName,EX_Label.LabelPrerequisite" + " from EX_Question inner join EX_Label on EX_Question.QuestionLabelID=EX_Label.LabelID where QuestionCategoryID='" + oQuestion.QuestionCategory.CategoryID + "' and QuestionTypeID='" + oQuestion.QuestionQuestionType.QuestionTypeID + "' and QuestionLabelID='" + oQuestion.QuestionLevel.LevelID + "'"; } oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { QuestionSetup oPopulatedQuestionSetup = new QuestionSetup(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionID = new Guid(oSqlDataReader["QuestionID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionText = oSqlDataReader["QuestionText"].ToString(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionCreator.SystemUserID = new Guid(oSqlDataReader["QuestionCreatorID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionDefaultMark = float.Parse(oSqlDataReader["QuestionDefaultMark"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionCategory.CategoryID = int.Parse(oSqlDataReader["QuestionCategoryID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionQuestionType.QuestionTypeID = int.Parse(oSqlDataReader["QuestionTypeID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionPossibleAnswerTime = float.Parse(oSqlDataReader["QuestionPossibleAnswerTime"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelID = new Guid(oSqlDataReader["QuestionLabelID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelName = oSqlDataReader["LabelName"].ToString(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelDescription = oSqlDataReader["LabelPrerequisite"].ToString(); oPopulatedQuestionSetup.QuestionSetupMark = oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionDefaultMark; oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionIsUsed = false; //if (oSqlDataReader["GeneratedQuestionID"].ToString().Length > 0) //{ // oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionIsUsed = true; //} //if (oSqlDataReader["SetupQuestionMark"].ToString().Length > 0) //{ // oPopulatedQuestionSetup.QuestionSetupMark = float.Parse(oSqlDataReader["SetupQuestionMark"].ToString()); //} oListQuestionSetup.Add(oPopulatedQuestionSetup); } oSqlDataReader.Close(); if (oQuestion.QuestionQuestionType.QuestionTypeID == 0) //enum should be used here { foreach (QuestionSetup oQuestionSetupInList in oListQuestionSetup) { sChoiceSelect = "select ObjectiveAnswer,ObjectiveAnswerIsValid from EX_Objective where ObjectiveQuestionID='" + oQuestionSetupInList.QuestionSetupQuestion.QuestionID + "'"; List<Choice> oListChoice = new List<Choice>(); oSqlDataReader = oDAOUtil.GetReader(sChoiceSelect); while (oSqlDataReader.Read()) { //prepare the choices for a particular questtion...... //and populate oListQuestion Choice oChoice = new Choice(); oChoice.ChoiceName = oSqlDataReader["ObjectiveAnswer"].ToString(); oChoice.ChoiceIsValid = Convert.ToBoolean(oSqlDataReader["ObjectiveAnswerIsValid"].ToString()); oListChoice.Add(oChoice); } oSqlDataReader.Close(); oQuestionSetupInList.QuestionSetupQuestion.QuestionObjectiveType.ListOfChoices = oListChoice; } } foreach (QuestionSetup oQuestionSetupInList in oListQuestionSetup) { sSelect = "select distinct EX_QuestionGeneration.QuestionID as GeneratedQuestionID,EX_QuestionGeneration.SetupQuestionMark from EX_QuestionGeneration where EX_QuestionGeneration.QuestionID='" + oQuestionSetupInList.QuestionSetupQuestion.QuestionID + "' and EX_QuestionGeneration.ExamID='" + oExam.ExamID + "'"; oSqlDataReader = oDAOUtil.GetReader(sSelect); if (oSqlDataReader.HasRows) { oQuestionSetupInList.QuestionSetupQuestion.QuestionIsUsed = true; while (oSqlDataReader.Read()) { if (oSqlDataReader["SetupQuestionMark"].ToString().Length > 0) { oQuestionSetupInList.QuestionSetupMark = float.Parse(oSqlDataReader["SetupQuestionMark"].ToString()); } } } oSqlDataReader.Close(); } oResult.ResultObject = oListQuestionSetup; oResult.ResultMessage = "QuestionListShowForSetupByQuestionLevel Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during QuestionListShowForSetupByQuestionLevel..."; oResult.ResultException = oEx; logger.Info("Exception QuestionListShowForSetupByQuestionLevel QuestionDAO+DAO", oEx); } finally { if (oSqlDataReader != null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End QuestionListShowForSetupByQuestionLevel QuestionDAO+DAO"); return oResult; }
//r /// <summary> /// This method setup the selected questions for an exam /// </summary> /// <param name="oListQuestionSetup"> It takes List<QuestionSetup> Object </param> /// <param name="iarrChecked"> It takes integer array to indicates the marked questions </param> /// <returns> It returns Result Object </returns> public Result QuestionSetup(List<QuestionSetup> oListQuestionSetup, int[] iarrChecked) { logger.Info("Start QuestionSetup QuestionDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sSelect = String.Empty; String sInsert = String.Empty; String sUpdate = String.Empty; List<String> oListStringInsertUpdate = new List<String>(); List<QuestionSetup> oListSuccessQuestionSetup = new List<QuestionSetup>(); SqlDataReader oSqlDataReader = null; int i = 0; try { foreach (QuestionSetup oQuestionSetup in oListQuestionSetup) { if (iarrChecked[i] == 1) { Boolean flag = true; sSelect = "select ExamID,QuestionID from EX_QuestionGeneration where ExamID='" + oQuestionSetup.QuestionSetupExam.ExamID + "' and QuestionID='" + oQuestionSetup.QuestionSetupQuestion.QuestionID + "'"; oSqlDataReader = oDAOUtil.GetReader(sSelect); if (oSqlDataReader.HasRows) { flag = false; } oSqlDataReader.Close(); if (flag) { sInsert = "insert into EX_QuestionGeneration(ExamID,QuestionID,SetupQuestionMark,GeneratorID,GenerationTime) values('" + oQuestionSetup.QuestionSetupExam.ExamID + "','" + oQuestionSetup.QuestionSetupQuestion.QuestionID + "','" + oQuestionSetup.QuestionSetupMark + "','" + oQuestionSetup.QuestionSetupSystemUser.SystemUserID + "','" + oQuestionSetup.QuestionSetupGenerationTime + "')"; oListStringInsertUpdate.Add(sInsert); oListSuccessQuestionSetup.Add(oQuestionSetup); } } i++; } if (oListStringInsertUpdate.Count > 0) // any question is setup { if (oDAOUtil.ExecuteNonQuery(oListStringInsertUpdate)) { oResult.ResultMessage = "Question Setup Success..."; oResult.ResultObject = oListSuccessQuestionSetup; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Question Setup Failed..."; } } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Questions are all ready been Setup..."; } } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during Question Setup..."; logger.Info("Exception QuestionSetup QuestionDAO+DAO", oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End QuestionSetup QuestionDAO+DAO"); return oResult; }
/// <summary> /// This method show the questions according to question level. /// And these questions are already been setup. /// </summary> /// <param name="oQuestionSetup"> It takes QuestionSetup Object </param> /// <returns> It returns Result Object </returns> public Result QuestionSetupListShowByQuestionLevel(QuestionSetup oQuestionSetup) { logger.Info("Start QuestionSetupListShowByQuestionLevel QuestionDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sSelect = String.Empty; List<QuestionSetup> oListQuestionSetup = new List<QuestionSetup>(); SqlDataReader oSqlDataReader = null; try { if (oQuestionSetup.QuestionSetupQuestion.QuestionCreator.SystemUserName.Equals("administrator")) { sSelect = "select EX_QuestionGeneration.ExamID,EX_QuestionGeneration.QuestionID,EX_QuestionGeneration.SetupQuestionMark,EX_QuestionGeneration.GeneratorID," +" EX_Question.QuestionText,EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID,EX_Question.QuestionPossibleAnswerTime," +" EX_Question.QuestionLabelID,EX_Label.LabelName,EX_Label.LabelPrerequisite" +" from EX_Label inner join EX_Question on EX_Label.LabelID=EX_Question.QuestionLabelID inner join" + " EX_QuestionGeneration on EX_Question.QuestionID=EX_QuestionGeneration.QuestionID" +" where EX_QuestionGeneration.ExamID='" + oQuestionSetup.QuestionSetupExam.ExamID + "' and EX_Question.QuestionTypeID='" + oQuestionSetup.QuestionSetupQuestion.QuestionQuestionType.QuestionTypeID + "'" +" and EX_Question.QuestionCategoryID='" + oQuestionSetup.QuestionSetupQuestion.QuestionCategory.CategoryID + "'" +" and EX_Question.QuestionLabelID='" + oQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelID+"'"; } else { sSelect = "select EX_QuestionGeneration.ExamID,EX_QuestionGeneration.QuestionID,EX_QuestionGeneration.SetupQuestionMark,EX_QuestionGeneration.GeneratorID," + " EX_Question.QuestionText,EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID,EX_Question.QuestionPossibleAnswerTime," + " EX_Question.QuestionLabelID,EX_Label.LabelName,EX_Label.LabelPrerequisite" + " from EX_Label inner join EX_Question on EX_Label.LabelID=EX_Question.QuestionLabelID inner join" + " EX_QuestionGeneration on EX_Question.QuestionID=EX_QuestionGeneration.QuestionID" +" where EX_QuestionGeneration.ExamID='" + oQuestionSetup.QuestionSetupExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oQuestionSetup.QuestionSetupQuestion.QuestionCreator.SystemUserID + "'" +" and EX_Question.QuestionTypeID='" + oQuestionSetup.QuestionSetupQuestion.QuestionQuestionType.QuestionTypeID + "' and EX_Question.QuestionCategoryID='" + oQuestionSetup.QuestionSetupQuestion.QuestionCategory.CategoryID + "'" + " and EX_Question.QuestionLabelID='" + oQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelID+"'"; } oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { QuestionSetup oPopulatedQuestionSetup = new QuestionSetup(); oPopulatedQuestionSetup.QuestionSetupExam.ExamID = new Guid(oSqlDataReader["ExamID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionID = new Guid(oSqlDataReader["QuestionID"].ToString()); oPopulatedQuestionSetup.QuestionSetupMark = float.Parse(oSqlDataReader["SetupQuestionMark"].ToString()); oPopulatedQuestionSetup.QuestionSetupSystemUser.SystemUserID = new Guid(oSqlDataReader["GeneratorID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionText = oSqlDataReader["QuestionText"].ToString(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionQuestionType.QuestionTypeID = int.Parse(oSqlDataReader["QuestionTypeID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionCategory.CategoryID = int.Parse(oSqlDataReader["QuestionCategoryID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionPossibleAnswerTime = float.Parse(oSqlDataReader["QuestionPossibleAnswerTime"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelID = new Guid(oSqlDataReader["QuestionLabelID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelName = oSqlDataReader["LabelName"].ToString(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelDescription = oSqlDataReader["LabelPrerequisite"].ToString(); oListQuestionSetup.Add(oPopulatedQuestionSetup); } oSqlDataReader.Close(); oResult.ResultObject = oListQuestionSetup; oResult.ResultMessage = "QuestionSetupListShowByQuestionLevel success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during QuestionSetup ListShow ByQuestionLevel..."; logger.Info("Exception QuestionSetupListShowByQuestionLevel QuestionDAO+DAO", oEx); } finally { if (oSqlDataReader != null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End QuestionSetupListShowByQuestionLevel QuestionDAO+DAO"); return oResult; }
public Result LoadAllQuestionsOfAnExam(Exam oSelectedExam) { logger.Info("Start LoadAllQuestionsOfAnExam QuestionDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; List<QuestionSetup> oListQuestionSetup = new List<QuestionSetup>(); try { sSelect="select distinct EX_QuestionGeneration.ExamID," +" EX_QuestionGeneration.SetupQuestionMark," +" EX_QuestionGeneration.GeneratorID," +" EX_Question.QuestionID," +" EX_Question.QuestionText,EX_Question.QuestionTypeID," +" EX_Question.QuestionPossibleAnswerTime," +" EX_Label.LabelID," +" EX_Label.LabelName," +" EX_Category.CategoryID,EX_Category.CategoryName" +" from EX_QuestionGeneration,EX_Question,EX_Category,EX_Label" +" where EX_Question.QuestionLabelID=EX_Label.LabelID" +" and EX_Question.QuestionCategoryID=EX_Category.CategoryID" +" and EX_Question.QuestionID=EX_QuestionGeneration.QuestionID" +" and EX_QuestionGeneration.ExamID='" + oSelectedExam.ExamID + "'" +" order by EX_Category.CategoryName,EX_Label.LabelName,EX_Question.QuestionTypeID asc"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { QuestionSetup oPopulatedQuestionSetup = new QuestionSetup(); oPopulatedQuestionSetup.QuestionSetupExam.ExamID = new Guid(oSqlDataReader["ExamID"].ToString()); oPopulatedQuestionSetup.QuestionSetupMark = float.Parse(oSqlDataReader["SetupQuestionMark"].ToString()); oPopulatedQuestionSetup.QuestionSetupSystemUser.SystemUserID = new Guid(oSqlDataReader["GeneratorID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionID = new Guid(oSqlDataReader["QuestionID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionText = oSqlDataReader["QuestionText"].ToString(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionQuestionType.QuestionTypeID = int.Parse(oSqlDataReader["QuestionTypeID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionPossibleAnswerTime = float.Parse(oSqlDataReader["QuestionPossibleAnswerTime"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelID = new Guid(oSqlDataReader["LabelID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionLevel.LevelName = oSqlDataReader["LabelName"].ToString(); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionCategory.CategoryID = int.Parse(oSqlDataReader["CategoryID"].ToString()); oPopulatedQuestionSetup.QuestionSetupQuestion.QuestionCategory.CategoryName = oSqlDataReader["CategoryName"].ToString(); oListQuestionSetup.Add(oPopulatedQuestionSetup); } oSqlDataReader.Close(); foreach (QuestionSetup oQuestionSetupInList in oListQuestionSetup) { if (oQuestionSetupInList.QuestionSetupQuestion.QuestionQuestionType.QuestionTypeID == 0) { sSelect = "select EX_Objective.ObjectiveQuestionID,EX_Objective.ObjectiveAnswer," +" EX_Objective.ObjectiveAnswerIsValid from EX_Objective" + " where EX_Objective.ObjectiveQuestionID = '" + oQuestionSetupInList.QuestionSetupQuestion.QuestionID + "'"; List<Choice> oListChoice = new List<Choice>(); oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { Choice oChoice = new Choice(); oChoice.ChoiceName = oSqlDataReader["ObjectiveAnswer"].ToString(); oChoice.ChoiceIsValid = Convert.ToBoolean(oSqlDataReader["ObjectiveAnswerIsValid"].ToString()); oListChoice.Add(oChoice); } oSqlDataReader.Close(); oQuestionSetupInList.QuestionSetupQuestion.QuestionObjectiveType.ListOfChoices = oListChoice; } } oResult.ResultObject = oListQuestionSetup; oResult.ResultMessage = "LoadAllQuestionsOfAnExam success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during LoadAllQuestionsOfAnExam..."; oResult.ResultException = oEx; logger.Info("Exception LoadAllQuestionsOfAnExam QuestionDAO+DAO", oEx); } finally { if (oSqlDataReader != null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End LoadAllQuestionsOfAnExam QuestionDAO+DAO"); return oResult; }
/// <summary> /// This Method add candidates from existing candidates for a Selected Exam. /// The candidates to be add for Selected Exam, the Selected Exam duration can not overlap with other exams. /// </summary> /// <param name="oListCandidateForExam"> It takes List<CandidateForExam> Object </param> /// <param name="iArrCheck"> It is an array of Integer which indicates the marked candidates to add for the Selected Exam</param> /// <param name="oSelectedExam"> It takes Exam Object </param> /// <returns> It returns Result Object </returns> public Result AddCandidatesFromExistingCandidate(List<CandidateForExam> oListOfCandidateForExamForGrid, int[] iArrCheck, Exam oSelectedExam) { logger.Info("Start AddCandidatesFromExistingCandidate CandidateDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); List<String> oListString = new List<String>(); String sInsert = String.Empty; String sSelect = String.Empty; SqlDataReader oSqlDataReader = null; int i = 0; try { for (i = 0; i < iArrCheck.Length; i++) { if (iArrCheck[i] == 1) { sSelect = "select EX_Exam.ExamID,EX_Exam.ExamName,EX_Exam.ExamTotalMarks,EX_Exam.ExamDateWithTime," +" EX_Exam.ExamDuration,EX_Exam.ExamConstraint" +" from EX_CandidateForExam inner join EX_Exam on EX_CandidateForExam.ExamID=EX_Exam.ExamID" +" where EX_CandidateForExam.CandidateID='" + oListOfCandidateForExamForGrid[i].CandidateForExamCandidate.CandidateCompositeID + "'"; oSqlDataReader = oDAOUtil.GetReader(sSelect); bool bNoMissMatch = true; // MissMatch with other exam duration while (oSqlDataReader.Read()) { DateTime oDateTimeExamStartTime =DateTime.Parse(oSqlDataReader["ExamDateWithTime"].ToString()); float fExamDuration = float.Parse(oSqlDataReader["ExamDuration"].ToString()); DateTime oDateTimeExamEndTime = oDateTimeExamStartTime.AddHours(fExamDuration); if (oSelectedExam.ExamDateWithStartingTime >= oDateTimeExamStartTime && oSelectedExam.ExamDateWithStartingTime <= oDateTimeExamEndTime) { bNoMissMatch = false; break; } } oSqlDataReader.Close(); if (bNoMissMatch) { sInsert = "if not exists(select EX_CandidateForExam.CandidateID from EX_CandidateForExam where" + " EX_CandidateForExam.CandidateID='" + oListOfCandidateForExamForGrid[i].CandidateForExamCandidate.CandidateCompositeID + "' and EX_CandidateForExam.ExamID='" + oSelectedExam.ExamID + "')" + " insert into EX_CandidateForExam(CandidateID,ExamID) values('" + oListOfCandidateForExamForGrid[i].CandidateForExamCandidate.CandidateCompositeID + "','" + oSelectedExam.ExamID + "')"; oListString.Add(sInsert); } } } if (oListString.Count >0 ) { if (oDAOUtil.ExecuteNonQuery(oListString)) { oResult.ResultObject = oListOfCandidateForExamForGrid; oResult.ResultMessage = "Successfully added the selected candidates..."; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "AddCandidatesFromExistingCandidate Fail..."; } } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "None of the selected candidates are set up..."; } } catch(Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "AddCandidatesFromExistingCandidate Exception..."; logger.Info("Exception AddCandidatesFromExistingCandidate CandidateDAO+DAO", oEx); } finally { if (oSqlDataReader != null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End AddCandidatesFromExistingCandidate CandidateDAO+DAO"); return oResult; }
/// <summary> /// This method sums the question categoty & question type wise obtain mark & total mark. /// </summary> /// <param name="oExam"> It takes Exam Object </param> /// <param name="oListCandidateMenu"> It takes List<CandidateMenu> Object </param> /// <returns> It returns Result Object </returns> public Result GetCandidateAVGMarksForTypeAndCategory(Exam oExam, List<CandidateMenu> oListCandidateMenu) { logger.Info("Start GetCandidateTotalMarksForTypeAndCategory ResultViewDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sSelect = String.Empty; SqlDataReader oSqlDataReader = null; //CandidateResultsView oCandidateResultsView = new CandidateResultsView(); //oCandidateResultsView.ListCandidates = new List<Candidate>(); //oCandidateResultsView.ListOfListCandidateResults = new List<List<CandidateMenu>>(); List<Candidate> oListCandidate = new List<Candidate>(); Object oObject = new Object(); try { DataTable dt = new DataTable(); DataColumn dcolName = new DataColumn("Name", typeof(System.String)); dt.Columns.Add(dcolName); float fTotalMarksForColumn = 0f; foreach (CandidateMenu oCandidateMenuInList in oListCandidateMenu) //columns { foreach (QuestionType oQuestionTypeInList in oCandidateMenuInList.CandidateMenuCategoryQuestionType) //columns { float fMarkForAColumn = 0f; object oObjectForMarkForAColumn = new object(); sSelect = " select sum(EX_QuestionGeneration.SetupQuestionMark) as TotalSetupMarkOfTypeOfCategory" + " from EX_QuestionGeneration inner join EX_Question on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID" + " inner join EX_QuestionType on EX_QuestionType.TypeID = EX_Question.QuestionTypeID" + " where EX_QuestionGeneration.ExamID='"+oExam.ExamID+"'" + " and EX_Question.QuestionCategoryID='" + oCandidateMenuInList.CandidateMenuCategory.CategoryID + "'" + " and EX_QuestionType.TypeID='" + oQuestionTypeInList.QuestionTypeID + "'"; oObjectForMarkForAColumn = oDAOUtil.GetExecuteScalar(sSelect); if (oObjectForMarkForAColumn.ToString().Length <= 0) { fMarkForAColumn = 0f; } else { fMarkForAColumn = float.Parse(oObjectForMarkForAColumn.ToString()); } fTotalMarksForColumn = fTotalMarksForColumn + fMarkForAColumn; DataColumn dcolCategory = new DataColumn(oCandidateMenuInList.CandidateMenuCategory.CategoryName + "(" + oQuestionTypeInList.QuestionTypeName + ") = " + fMarkForAColumn.ToString(), typeof(System.Double)); dt.Columns.Add(dcolCategory); } } DataColumn dcolTotal = new DataColumn("Total = " + fTotalMarksForColumn.ToString(), typeof(System.Double)); dt.Columns.Add(dcolTotal); sSelect = "select distinct EX_CandidateExam.CandidateID,EX_Candidate.Name from" +" EX_Candidate inner join EX_CandidateExam on " +" EX_Candidate.CompositeCandidateID=EX_CandidateExam.CandidateID" +" where EX_CandidateExam.ExamID='"+oExam.ExamID+"'"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { Candidate oCandidate = new Candidate(); oCandidate.CandidateCompositeID = oSqlDataReader["CandidateID"].ToString(); oCandidate.CandidateName = oSqlDataReader["Name"].ToString(); oListCandidate.Add(oCandidate); } oSqlDataReader.Close(); //int iCandidateCount = 0; foreach (Candidate oCandidateInList in oListCandidate) { DataRow drow = dt.NewRow(); int iColumnIndex = 0; //********orginal*****// //drow["Name"] = oCandidateInList.CandidateName; drow[iColumnIndex++] = oCandidateInList.CandidateName; //*******end orginal**********// float fTotalMarks = 0f; //List<CandidateMenu> oListCandidateMenuForView = new List<CandidateMenu>(); //for (int i = 0; i < oListCandidateMenu.Count; i++) //{ // oListCandidateMenuForView.Add(oListCandidateMenu[i]); //} //oCandidateResultsView.ListOfListCandidateResults.Add(oListCandidateMenuForView); foreach (CandidateMenu oCandidateMenuInList in oListCandidateMenu) { //int iTypeCount = 0; foreach (QuestionType oQuestionTypeInList in oCandidateMenuInList.CandidateMenuCategoryQuestionType) { //sSelect = "select sum(EX_CandidateExam.ObtainMark) as AvgTypeMark, EX_QuestionType.TypeID,EX_QuestionType.TypeName from EX_QuestionType inner join EX_Question on EX_QuestionType.TypeID = EX_Question.QuestionTypeID inner join EX_QuestionGeneration on EX_Question.QuestionID= EX_QuestionGeneration.QuestionID inner join EX_CandidateExam on EX_QuestionGeneration.QuestionID = EX_CandidateExam.QuestionID group by EX_CandidateExam.ExamID,EX_CandidateExam.CandidateID,EX_Question.QuestionCategoryID,EX_QuestionType.TypeID,EX_QuestionType.TypeName //having EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.CandidateID='" + oCandidateInList.CandidateCompositeID + "' //and EX_Question.QuestionCategoryID='" + oCandidateMenuInList.CandidateMenuCategory.CategoryID + "' and EX_QuestionType.TypeID='" + oQuestionTypeInList.QuestionTypeID+ "'"; sSelect = "select sum(EX_CandidateExam.ObtainMark) as AvgTypeMark, EX_QuestionType.TypeID,EX_QuestionType.TypeName" +" from EX_CandidateExam inner join EX_Question on EX_CandidateExam.QuestionID=EX_Question.QuestionID" +" inner join EX_QuestionType on EX_QuestionType.TypeID = EX_Question.QuestionTypeID" + " where EX_CandidateExam.ExamID='" + oExam.ExamID + "' and" + " EX_CandidateExam.CandidateID='" + oCandidateInList.CandidateCompositeID + "'" +" and EX_Question.QuestionCategoryID='" + oCandidateMenuInList.CandidateMenuCategory.CategoryID + "'" + " and EX_QuestionType.TypeID='" + oQuestionTypeInList.QuestionTypeID + "'" +" group by EX_CandidateExam.ExamID,EX_CandidateExam.CandidateID,EX_Question.QuestionCategoryID," +" EX_QuestionType.TypeID,EX_QuestionType.TypeName"; oObject = oDAOUtil.GetExecuteScalar(sSelect); if (oObject.ToString().Length <= 0) { //oQuestionTypeInList.AVGQuestionTypeMark = 0f; //********orginal*****// //drow[oCandidateMenuInList.CandidateMenuCategory.CategoryName + "(" + oQuestionTypeInList.QuestionTypeName + ")"] = 0f; drow[iColumnIndex++] = 0f; //*******end orginal**********// fTotalMarks = fTotalMarks + 0f; //oCandidateMenuInList.CandidateMenuCategoryQuestionType[iTypeCount].AVGQuestionTypeMark = 0f; } else { //oQuestionTypeInList.AVGQuestionTypeMark = float.Parse(oObject.ToString()); //oCandidateMenuInList.CandidateMenuCategoryQuestionType[iTypeCount].AVGQuestionTypeMark = float.Parse(oObject.ToString()); //********orginal*****// //drow[oCandidateMenuInList.CandidateMenuCategory.CategoryName + "(" + oQuestionTypeInList.QuestionTypeName + ")"] = float.Parse(oObject.ToString()); drow[iColumnIndex++] = float.Parse(oObject.ToString()); //*******end orginal**********// fTotalMarks = fTotalMarks + float.Parse(oObject.ToString()); } //iTypeCount=iTypeCount+1; } } //iCandidateCount = iCandidateCount + 1; //oCandidateResultsView.ListOfListCandidateResults.Add(oListCandidateMenu); //********orginal*****// //drow["Total"] = fTotalMarks; drow[iColumnIndex++] = fTotalMarks; //*******end orginal**********// dt.Rows.Add(drow); } oResult.ResultObject = dt; oResult.ResultMessage = "GetCandidateAVGMarksForTypeAndCategory Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "GetCandidateAVGMarksForTypeAndCategory Exception..."; logger.Info("Exception GetCandidateAVGMarksForTypeAndCategory ResultViewDAO+DAO", oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End GetCandidateAVGMarksForTypeAndCategory ResultViewDAO+DAO"); return oResult; }
//r /// <summary> /// This method loads the categories to set them in session /// </summary> /// <returns> It returns Result Object </returns> public Result CategoryGetFromDatabaseForSetSession() { //new CLogger("Start CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", ELogLevel.Debug); logger.Info("Start CategoryGetFromDatabaseForSetSession CategoryDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sSelectCategory = String.Empty; String sCategoryName = String.Empty; SqlDataReader oSqlDataReader = null; List<Category> oListCategory = new List<Category>(); int iCategoryID = 0; sSelectCategory = "select CategoryID,CategoryName from EX_Category"; try { oSqlDataReader = oDAOUtil.GetReader(sSelectCategory); while (oSqlDataReader.Read()) { Category oCategory = new Category(); iCategoryID = int.Parse(oSqlDataReader["CategoryID"].ToString()); sCategoryName = oSqlDataReader["CategoryName"].ToString(); oCategory.CategoryID = iCategoryID; oCategory.CategoryName = sCategoryName; oListCategory.Add(oCategory); } oSqlDataReader.Close(); oResult.ResultObject = oListCategory; oResult.ResultMessage = "Category Get success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during Category Get..."; logger.Info("Exception CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", oEx); //new CLogger("Exception CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out CategoryGetFromDatabaseForSetSession CategoryDAO+DAO", ELogLevel.Debug); ; logger.Info("End CategoryGetFromDatabaseForSetSession CategoryDAO+DAO"); return oResult; }
/// <summary> /// This method checks the systemuser login /// </summary> /// <param name="oSystemUser"> It takes SystemUser Object </param> /// <returns> It returns Result Object </returns> public Result SystemUserLogin(SystemUser oSystemUser) { logger.Info("Start SystemUserLogin SystemUserDAO+DAO"); Result oResult = new Result(); SqlDataReader oSqlDataReader = null; try { DAOUtil oDAOUtil = new DAOUtil(); SystemUser oPopulatedSystemUser = new SystemUser(); Boolean flag = false; String sSelect = "select SystemUserID,SystemUserName,SystemUserPassword,EmailAddress from EX_SystemUser where SystemUserName='******' and SystemUserPassword='******' and DeleteTime is NULL"; oSqlDataReader = oDAOUtil.GetReader(sSelect); if (oSqlDataReader.HasRows) { while (oSqlDataReader.Read()) { oPopulatedSystemUser.SystemUserID = new Guid(oSqlDataReader["SystemUserID"].ToString()); oPopulatedSystemUser.SystemUserName = oSqlDataReader["SystemUserName"].ToString(); oPopulatedSystemUser.SystemUserPassword = oSqlDataReader["SystemUserPassword"].ToString(); oPopulatedSystemUser.SystemUserEmail = oSqlDataReader["EmailAddress"].ToString(); flag = true; } oSqlDataReader.Close(); if (flag) { oResult.ResultObject = oPopulatedSystemUser; oResult.ResultMessage = "Login Success..."; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "System User Login Fail..."; } } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "System User Not Found..."; } } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "SystemUserLogin Exception..."; oResult.ResultException = oEx; logger.Info("Exception SystemUserLogin SystemUserDAO+DAO",oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End SystemUserLogin SystemUserDAO+DAO"); return oResult; }
/// <summary> /// This method evaluate objective answers for all candidate of an exam. /// Only the administrator can call this method. /// It evaluates automatically /// </summary> /// <param name="oListCandidateForExamForGrid"> It takes List<CandidateForExam> Object </param> /// <param name="oExam"> It takes Exam Object </param> /// <param name="oSystemUser"> It takes SystemUser Object </param> /// <returns> It returns Result Object </returns> public Result EvaluateObjectiveAnswersForAllCandidateOfAnExma(List<CandidateForExam> oListCandidateForExamForGrid, SystemUser oSystemUser, Exam oExam) { //new CLogger("Start EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", ELogLevel.Debug); logger.Info("Start EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; try { foreach (CandidateForExam oCandidateForExamInList in oListCandidateForExamForGrid) { List<CandidateAnswerQuestion> oListCandidateAnswerQuestion = new List<CandidateAnswerQuestion>(); oResult = LoadQuestionsForACandidateWhichSetupByAParticularUser(oCandidateForExamInList.CandidateForExamCandidate.CandidateCompositeID, oExam, oSystemUser, true); if (oResult.ResultIsSuccess) { oListCandidateAnswerQuestion = (List<CandidateAnswerQuestion>)oResult.ResultObject; foreach (CandidateAnswerQuestion oCandidateAnswerQuestionInList in oListCandidateAnswerQuestion) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID == 0) { if (oSystemUser.SystemUserName.ToLower().Equals("administrator")) { //sSelect = "select EX_Objective.ObjectiveQuestionID,EX_Objective.ObjectiveAnswer,EX_Objective.ObjectiveAnswerIsValid from EX_Objective inner join EX_Question on EX_Objective.ObjectiveQuestionID = EX_Question.QuestionID inner join EX_QuestionGeneration on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID inner join EX_CandidateExam on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID where EX_CandidateExam.QuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "' and EX_CandidateExam.CandidateID='" + oCandidateInList.CandidateCompositeID + "' and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "')"; //sSelect = "select distinct EX_Objective.ObjectiveQuestionID,EX_Objective.ObjectiveAnswer," //+" EX_Objective.ObjectiveAnswerIsValid from EX_Objective inner join EX_Question" //+" on EX_Objective.ObjectiveQuestionID = EX_Question.QuestionID inner join EX_QuestionGeneration" //+" on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID inner join EX_CandidateExam" //+" on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID" //+" where EX_CandidateExam.QuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "'" //+" and EX_CandidateExam.CandidateID='" + oCandidateForExamInList.CandidateForExamCandidate.CandidateCompositeID + "'" //+" and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID" //+" in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration" //+" where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "')"; sSelect = "select EX_Objective.ObjectiveQuestionID,EX_Objective.ObjectiveAnswer," + " EX_Objective.ObjectiveAnswerIsValid from EX_Objective inner join EX_CandidateExam" + " on EX_CandidateExam.QuestionID=EX_Objective.ObjectiveQuestionID" + " where EX_CandidateExam.QuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "'" + " and EX_CandidateExam.CandidateID='" + oCandidateForExamInList.CandidateForExamCandidate.CandidateCompositeID + "'" + " and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID" + " in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration" + " where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "')"; } String sCheckValid = String.Empty; String sCheckName = String.Empty; List<Choice> oListChoices = new List<Choice>(); oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { Choice oChoice = new Choice(); oChoice.ChoiceIsValid = Boolean.Parse(oSqlDataReader["ObjectiveAnswerIsValid"].ToString()); oChoice.ChoiceName = oSqlDataReader["ObjectiveAnswer"].ToString(); oListChoices.Add(oChoice); } oSqlDataReader.Close(); oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices = oListChoices; } } oCandidateForExamInList.CadidateCandidateExam.CandidateAnsweredQuestions = oListCandidateAnswerQuestion; } } oResult.ResultObject = oListCandidateForExamForGrid; oResult.ResultMessage = "Objective answers are evaluated for all candidate of this exam..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured at evaluation of objective answers for all candidate of this exam..."; logger.Info("Exception EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", oEx); //new CLogger("Exception EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO", ELogLevel.Debug); ; logger.Info("End EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessDAO+DAO"); return oResult; }
//r /// <summary> /// This method insert a category if it is not existed /// </summary> /// <param name="oCategory"> It takes Category Object </param> /// <returns> It returns Result Object </returns> public Result CategoryEntry(Category oCategory) { //new CLogger("Start CategoryEntry CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start CategoryEntry CategoryDAO+DAO", ELogLevel.Debug); logger.Info("Start CategoryEntry CategoryDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelectCategory = String.Empty; String sInsertCategory = String.Empty; List<String> sListCategory = new List<String>(); bool flag = true; sSelectCategory = "select CategoryName from EX_Category where CategoryName='" + oCategory.CategoryName + "'"; try { oSqlDataReader = oDAOUtil.GetReader(sSelectCategory); if (oSqlDataReader.HasRows) { flag = false; } oSqlDataReader.Close(); if (flag) { sInsertCategory = "insert into EX_Category(CategoryName) values('" + oCategory.CategoryName + "')"; sListCategory.Add(sInsertCategory); if (oDAOUtil.ExecuteNonQuery(sListCategory)) { oResult.ResultObject = oCategory; oResult.ResultMessage = "Category Entry Success..."; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Category Entry Failed..."; } } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Category is already Existed"; } } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during Category Entry..."; oResult.ResultException = oEx; logger.Info("Exception CategoryEntry CategoryDAO+DAO", oEx); //new CLogger("Exception CategoryEntry CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception CategoryEntry CategoryDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out CategoryEntry CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out CategoryEntry CategoryDAO+DAO", ELogLevel.Debug); ; logger.Info("End CategoryEntry CategoryDAO+DAO"); return oResult; }
/// <summary> /// This method Load questions at the time of candidate evaluation, if that system user setup questions. /// The system user can see the questions which are setup by him /// Administrator can always see all questions /// </summary> /// <param name="sCandidateID"> It takes string Object </param> /// <param name="oExam"> It takes Exam Object </param> /// <param name="oSystemUser"> It takes SystemUser Object </param> /// <param name="flagForEvaluation"> It takes Boolean Object.It is only to show the Objective answer Name </param> /// <returns> It returns Result Object </returns> public Result LoadQuestionsForACandidateWhichSetupByAParticularUser(string sCandidateID, Exam oExam, SystemUser oSystemUser, Boolean flagForEvaluation) { //new CLogger("Start LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", ELogLevel.Debug); logger.Info("Start LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; String sTempAnswer = String.Empty; String sObtainMark = String.Empty; List<CandidateAnswerQuestion> oListCandidateAnswerQuestion = new List<CandidateAnswerQuestion>(); float f =0f; try { if (oSystemUser.SystemUserName.ToLower().Equals("administrator")) { //sSelect = "select EX_CandidateExam.AnswerStringOrBits from EX_CandidateExam inner join EX_QuestionGeneration on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID where EX_CandidateExam.CandidateID='" + sCandidateID + "' and EX_CandidateExam.ExamID='"+oExam.ExamID+"' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "')"; //sSelect = "select EX_CandidateExam.AnswerStringOrBits,EX_Question.QuestionID,EX_Question.QuestionText,EX_Question.QuestionDefaultMark,EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID from EX_CandidateExam inner join EX_QuestionGeneration on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID inner join EX_Question on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID where EX_CandidateExam.CandidateID='" + sCandidateID + "' and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "') order by EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID asc"; //sSelect = "select distinct EX_CandidateExam.AnswerStringOrBits,EX_CandidateExam.ObtainMark, EX_Question.QuestionID,EX_Question.QuestionText,EX_Question.QuestionDefaultMark,EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID from EX_Question inner join EX_QuestionGeneration on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID inner join EX_CandidateExam on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID where EX_CandidateExam.CandidateID='" + sCandidateID + "' and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "') order by EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID asc"; sSelect = "select distinct EX_CandidateExam.AnswerStringOrBits,EX_CandidateExam.ObtainMark," +" EX_CandidateExam.AnswerAttachmentPath, EX_Question.QuestionID," +" EX_Question.QuestionText,EX_QuestionGeneration.SetupQuestionMark," +" EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID" +" from EX_Question inner join EX_QuestionGeneration on" +" EX_Question.QuestionID = EX_QuestionGeneration.QuestionID" +" inner join EX_CandidateExam on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID" +" where EX_CandidateExam.CandidateID='" + sCandidateID + "'" +" and EX_QuestionGeneration.ExamID='" + oExam.ExamID + "'" +" and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and" +" EX_CandidateExam.QuestionID in" +" (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration" +" where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "')" +" order by EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID asc"; } else { //sSelect = "select EX_CandidateExam.AnswerStringOrBits from EX_CandidateExam inner join EX_QuestionGeneration on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID where EX_CandidateExam.CandidateID='" + sCandidateID + "' and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "')"; //sSelect = "select EX_CandidateExam.AnswerStringOrBits,EX_Question.QuestionID,EX_Question.QuestionText,EX_Question.QuestionDefaultMark,EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID from EX_CandidateExam inner join EX_QuestionGeneration on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID inner join EX_Question on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID where EX_CandidateExam.CandidateID='" + sCandidateID + "' and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "') order by EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID asc"; //sSelect = "select distinct EX_CandidateExam.AnswerStringOrBits,EX_CandidateExam.ObtainMark, EX_Question.QuestionID,EX_Question.QuestionText,EX_Question.QuestionDefaultMark,EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID from EX_Question inner join EX_QuestionGeneration on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID inner join EX_CandidateExam on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID where EX_CandidateExam.CandidateID='" + sCandidateID + "' and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and EX_CandidateExam.QuestionID in (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "') order by EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID asc"; sSelect = "select distinct EX_CandidateExam.AnswerStringOrBits,EX_CandidateExam.ObtainMark," +" EX_CandidateExam.AnswerAttachmentPath, EX_Question.QuestionID," +" EX_Question.QuestionText,EX_QuestionGeneration.SetupQuestionMark," +" EX_Question.QuestionTypeID,EX_Question.QuestionCategoryID" +" from EX_Question inner join EX_QuestionGeneration on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID" +" inner join EX_CandidateExam on EX_CandidateExam.QuestionID=EX_QuestionGeneration.QuestionID" +" where EX_CandidateExam.CandidateID='" + sCandidateID + "'" +" and EX_QuestionGeneration.ExamID='" + oExam.ExamID + "'" +" and EX_CandidateExam.ExamID='" + oExam.ExamID + "' and" +" EX_CandidateExam.QuestionID in" +" (select EX_QuestionGeneration.QuestionID from EX_QuestionGeneration" +" where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and" +" EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "')" +" order by EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID asc"; } oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { CandidateAnswerQuestion oCandidateAnswerQuestion = new CandidateAnswerQuestion(); sTempAnswer = oSqlDataReader["AnswerStringOrBits"].ToString(); sObtainMark = oSqlDataReader["ObtainMark"].ToString(); if (float.TryParse(sObtainMark, out f)) { oCandidateAnswerQuestion.ObtainMark = float.Parse(sObtainMark); } else { oCandidateAnswerQuestion.ObtainMark = 0f; } oCandidateAnswerQuestion.sAnswerAttachFilePath = oSqlDataReader["AnswerAttachmentPath"].ToString(); oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionID = new Guid(oSqlDataReader["QuestionID"].ToString()); oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionText = oSqlDataReader["QuestionText"].ToString(); oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionDefaultMark = float.Parse(oSqlDataReader["SetupQuestionMark"].ToString()); oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionCategory.CategoryID = int.Parse(oSqlDataReader["QuestionCategoryID"].ToString()); //Objective@True:True:False:True: //Descriptive@IQ Des Exam: //DES@IQ String sTempObjective = String.Empty; String sCheck = String.Empty; List<Choice> oListAnswers = new List<Choice>(); int iColonIndex = 0; if (sTempAnswer.IndexOf("Objective@", 0)>=0) { sTempObjective = sTempAnswer.Substring(sTempAnswer.IndexOf("@",0)+1); while (sTempObjective != String.Empty) { iColonIndex = sTempObjective.IndexOf(":"); if(iColonIndex>=0) { sCheck = sTempObjective.Substring(0, iColonIndex); Choice oChoice = new Choice(); oChoice.ChoiceIsValid = Boolean.Parse(sCheck); oListAnswers.Add(oChoice); if (iColonIndex + 1 < sTempObjective.Length) { sTempObjective = sTempObjective.Substring(iColonIndex + 1, sTempObjective.Length - iColonIndex - 1); } else { sTempObjective = String.Empty; } } } oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers = oListAnswers; oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID = 0; } else if (sTempAnswer.IndexOf("Descriptive@", 0)>=0) { oCandidateAnswerQuestion.DescriptiveQuestionAnswerText = sTempAnswer.Substring(sTempAnswer.IndexOf("@",0)+1,sTempAnswer.Length-(sTempAnswer.IndexOf("@",0)+1)-1); oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID = 1; } oListCandidateAnswerQuestion.Add(oCandidateAnswerQuestion); } oSqlDataReader.Close(); //this is for show the Objective answer Name if (!flagForEvaluation) { foreach (CandidateAnswerQuestion oCandidateAnswerQuestionInList in oListCandidateAnswerQuestion) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID == 0) { if (oSystemUser.SystemUserName.ToLower().Equals("administrator")) { sSelect = "select EX_Objective.ObjectiveQuestionID,EX_Objective.ObjectiveAnswer," + " EX_Objective.ObjectiveAnswerIsValid" + " from EX_Objective where" + " EX_Objective.ObjectiveQuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "'"; } else { sSelect = "select EX_Objective.ObjectiveQuestionID,EX_Objective.ObjectiveAnswer," + " EX_Objective.ObjectiveAnswerIsValid" + " from EX_Objective where" + " EX_Objective.ObjectiveQuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "'"; } //String sCheckValid = String.Empty; //String sCheckName = String.Empty; List<Choice> oListChoices = new List<Choice>(); oSqlDataReader = oDAOUtil.GetReader(sSelect); int iChoiceCounter = -1; while (oSqlDataReader.Read()) { iChoiceCounter = iChoiceCounter + 1; Choice oChoice = new Choice(); oChoice.ChoiceIsValid = Boolean.Parse(oSqlDataReader["ObjectiveAnswerIsValid"].ToString()); oListChoices.Add(oChoice); //oChoice.ChoiceName = oSqlDataReader["ObjectiveAnswer"].ToString(); oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers[iChoiceCounter].ChoiceName = oSqlDataReader["ObjectiveAnswer"].ToString(); } oSqlDataReader.Close(); oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices = oListChoices; } } } oResult.ResultObject = oListCandidateAnswerQuestion; oResult.ResultMessage = "LoadQuestionsForACandidateWhichSetupByAParticularUser Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "LoadQuestionsForACandidateWhichSetupByAParticularUser Exception..."; logger.Info("Exception LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", oEx); //new CLogger("Exception LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO", ELogLevel.Debug); ; logger.Info("End LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessDAO+DAO"); return oResult; }
/// <summary> /// This method Load Candidates According to SystemUser to evaluate candidates /// That means, if a system user setup questions for an exam then he can evaluate candidates /// Administrator can always evaluate candidates. /// </summary> /// <param name="oSystemUser"> It takes SystemUser Object </param> /// <param name="oExam"> It takes Exam Object </param> /// <returns> It returns Result Object </returns> public Result LoadCandidatesAccordingToSystemUserForEvaluate(SystemUser oSystemUser, Exam oExam) { //new CLogger("Start LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", ELogLevel.Debug); logger.Info("Start LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; List<CandidateForExam> oListCandidateForExam = new List<CandidateForExam>(); String sSelect = String.Empty; try { if (oSystemUser.SystemUserName.ToLower().Equals("administrator")) { //sSelect = "select distinct EX_Candidate.ExamID,EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword,EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,CvPath from EX_Candidate inner join EX_CandidateExam on EX_Candidate.CompositeCandidateID = EX_CandidateExam.CandidateID where EX_Candidate.ExamID='" + oExam.ExamID + "' and EX_Candidate.ExamID in (select EX_QuestionGeneration.ExamID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "')"; sSelect = "select distinct EX_CandidateForExam.ExamID,EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword,EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,EX_Candidate.CvPath" + " from EX_Candidate inner join EX_CandidateForExam on EX_Candidate.CompositeCandidateID=EX_CandidateForExam.CandidateID" + " inner join EX_CandidateExam on EX_CandidateForExam.ExamID=EX_CandidateExam.ExamID where EX_CandidateExam.ExamID='" + oExam.ExamID + "'" + " and EX_CandidateForExam.CandidateID=EX_CandidateExam.CandidateID" + " and EX_CandidateExam.ExamID in (select EX_QuestionGeneration.ExamID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "')"; } else { //sSelect = "select distinct EX_Candidate.ExamID,EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword,EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,CvPath from EX_Candidate inner join EX_CandidateExam on EX_Candidate.CompositeCandidateID = EX_CandidateExam.CandidateID where EX_Candidate.ExamID='" + oExam.ExamID + "' and EX_Candidate.ExamID in (select EX_QuestionGeneration.ExamID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "')"; sSelect = "select distinct EX_CandidateForExam.ExamID,EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword,EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,EX_Candidate.CvPath" + " from EX_Candidate inner join EX_CandidateForExam on EX_Candidate.CompositeCandidateID=EX_CandidateForExam.CandidateID" + " inner join EX_CandidateExam on EX_CandidateForExam.ExamID=EX_CandidateExam.ExamID where EX_CandidateExam.ExamID='" + oExam.ExamID + "'" + " and EX_CandidateForExam.CandidateID=EX_CandidateExam.CandidateID" + " and EX_CandidateExam.ExamID in (select EX_QuestionGeneration.ExamID from EX_QuestionGeneration where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "' and EX_QuestionGeneration.GeneratorID='" + oSystemUser.SystemUserID + "')"; } oSqlDataReader = oDAOUtil.GetReader(sSelect); while(oSqlDataReader.Read()) { CandidateForExam oCandidateForExam = new CandidateForExam(); oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID = new Guid(oSqlDataReader["ExamID"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID = oSqlDataReader["CompositeCandidateID"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidatePassword = oSqlDataReader["CandidatePassword"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateName = oSqlDataReader["Name"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastResult = float.Parse(oSqlDataReader["LastResult"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandiadteLastInstitution = oSqlDataReader["LastInstitution"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastPassingYear = int.Parse(oSqlDataReader["LastPassingYear"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandidateCvPath = oSqlDataReader["CvPath"].ToString(); oListCandidateForExam.Add(oCandidateForExam); } oSqlDataReader.Close(); oResult.ResultObject = oListCandidateForExam; oResult.ResultMessage = "LoadCandidatesAccordingToSystemUserForEvaluate Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "LoadCandidatesAccordingToSystemUserForEvaluate Exception..."; logger.Info("Exception LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", oEx); //new CLogger("Exception LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO", ELogLevel.Debug); ; logger.Info("End LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessDAO+DAO"); return oResult; }
/// <summary> /// This Method Show All Candidates with their information for an Exam. /// </summary> /// <param name="oExam"> It takes Exam Object </param> /// <returns> It returns Result Object </returns> public Result ShowAllCandidates(Exam oExam) { //new CLogger("Start ShowAllCandidates CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start ShowAllCandidates CandidateDAO+DAO", ELogLevel.Debug); logger.Info("Start ShowAllCandidates CandidateDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); List<CandidateForExam> oListCandidateForExam = new List<CandidateForExam>(); String sSelect = String.Empty; SqlDataReader oSqlDataReader = null; try { sSelect = "select EX_CandidateForExam.ExamID,CompositeCandidateID,CandidatePassword,Name," + " LastResult,LastResultRange,LastResultTypeName,LastInstitution,LastPassingYear,CvPath,EmailAddress,CandidatePicturePath" +" from EX_Candidate inner join EX_CandidateForExam on EX_Candidate.CompositeCandidateID=EX_CandidateForExam.CandidateID" +" where EX_CandidateForExam.ExamID='" + oExam.ExamID + "'"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { CandidateForExam oCandidateForExam = new CandidateForExam(); oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID = new Guid(oSqlDataReader["ExamID"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID = oSqlDataReader["CompositeCandidateID"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidatePassword = oSqlDataReader["CandidatePassword"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateName = oSqlDataReader["Name"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastResult = float.Parse(oSqlDataReader["LastResult"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandiadteLastInstitution = oSqlDataReader["LastInstitution"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastPassingYear = int.Parse(oSqlDataReader["LastPassingYear"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandidateCvPath = oSqlDataReader["CvPath"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateEmail = oSqlDataReader["EmailAddress"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastResultRange = float.Parse(oSqlDataReader["LastResultRange"].ToString()); oCandidateForExam.CandidateForExamCandidate.LastResultTypaName = oSqlDataReader["LastResultTypeName"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidatePicturePath = oSqlDataReader["CandidatePicturePath"].ToString(); oListCandidateForExam.Add(oCandidateForExam); } oSqlDataReader.Close(); oResult.ResultObject = oListCandidateForExam; oResult.ResultMessage = "Candidate Load Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Candidate Load Failed..."; oResult.ResultException = oEx; logger.Info("Exception ShowAllCandidates CandidateDAO+DAO", oEx); //new CLogger("Exception ShowAllCandidates CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception ShowAllCandidates CandidateDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out ShowAllCandidates CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out ShowAllCandidates CandidateDAO+DAO", ELogLevel.Debug); logger.Info("End ShowAllCandidates CandidateDAO+DAO"); return oResult; }
/// <summary> /// This Method Load Questions according to category, type for an exam. /// </summary> /// <param name="oCategory"> It takes Category Object </param> /// <param name="oQuestionType"> It takes QuestionType Object </param> /// <param name="oCandidateForExam"> It takes CandidateForExam Object </param> /// <returns> It returns Result Object </returns> public Result LoadQuestionsForACandidateInExamByCategoryAndType(Category oCategory, QuestionType oQuestionType, CandidateForExam oCandidateForExam) { logger.Info("Start LoadQuestionsForACandidateInExamByCategoryAndType CandidateExamProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; String sChoiceSelect = String.Empty; List<Question> oListQuestion = new List<Question>(); List<CandidateAnswerQuestion> oListCandidateAnswerQuestion = new List<CandidateAnswerQuestion>(); int i = 0; try { //sSelect = "select EX_Question.QuestionID,EX_Question.QuestionText,EX_Question.QuestionCreatorID,EX_Question.QuestionDefaultMark,EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID from EX_QuestionGeneration inner join EX_Question on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID where EX_QuestionGeneration.ExamID='" + oCandidate.CadidateCandidateExam.CandiadteExamExam.ExamID + "' order by EX_Question.QuestionCategoryID, EX_Question.QuestionTypeID asc"; //sSelect = "select EX_Question.QuestionID,EX_Question.QuestionText,EX_Question.QuestionCreatorID,EX_QuestionGeneration.SetupQuestionMark,EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID" //+" from EX_QuestionGeneration inner join EX_Question on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID" //+" where EX_QuestionGeneration.ExamID='" + oCandidate.CadidateCandidateExam.CandiadteExamExam.ExamID + "' order by EX_Question.QuestionCategoryID, EX_Question.QuestionTypeID asc"; sSelect = "select EX_Question.QuestionID,EX_Question.QuestionText," +" EX_Question.QuestionCreatorID,EX_QuestionGeneration.SetupQuestionMark" +" ,EX_Question.QuestionCategoryID,EX_Question.QuestionTypeID" +" from EX_QuestionGeneration inner join EX_Question on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID" +" where EX_QuestionGeneration.ExamID='" + oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID + "'" +" and EX_Question.QuestionCategoryID='" + oCategory.CategoryID + "'" +" and EX_Question.QuestionTypeID='" + oQuestionType.QuestionTypeID + "'"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { Question oQuestion = new Question(); oQuestion.QuestionID = new Guid(oSqlDataReader["QuestionID"].ToString()); oQuestion.QuestionText = oSqlDataReader["QuestionText"].ToString(); oQuestion.QuestionCreator.SystemUserID = new Guid(oSqlDataReader["QuestionCreatorID"].ToString()); oQuestion.QuestionDefaultMark = float.Parse(oSqlDataReader["SetupQuestionMark"].ToString()); oQuestion.QuestionCategory.CategoryID = int.Parse(oSqlDataReader["QuestionCategoryID"].ToString()); oQuestion.QuestionQuestionType.QuestionTypeID = int.Parse(oSqlDataReader["QuestionTypeID"].ToString()); oListQuestion.Add(oQuestion); } oSqlDataReader.Close(); foreach (Question oQuestionForChoice in oListQuestion) { if (oQuestionForChoice.QuestionQuestionType.QuestionTypeID == 0) { sChoiceSelect = "select ObjectiveAnswer,ObjectiveAnswerIsValid from EX_Objective where ObjectiveQuestionID='" + oQuestionForChoice.QuestionID + "'"; List<Choice> oListChoice = new List<Choice>(); oSqlDataReader = oDAOUtil.GetReader(sChoiceSelect); while (oSqlDataReader.Read()) { //prepare the choices for a particular questtion...... //and populate oListQuestion Choice oChoice = new Choice(); oChoice.ChoiceName = oSqlDataReader["ObjectiveAnswer"].ToString(); //oChoice.ChoiceIsValid = Convert.ToBoolean(oSqlDataReader["ObjectiveAnswerIsValid"].ToString()); oChoice.ChoiceIsValid = false; oListChoice.Add(oChoice); } oSqlDataReader.Close(); oQuestionForChoice.QuestionObjectiveType.ListOfChoices = oListChoice; } } for (i = 0; i < oListQuestion.Count; i++) { CandidateAnswerQuestion oCandidateAnswerQuestion = new CandidateAnswerQuestion(); oCandidateAnswerQuestion.QuestionForCandidateAnswer = oListQuestion[i]; oListCandidateAnswerQuestion.Add(oCandidateAnswerQuestion); } oResult.ResultObject = oListCandidateAnswerQuestion; oResult.ResultMessage = "Load Question for Exam Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception in Question Load for Exam..."; oResult.ResultException = oEx; logger.Info("Exception LoadQuestionsForACandidateInExamByCategoryAndType CandidateExamProcessDAO+DAO", oEx); } finally { if (oSqlDataReader != null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End LoadQuestionsForACandidateInExamByCategoryAndType CandidateExamProcessDAO+DAO"); return oResult; }
/// <summary> /// This method show all systemusers /// </summary> /// <returns> It returns Result Object </returns> public Result ShowAllSystemUsers() { logger.Info("Start ShowAllSystemUsers SystemUserDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; List<SystemUser> oListSystemUser = new List<SystemUser>(); String sSelect = String.Empty; DateTime oDateTime = DateTime.MinValue; try { sSelect = "select SystemUserID,SystemUserName,SystemUserPassword,DeleteTime,EmailAddress from EX_SystemUser where DeleteTime is NULL order by SystemUserName asc"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { SystemUser oSystemUser = new SystemUser(); oSystemUser.SystemUserID = new Guid(oSqlDataReader["SystemUserID"].ToString()); oSystemUser.SystemUserName = oSqlDataReader["SystemUserName"].ToString(); oSystemUser.SystemUserPassword = oSqlDataReader["SystemUserPassword"].ToString(); oSystemUser.SystemUserEmail = oSqlDataReader["EmailAddress"].ToString(); if (DateTime.TryParse(oSqlDataReader["DeleteTime"].ToString(), out oDateTime)) { oSystemUser.DeleteTime = DateTime.Parse(oSqlDataReader["DeleteTime"].ToString()); } oListSystemUser.Add(oSystemUser); } oSqlDataReader.Close(); oResult.ResultObject = oListSystemUser; oResult.ResultMessage = "System User Load Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "System User Show Exception..."; logger.Info("Exception ShowAllSystemUsers SystemUserDAO+DAO", oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End ShowAllSystemUsers SystemUserDAO+DAO"); return oResult; }
/// <summary> /// This Method Load Question Categories With Type of an exam For A Candidate. /// For example: (Category: Math,IQ,English,etc...) (Only Two Type: Objective, Descriptive) /// </summary> /// <param name="oCandidateForExam"> It takes CandidateForExam Object </param> /// <returns> It returns Result Object </returns> public Result LoadCategoriesWithType(CandidateForExam oCandidateForExam) { //new CLogger("Start LoadCategoriesWithType CandidateExamProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start LoadCategoriesWithType CandidateExamProcessDAO+DAO", ELogLevel.Debug); logger.Info("Start LoadCategoriesWithType CandidateExamProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); SqlDataReader oSqlDataReader = null; String sSelect = String.Empty; List<CandidateMenu> oListCandidateMenu = new List<CandidateMenu>(); try { sSelect = "select distinct EX_Category.CategoryID, EX_Category.CategoryName from" +" EX_Category inner join EX_Question on EX_Category.CategoryID=EX_Question.QuestionCategoryID" +" inner join EX_QuestionGeneration on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID" + " where EX_QuestionGeneration.ExamID='" + oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID + "'" +" order by EX_Category.CategoryID asc"; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { CandidateMenu oCandidateMenu = new CandidateMenu(); oCandidateMenu.CandidateMenuCategory.CategoryID = int.Parse(oSqlDataReader["CategoryID"].ToString()); oCandidateMenu.CandidateMenuCategory.CategoryName = oSqlDataReader["CategoryName"].ToString(); oListCandidateMenu.Add(oCandidateMenu); } oSqlDataReader.Close(); foreach (CandidateMenu oCandidateMenuInList in oListCandidateMenu) { sSelect = "select distinct EX_QuestionType.TypeID, EX_QuestionType.TypeName" +" from EX_QuestionType inner join EX_Question on EX_QuestionType.TypeID=EX_Question.QuestionTypeID" + " inner join EX_QuestionGeneration on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID where EX_QuestionGeneration.ExamID='" + oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID + "' and EX_Question.QuestionCategoryID ='" + oCandidateMenuInList.CandidateMenuCategory.CategoryID + "' order by EX_QuestionType.TypeID asc"; List<QuestionType> oListQuestionType = new List<QuestionType>(); oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { QuestionType oQuestionType = new QuestionType(); oQuestionType.QuestionTypeID = int.Parse(oSqlDataReader["TypeID"].ToString()); oQuestionType.QuestionTypeName = oSqlDataReader["TypeName"].ToString(); oListQuestionType.Add(oQuestionType); } oSqlDataReader.Close(); foreach (QuestionType oQuestionTypeInList in oListQuestionType) { sSelect = "select count(EX_Question.QuestionID) as TotalQuestions from EX_Question inner join EX_QuestionGeneration on EX_QuestionGeneration.QuestionID=EX_Question.QuestionID where EX_QuestionGeneration.ExamID='" + oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID + "' and EX_Question.QuestionCategoryID ='" + oCandidateMenuInList.CandidateMenuCategory.CategoryID + "' and EX_Question.QuestionTypeID='" + oQuestionTypeInList.QuestionTypeID + "'"; oQuestionTypeInList.QuestionTypeTotalQuestions = int.Parse(oDAOUtil.GetExecuteScalar(sSelect).ToString()); } oCandidateMenuInList.CandidateMenuCategoryQuestionType = oListQuestionType; } oResult.ResultObject = oListCandidateMenu; oResult.ResultMessage = "Candidate Menu Category with type Load Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception in Candidate Menu Category with type Load for Candidate..."; oResult.ResultException = oEx; logger.Info("Exception LoadCategoriesWithType CandidateExamProcessDAO+DAO", oEx); //new CLogger("Exception LoadCategoriesWithType CandidateExamProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception LoadCategoriesWithType CandidateExamProcessDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out LoadCategoriesWithType CandidateExamProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out LoadCategoriesWithType CandidateExamProcessDAO+DAO", ELogLevel.Debug); ; logger.Info("End LoadCategoriesWithType CandidateExamProcessDAO+DAO"); return oResult; }
/// <summary> /// This Method varifies CandidateLogin. If he is not appeared for an exam then Login is success. /// He must login between an exam duration /// </summary> /// <param name="oCandidate"> It takes Candidate Object </param> /// <returns> It returns Result Object </returns> public Result CandidateLogin(Candidate oCandidate) { //new CLogger("Start CandidateLogin CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start CandidateLogin CandidateDAO+DAO", ELogLevel.Debug); logger.Info("Start CandidateLogin CandidateDAO+DAO"); Result oResult = new Result(); //Candidate oPopulatedCandidate = new Candidate(); CandidateForExam oCandidateForExam = new CandidateForExam(); Exam oPopulatedExam = new Exam(); DAOUtil oDAOUtil = new DAOUtil(); String sSelect = String.Empty; SqlDataReader oSqlDataReader = null; bool bIsCandidateFound = false; bool bIsBetweenLoginTime = false; //sSelect = "select EX_Exam.ExamDateWithTime,EX_Exam.ExamDuration,EX_Candidate.ExamID,EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword,EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,EX_Candidate.CvPath,EX_Candidate.CandidateIDInt,EX_Candidate.CandidateID from EX_Candidate,EX_Exam where ExamID in (select ExamID from EX_Candidate where EX_Candidate.CompositeCandidateID='" + oCandidate.CandidateCompositeID + "' and EX_Candidate.CandidatePassword='******')"; //sSelect = "select EX_Exam.ExamName,EX_Exam.ExamDateWithTime,EX_Exam.ExamDuration,EX_Exam.ExamTotalMarks,EX_Exam.ExamConstraint,EX_Exam.ExamID," //+" EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword,EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,EX_Candidate.CvPath" //+" from EX_Candidate inner join EX_CandidateForExam on EX_Candidate.CompositeCandidateID=EX_CandidateForExam.CandidateID" //+" inner join EX_Exam on EX_CandidateForExam.ExamID=EX_Exam.ExamID" //+" where EX_Candidate.EmailAddress='" + oCandidate.CandidateEmail + "' and EX_Candidate.CandidatePassword='******'" //+" and EX_Candidate.CompositeCandidateID not in" //+" (select EX_CandidateExam.CandidateID from" //+" EX_Candidate inner join EX_CandidateForExam on EX_Candidate.CompositeCandidateID =EX_CandidateForExam.CandidateID" //+" inner join EX_CandidateExam on EX_CandidateForExam.ExamID=EX_CandidateExam.ExamID" //+" where EX_Candidate.EmailAddress='" + oCandidate.CandidateEmail + "')"; sSelect = " select EX_Exam.ExamName,EX_Exam.ExamDateWithTime,EX_Exam.ExamDuration,EX_Exam.ExamTotalMarks," + " EX_Exam.ExamConstraint,EX_Exam.ExamID, EX_Candidate.CompositeCandidateID,EX_Candidate.CandidatePassword," + " EX_Candidate.Name,EX_Candidate.LastResult,EX_Candidate.LastInstitution,EX_Candidate.LastPassingYear,EX_Candidate.CvPath" + " from EX_Candidate inner join EX_CandidateForExam on EX_Candidate.CompositeCandidateID=EX_CandidateForExam.CandidateID" + " inner join EX_Exam on EX_CandidateForExam.ExamID=EX_Exam.ExamID" + " where EX_Candidate.EmailAddress='" + oCandidate.CandidateEmail + "' and" + " EX_Candidate.CandidatePassword='******' and EX_CandidateForExam.CandidateID not in" + " (select EX_CandidateExam.CandidateID from EX_CandidateExam where" + " EX_CandidateExam.ExamID=EX_CandidateForExam.ExamID and EX_CandidateExam.CandidateID=EX_CandidateForExam.CandidateID)"; try { DateTime oDateTime = DateTime.MinValue; float fDuration = 0f; Guid gExamID = Guid.Empty; oSqlDataReader = oDAOUtil.GetReader(sSelect); while (oSqlDataReader.Read()) { oDateTime = DateTime.Parse(oSqlDataReader["ExamDateWithTime"].ToString()); fDuration = float.Parse(oSqlDataReader["ExamDuration"].ToString()); gExamID = new Guid(oSqlDataReader["ExamID"].ToString()); oPopulatedExam.ExamID = gExamID; oPopulatedExam.ExamConstraint = int.Parse(oSqlDataReader["ExamConstraint"].ToString()); oPopulatedExam.ExamTotalMarks = int.Parse(oSqlDataReader["ExamTotalMarks"].ToString()); oPopulatedExam.ExamDateWithStartingTime = oDateTime; oPopulatedExam.ExamDurationinHour = fDuration; oPopulatedExam.ExamName = oSqlDataReader["ExamName"].ToString(); oCandidateForExam.CadidateCandidateExam.CandiadteExamExam = oPopulatedExam; oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID = oSqlDataReader["CompositeCandidateID"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidatePassword = oSqlDataReader["CandidatePassword"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateName = oSqlDataReader["Name"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastResult = float.Parse(oSqlDataReader["LastResult"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandiadteLastInstitution = oSqlDataReader["LastInstitution"].ToString(); oCandidateForExam.CandidateForExamCandidate.CandidateLastPassingYear = int.Parse(oSqlDataReader["LastPassingYear"].ToString()); oCandidateForExam.CandidateForExamCandidate.CandidateCvPath = oSqlDataReader["CvPath"].ToString(); if (oDateTime != null && fDuration > 0f) { TimeSpan oTimeSpan = new TimeSpan(); oTimeSpan = oCandidate.CandidateLoginTime - oDateTime; Double dTimeDifference = oTimeSpan.TotalHours; if ((float)dTimeDifference < fDuration && (float)dTimeDifference >= 0f) { //oResult.ResultMessage = "Candidate Login Success..."; //oResult.ResultObject = oCandidateForExam; //oResult.ResultIsSuccess = true; bIsCandidateFound = true; bIsBetweenLoginTime = true; break; } //else //{ // bIsCandidateFound = true; //} } } oSqlDataReader.Close(); if (bIsCandidateFound && bIsBetweenLoginTime) { oResult.ResultMessage = "Candidate Login Success..."; oResult.ResultObject = oCandidateForExam; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Candidate not found..."; } //else if (bIsCandidateFound && !bIsBetweenLoginTime) //{ // oResult.ResultIsSuccess = false; // oResult.ResultMessage = "Login Between Exam Time..."; //} //else if (!bIsCandidateFound) //{ // oResult.ResultIsSuccess = false; // oResult.ResultMessage = "Candidate not found..."; //} //if (oDateTime != null && fDuration > 0f) //{ // TimeSpan oTimeSpan = new TimeSpan(); // oTimeSpan = oCandidate.CandidateLoginTime - oDateTime; // Double dTimeDifference=oTimeSpan.TotalHours; // if ((float)dTimeDifference < fDuration && (float)dTimeDifference >= 0f) // { // oResult.ResultMessage = "Candidate Login Success..."; // oResult.ResultObject = oCandidateForExam; // oResult.ResultIsSuccess = true; // } // else // { // oResult.ResultIsSuccess = false; // oResult.ResultMessage = "Login between Exam time..."; // } //} //else //{ // oResult.ResultIsSuccess = false; // oResult.ResultMessage = "Candidate not found..."; //} } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Candidate Login Exception..."; logger.Info("Exception CandidateLogin CandidateDAO+DAO", oEx); //new CLogger("Exception CandidateLogin CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception CandidateLogin CandidateDAO+DAO", ELogLevel.Debug, oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } //new CLogger("Out CandidateLogin CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out CandidateLogin CandidateDAO+DAO", ELogLevel.Debug); ; logger.Info("End CandidateLogin CandidateDAO+DAO"); return oResult; }