public Result ExamEntry(Exam oExam) { //new CLogger("Start ExamEntry ExamBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start ExamEntry ExamBO+BO", ELogLevel.Debug); Result oResult = new Result(); try { ExamDAO oExamDAO = new ExamDAO(); oResult = oExamDAO.ExamEntry(oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during Exam Entry.."; //new CLogger("Exception ExamEntry ExamBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception ExamEntry ExamBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out ExamEntry ExamBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out ExamEntry ExamBO+BO", ELogLevel.Debug); return oResult; }
public Result AddCandidatesFromExistingCandidate(List<CandidateForExam> oListOfCandidateForExamForGrid, int[] iArrCheck, Exam oSelectedExam) { Result oResult = new Result(); CandidateDAO oCandidateDAO = new CandidateDAO(); try { oResult = oCandidateDAO.AddCandidatesFromExistingCandidate(oListOfCandidateForExamForGrid, iArrCheck, oSelectedExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during AddCandidatesFromExistingCandidate.."; } return oResult; }
//r public Result ExamDeleteByStoredProcedure(Exam oExam, SystemUser oSystemUser) { Result oResult = new Result(); try { ExamDAO oExamDAO = new ExamDAO(); oResult = oExamDAO.ExamDeleteByStoredProcedure(oExam, oSystemUser); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during Exam Delete.."; } return oResult; }
public Result GetTotalLastSetupQuestionTime(Exam oExam) { //new CLogger("Start GetTotalLastSetupQuestionTime QuestionBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start GetTotalLastSetupQuestionTime QuestionBO+BO", ELogLevel.Debug); Result oResult = new Result(); QuestionDAO oQuestionDAO = new QuestionDAO(); try { oResult = oQuestionDAO.GetTotalLastSetupQuestionTime(oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during GetTotalLastSetupQuestionTime.."; oResult.ResultException = oEx; //new CLogger("Exception GetTotalLastSetupQuestionTime QuestionBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception GetTotalLastSetupQuestionTime QuestionBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out GetTotalLastSetupQuestionTime QuestionBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out GetTotalLastSetupQuestionTime QuestionBO+BO", ELogLevel.Debug); return oResult; }
public Result LoadCategoriesWithTypeForAnExam(Exam oExam) { //new CLogger("Start LoadCategoriesWithTypeForAnExam ResultViewBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start LoadCategoriesWithTypeForAnExam ResultViewBO+BO", ELogLevel.Debug); Result oResult = new Result(); ResultViewDAO oResultViewDAO = new ResultViewDAO(); try { oResult = oResultViewDAO.LoadCategoriesWithTypeForAnExam(oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "LoadCategoriesWithTypeForAnExam Exception.."; //new CLogger("Exception LoadCategoriesWithTypeForAnExam ResultViewBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception LoadCategoriesWithTypeForAnExam ResultViewBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out LoadCategoriesWithTypeForAnExam ResultViewBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out LoadCategoriesWithTypeForAnExam ResultViewBO+BO", ELogLevel.Debug); return oResult; }
public Result GetCandidateAVGMarksForTypeAndCategory(Exam oExam, List<CandidateMenu> oListCandidateMenu) { //new CLogger("Start GetCandidateAVGMarksForTypeAndCategory ResultViewBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start GetCandidateAVGMarksForTypeAndCategory ResultViewBO+BO", ELogLevel.Debug); Result oResult = new Result(); ResultViewDAO oResultViewDAO = new ResultViewDAO(); try { oResult = oResultViewDAO.GetCandidateAVGMarksForTypeAndCategory(oExam, oListCandidateMenu); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "GetCandidateAVGMarksForTypeAndCategory Exception.."; //new CLogger("Exception GetCandidateAVGMarksForTypeAndCategory ResultViewBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception GetCandidateAVGMarksForTypeAndCategory ResultViewBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out GetCandidateAVGMarksForTypeAndCategory ResultViewBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out GetCandidateAVGMarksForTypeAndCategory ResultViewBO+BO", ELogLevel.Debug); 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; }
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 get total possible time for answering questions which are set up for an exam /// </summary> /// <param name="oExam"> It takes Exam Object </param> /// <returns> It returns Result Object </returns> public Result GetTotalLastSetupQuestionTime(Exam oExam) { logger.Info("Start GetTotalLastSetupQuestionTime QuestionDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sSelect = String.Empty; Object oObject = new Object(); float fTotalTime = 0f; try { sSelect = "select sum(EX_Question.QuestionPossibleAnswerTime) from EX_Question inner join EX_QuestionGeneration on EX_Question.QuestionID = EX_QuestionGeneration.QuestionID where EX_QuestionGeneration.ExamID='" + oExam.ExamID + "'"; oObject = oDAOUtil.GetExecuteScalar(sSelect); if (oObject.ToString().Length > 0) { fTotalTime = float.Parse(oObject.ToString()); } oResult.ResultObject = fTotalTime; oResult.ResultMessage = "GetTotalLastSetupQuestionTime Success..."; oResult.ResultIsSuccess = true; } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during GetTotalLastSetupQuestionTime..."; logger.Info("Exception GetTotalLastSetupQuestionTime QuestionDAO+DAO", oEx); } logger.Info("End GetTotalLastSetupQuestionTime QuestionDAO+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; }
/// <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 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; }
public Result QuestionListShowForSetupByQuestionLevel(Question oQuestion, Exam oExam) { Result oResult = new Result(); QuestionDAO oQuestionDAO = new QuestionDAO(); try { oResult = oQuestionDAO.QuestionListShowForSetupByQuestionLevel(oQuestion, oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during QuestionListShowForSetupByQuestionLevel.."; oResult.ResultException = oEx; } return oResult; }
private void Initialization() { this.oExam = new Exam(); this.oQuestion = new Question(); this.oSystemUser = new SystemUser(); }
/// <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 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 Save ObjectiveAnswer Marks For All Candidate Of An Exam /// </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 SaveObjectiveAnswerMarksForAllCandidateOfAnExam(List<CandidateForExam> oListCandidateForExamForEvaluate, SystemUser oSystemUser, Exam oExam) { //new CLogger("Start SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", ELogLevel.Debug); logger.Info("Start SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sUpdate = String.Empty; List<String> oListString = new List<String>(); try { foreach (CandidateForExam oCandidateForExamInList in oListCandidateForExamForEvaluate) { foreach (CandidateAnswerQuestion oCandidateAnswerQuestionInList in oCandidateForExamInList.CadidateCandidateExam.CandidateAnsweredQuestions) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID == 0) { sUpdate = "update EX_CandidateExam set ObtainMark='" + oCandidateAnswerQuestionInList.ObtainMark + "' where ExamID='" + oExam.ExamID + "' and CandidateID='" + oCandidateForExamInList.CandidateForExamCandidate.CandidateCompositeID + "' and QuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "'"; oListString.Add(sUpdate); } } } if (oDAOUtil.ExecuteNonQuery(oListString)) { oResult.ResultObject = oListCandidateForExamForEvaluate; oResult.ResultMessage = "Objective answers are saved for all candidate of this exam..."; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Saving objective answers for all candidate of this exam Failed..."; } } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception at saving objective answers for all candidate of this exam..."; logger.Info("Exception SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", oEx); //new CLogger("Exception SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", ELogLevel.Debug, oEx); } //new CLogger("Out SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO", ELogLevel.Debug); ; logger.Info("End SaveObjectiveAnswerMarksForAllCandidateOfAnExam EvaluateProcessDAO+DAO"); return oResult; }
/// <summary> /// This method Save DescriptiveAnswer Marks For Candidates For A SystemUser Of An Exam /// </summary> /// <param name="sCandidateID"> It takes String Object </param> /// <param name="oListCandidateAnswerQuestion"> It takes List<CandidateAnswerQuestion> 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 SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam(String sCandidateID, List<CandidateAnswerQuestion> oListCandidateAnswerQuestion, Exam oExam, SystemUser oSystemUser) { //new CLogger("Start SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", ELogLevel.Debug); logger.Info("Start SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sUpdate = String.Empty; List<String> oListString = new List<String>(); try { foreach (CandidateAnswerQuestion oCandidateAnswerQuestionInList in oListCandidateAnswerQuestion) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID == 1) { sUpdate = "update EX_CandidateExam set ObtainMark='" + oCandidateAnswerQuestionInList.ObtainMark + "' where ExamID='" + oExam.ExamID + "' and CandidateID='" + sCandidateID + "' and QuestionID='" + oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionID + "'"; oListString.Add(sUpdate); } } if (oDAOUtil.ExecuteNonQuery(oListString)) { oResult.ResultObject = oListCandidateAnswerQuestion; oResult.ResultMessage = "Descriptive answers are evaluated..."; oResult.ResultIsSuccess = true; } else { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Descriptive answers are evaluation failed..."; } } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam Exception..."; logger.Info("Exception SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", oEx); //new CLogger("Exception SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", ELogLevel.Debug, oEx); } //new CLogger("Out SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO", ELogLevel.Debug); ; logger.Info("End SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessDAO+DAO"); return oResult; }
public Result LoadAllQuestionsOfAnExam(Exam oSelectedExam) { Result oResult = new Result(); QuestionDAO oQuestionDAO = new QuestionDAO(); try { oResult = oQuestionDAO.LoadAllQuestionsOfAnExam(oSelectedExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during LoadAllQuestionsOfAnExam.."; oResult.ResultException = oEx; } return oResult; }
public Result QuestionListShowForSetup(Question oQuestion,Exam oExam) { //new CLogger("Start QuestionListShowForSetup QuestionBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start QuestionListShowForSetup QuestionBO+BO", ELogLevel.Debug); Result oResult = new Result(); QuestionDAO oQuestionDAO = new QuestionDAO(); try { oResult = oQuestionDAO.QuestionListShowForSetup(oQuestion,oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultMessage = "Exception occured during QuestionListShowForSetup.."; oResult.ResultException = oEx; //new CLogger("Exception QuestionListShowForSetup QuestionBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception QuestionListShowForSetup QuestionBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out QuestionListShowForSetup QuestionBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out QuestionListShowForSetup QuestionBO+BO", ELogLevel.Debug); return oResult; }
public Result LoadCandidatesAccordingToSystemUserForEvaluate(SystemUser oSystemUser, Exam oExam) { //new CLogger("Start LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessBO+BO", ELogLevel.Debug); Result oResult = new Result(); EvaluateProcessDAO oEvaluateProcessDAO = new EvaluateProcessDAO(); try { oResult = oEvaluateProcessDAO.LoadCandidatesAccordingToSystemUserForEvaluate(oSystemUser, oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "LoadCandidatesAccordingToSystemUserForEvaluate Exception.."; //new CLogger("Exception LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out LoadCandidatesAccordingToSystemUserForEvaluate EvaluateProcessBO+BO", ELogLevel.Debug); return oResult; }
public Result SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam(String sCandidateID, List<CandidateAnswerQuestion> oListCandidateAnswerQuestion, Exam oExam, SystemUser oSystemUser) { //new CLogger("Start SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessBO+BO", ELogLevel.Debug); Result oResult = new Result(); EvaluateProcessDAO oEvaluateProcessDAO = new EvaluateProcessDAO(); try { oResult = oEvaluateProcessDAO.SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam(sCandidateID,oListCandidateAnswerQuestion, oExam, oSystemUser); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam Exception.."; //new CLogger("Exception SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out SaveDescriptiveAnswerMarksForCandidatesForASystemUserOfAnExam EvaluateProcessBO+BO", ELogLevel.Debug); 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; }
private void Initialization() { this.oExam = new Exam(); this.oListCandidateAnswerQuestion = new List<CandidateAnswerQuestion>(); }
public Result ShowAllCandidates(Exam oExam) { //new CLogger("Start ShowAllCandidates CandidateBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start ShowAllCandidates CandidateBO+BO", ELogLevel.Debug); Result oResult = new Result(); CandidateDAO oCandidateDAO = new CandidateDAO(); try { oResult = oCandidateDAO.ShowAllCandidates(oExam); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "Exception occured during Show All Candidates.."; //new CLogger("Exception ShowAllCandidates CandidateBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception ShowAllCandidates CandidateBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out ShowAllCandidates CandidateBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out ShowAllCandidates CandidateBO+BO", ELogLevel.Debug); ; return oResult; }
public Result LoadQuestionsForACandidateWhichSetupByAParticularUser(string sCandidateID, Exam oExam, SystemUser oSystemUser, Boolean flagForEvaluation) { //new CLogger("Start LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessBO+BO", ELogLevel.Debug); Result oResult = new Result(); EvaluateProcessDAO oEvaluateProcessDAO = new EvaluateProcessDAO(); try { oResult = oEvaluateProcessDAO.LoadQuestionsForACandidateWhichSetupByAParticularUser(sCandidateID, oExam, oSystemUser,flagForEvaluation); } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "LoadQuestionsForACandidateWhichSetupByAParticularUser Exception.."; //new CLogger("Exception LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out LoadQuestionsForACandidateWhichSetupByAParticularUser EvaluateProcessBO+BO", ELogLevel.Debug); return oResult; }
/// <summary> /// This method load question categories with their types of an exam /// </summary> /// <param name="oExam"> It takes Exam Object </param> /// <returns> It returns Result Object </returns> public Result LoadCategoriesWithTypeForAnExam(Exam oExam) { logger.Info("Start LoadCategoriesWithTypeForAnExam ResultViewDAO+DAO"); Result oResult = new Result(); DAOUtil oDAOUtil = new DAOUtil(); String sSelect = String.Empty; List<CandidateMenu> oListCandidateMenu = new List<CandidateMenu>(); SqlDataReader oSqlDataReader = null; 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='" +oExam.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='" + oExam.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='" + oCandidate.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 LoadCategoriesWithTypeForAnExam ResultViewDAO+DAO", oEx); } finally { if (oSqlDataReader!=null && !oSqlDataReader.IsClosed) { oSqlDataReader.Close(); } } logger.Info("End LoadCategoriesWithTypeForAnExam ResultViewDAO+DAO"); return oResult; }
//public Result EvaluateObjectiveAnswersBeforeShow(List<CandidateAnswerQuestion> oListCandidateAnswerQuestion, Exam oExam, String sCandidateID) //{ // Result oResult = new Result(); // try // { // foreach (CandidateAnswerQuestion oCandidateAnswerQuestionInList in oListCandidateAnswerQuestion) // { // } // } // catch (Exception oEx) // { // oResult.ResultIsSuccess = false; // oResult.ResultException = oEx; // oResult.ResultMessage = "EvaluateObjectiveAnswersBeforeShow Exception.."; // } // return oResult; //} /// <summary> /// This Method Evaluates ObjectiveAnswers For All Candidate Of An Exam /// It evaluates the objective answers according to exam constraint /// </summary> /// <param name="oListCandidateForExamForGrid"> It takes List<SqlCommand> </param> /// <param name="oSystemUser"> It takes SystemUser Object </param> /// <param name="oExam"> It takes Exam Object </param> /// <returns> return Result Object </returns> public Result EvaluateObjectiveAnswersForAllCandidateOfAnExma(List<CandidateForExam> oListCandidateForExamForGrid, SystemUser oSystemUser, Exam oExam) { //new CLogger("Start EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", ELogLevel.Debug); logger.Info("Start EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO"); Result oResult = new Result(); EvaluateProcessDAO oEvaluateProcessDAO = new EvaluateProcessDAO(); List<CandidateForExam> oListCandidateForExamForEvaluate = new List<CandidateForExam>(); int i=0; try { oResult = oEvaluateProcessDAO.EvaluateObjectiveAnswersForAllCandidateOfAnExma(oListCandidateForExamForGrid, oSystemUser, oExam); if (oResult.ResultIsSuccess) { oListCandidateForExamForEvaluate = (List<CandidateForExam>)oResult.ResultObject; foreach (CandidateForExam oCandidateForExamInList in oListCandidateForExamForEvaluate) { foreach (CandidateAnswerQuestion oCandidateAnswerQuestionInList in oCandidateForExamInList.CadidateCandidateExam.CandidateAnsweredQuestions) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID == 0) { if(oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers.Count == oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices.Count) { if (oExam.ExamConstraint == 0 || oExam.ExamConstraint == 2) //full, negative { Boolean bMatch = true; for (i = 0; i < oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers.Count; i++) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers[i].ChoiceIsValid == oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid) { } else { bMatch = false; break; } } if (bMatch) { oCandidateAnswerQuestionInList.ObtainMark = oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionDefaultMark; } else { if (oExam.ExamConstraint == 0) { oCandidateAnswerQuestionInList.ObtainMark = 0f; } else if (oExam.ExamConstraint == 2) { oCandidateAnswerQuestionInList.ObtainMark = (-1f) * (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionDefaultMark); } } } else if(oExam.ExamConstraint == 1) //partial { int iMatchCount = 0; int iTotalValid = 0; for (i = 0; i < oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers.Count; i++) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers[i].ChoiceIsValid==true && oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid==true) { iMatchCount = iMatchCount + 1; } if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid == true) { iTotalValid = iTotalValid + 1; } } if (iTotalValid > 0) { oCandidateAnswerQuestionInList.ObtainMark = ((float)iMatchCount / (float)iTotalValid) * (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionDefaultMark); } //else //{ // if (iTotalValid == 0 && iMatchCount==0) // { // oCandidateAnswerQuestionInList.ObtainMark = (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionDefaultMark); // } // else if (iTotalValid == 0 && iMatchCount>0) // { // oCandidateAnswerQuestionInList.ObtainMark = 0f; // } //} } else if (oExam.ExamConstraint == 3) //partial negative { int iMatchCount = 0; int iTotalValid = 0; int iNotMatchCount = 0; for (i = 0; i < oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers.Count; i++) { if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers[i].ChoiceIsValid == true && oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid == true) { iMatchCount = iMatchCount + 1; } else if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfAnswers[i].ChoiceIsValid == true && oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid == false) { iNotMatchCount = iNotMatchCount + 1; } if (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid == true) { iTotalValid = iTotalValid + 1; } } if (iTotalValid > 0) { oCandidateAnswerQuestionInList.ObtainMark = ((float)iMatchCount / (float)iTotalValid) * (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionDefaultMark) - (float)iNotMatchCount * (1f / (float)iTotalValid); } //else //{ // if (iTotalValid == 0 && iMatchCount == 0) // { // oCandidateAnswerQuestionInList.ObtainMark = (oCandidateAnswerQuestionInList.QuestionForCandidateAnswer.QuestionDefaultMark); // } // else if (iTotalValid == 0 && iMatchCount > 0) // { // oCandidateAnswerQuestionInList.ObtainMark = 0f; // } //} } } } } } oResult = oEvaluateProcessDAO.SaveObjectiveAnswerMarksForAllCandidateOfAnExam(oListCandidateForExamForEvaluate, oSystemUser, oExam); } } catch (Exception oEx) { oResult.ResultIsSuccess = false; oResult.ResultException = oEx; oResult.ResultMessage = "EvaluateObjectiveAnswersForAllCandidateOfAnExma Exception.." + oEx.ToString(); logger.Info("Exception EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", oEx); //new CLogger("Exception EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", ELogLevel.Debug, oEx); } //new CLogger("Out EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO", ELogLevel.Debug); logger.Info("End EvaluateObjectiveAnswersForAllCandidateOfAnExma EvaluateProcessBO+BO"); 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; }