コード例 #1
0
        /// <summary>
        /// This method Deletes a category if the category is not used for any question
        /// </summary>
        /// <param name="oListCategory"> It takes List<Category> Object </param>
        /// <param name="iArrCheck"> It is an integer array to indicate the marked categories</param>
        /// <returns> It returns Result Object </returns>
        public Result CategoryDelete(List<Category> oListCategory, int[] iArrCheck)
        {
            //new CLogger("Start CategoryDelete CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start CategoryDelete CategoryDAO+DAO", ELogLevel.Debug);

            logger.Info("Start CategoryDelete CategoryDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            String sDelete = String.Empty;

            List<String> oListString = new List<String>();

            int i = 0;

            try
            {
                for (i = 0; i < iArrCheck.Length; i++)
                {
                    if (iArrCheck[i] == 1)
                    {
                        sDelete = "delete from EX_Category where CategoryID='" + oListCategory[i].CategoryID + "' and CategoryID not in (select QuestionCategoryID from EX_Question where QuestionCategoryID='" + oListCategory[i].CategoryID + "')";

                        oListString.Add(sDelete);
                    }
                }

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultObject = oListCategory; // This is not necessary Object
                    oResult.ResultMessage = "Category Delete Success(If not deleted then,it is used)...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Category Delete Fail...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Category Delete Exception...";

                logger.Info("Exception CategoryDelete CategoryDAO+DAO", oEx);

                //new CLogger("Exception CategoryDelete CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception CategoryDelete CategoryDAO+DAO", ELogLevel.Debug, oEx);
            }

            //new CLogger("Out CategoryDelete CategoryDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out CategoryDelete CategoryDAO+DAO", ELogLevel.Debug); ;

            logger.Info("End CategoryDelete CategoryDAO+DAO");

            return oResult;
        }
コード例 #2
0
        /// <summary>
        /// This method change the systemuser password
        /// </summary>
        /// <param name="oSystemUser"> It takes SystemUser Object </param>
        /// <param name="sNewPassword"> It takes String Object</param>
        /// <param name="sConfirmPassword"> It takes String Object</param>
        /// <returns> It returns Result Object </returns>
        public Result ChangePassword(SystemUser oSystemUser, String sNewPassword, String sConfirmPassword)
        {
            logger.Info("Start ChangePassword SystemUserDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            String sUpadte = String.Empty;

            List<String> oListString = new List<String>();

            try
            {
                sUpadte = "update EX_SystemUser set SystemUserPassword='******' where SystemUserID='" + oSystemUser.SystemUserID + "' and SystemUserPassword='******' and DeleteTime is NULL";

                oListString.Add(sUpadte);

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oSystemUser.SystemUserPassword = sNewPassword;

                    oResult.ResultObject = oSystemUser;
                    oResult.ResultMessage = "Your password have been changed successfully...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "SystemUser ChangePassword Fail...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "SystemUser ChangePassword Exception...";

                logger.Info("Exception ChangePassword SystemUserDAO+DAO", oEx);
            }

            logger.Info("End ChangePassword SystemUserDAO+DAO");

            return oResult;
        }
コード例 #3
0
        /// <summary>
        /// This Method save all answers of questions for an exam.
        /// This method is called when a candidate finish an exam
        /// </summary>
        /// <param name="oCandidateForExam"> It takes CandidateForExam Object </param>
        /// <returns> It returns Result Object </returns>
        public Result SaveCandidateAnswers(CandidateForExam oCandidateForExam)
        {
            //new CLogger("Start SaveCandidateAnswers CandidateExamProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start SaveCandidateAnswers CandidateExamProcessDAO+DAO", ELogLevel.Debug);

            logger.Info("Start SaveCandidateAnswers CandidateExamProcessDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            String sInsert = String.Empty;
            String sDesOrObj = String.Empty;

            List<String> oListString = new List<String>();

            try
            {
                foreach (CandidateAnswerQuestion oCandidateAnswerQuestion in oCandidateForExam.CadidateCandidateExam.CandidateAnsweredQuestions)
                {
                    if (oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionQuestionType.QuestionTypeID == 0)
                    {
                        sDesOrObj = "Objective@";

                        foreach (Choice oChoice in oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionObjectiveType.ListOfChoices)
                        {
                            sDesOrObj = sDesOrObj + oChoice.ChoiceIsValid.ToString()+":";
                        }
                    }
                    else
                    {
                        sDesOrObj = "Descriptive@"+oCandidateAnswerQuestion.DescriptiveQuestionAnswerText+":";
                    }

                    sInsert = "insert into EX_CandidateExam(ExamID,QuestionID,CandidateID,AnswerStringOrBits,AnswerAttachmentPath) values('" + oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID + "','" + oCandidateAnswerQuestion.QuestionForCandidateAnswer.QuestionID + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID + "','" + sDesOrObj + "','" + oCandidateAnswerQuestion.sAnswerAttachFilePath + "')";
                    oListString.Add(sInsert);
                }

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultIsSuccess = true;
                    oResult.ResultObject = oCandidateForExam;
                    oResult.ResultMessage = "Candidate Answer Save Success...";
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Candidate Answer Save Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultMessage = "Exception in Candidate Answer Save...";
                oResult.ResultException = oEx;

                logger.Info("Exception SaveCandidateAnswers CandidateExamProcessDAO+DAO", oEx);

                //new CLogger("Exception SaveCandidateAnswers CandidateExamProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception SaveCandidateAnswers CandidateExamProcessDAO+DAO", ELogLevel.Debug, oEx);
            }

            //new CLogger("Out SaveCandidateAnswers CandidateExamProcessDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out SaveCandidateAnswers CandidateExamProcessDAO+DAO", ELogLevel.Debug); ;

            logger.Info("End SaveCandidateAnswers CandidateExamProcessDAO+DAO");

            return oResult;
        }
コード例 #4
0
        //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;
        }
コード例 #5
0
        //r
        /// <summary>
        /// This method deletes questions
        /// </summary>
        /// <param name="oListQuestion"> It takes List<Question> Object </param>
        /// <param name="iarrChecked"> It takes integer array indicates the marked questions </param>
        /// <returns> It returns Result Object </returns>
        public Result DeleteQuestionList(List<Question> oListQuestion, int[] iarrChecked)
        {
            logger.Info("Start DeleteQuestionList QuestionDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            List<String> oListString = new List<String>();
            String sDelete = String.Empty;

            List<Question> oListQuestion1 = new List<Question>();

            int i = 0;

            try
            {
                for (i = 0; i < iarrChecked.Length; i++)
                {
                    if (iarrChecked[i] == 1 && !oListQuestion[i].QuestionIsUsed)
                    {
                        // Before delete, check that, is it used at the time of SETUP Question.
                        // If it is used, then u cannot delete it.

                        if (oListQuestion[i].QuestionQuestionType.QuestionTypeID==1)
                        {
                            sDelete = "delete from EX_Question where QuestionID='" + oListQuestion[i].QuestionID + "'";
                            oListQuestion1.Add(null);
                            oListString.Add(sDelete);

                        }
                        else
                        {
                            //first delete from EX_Objective, then from EX_Question
                            sDelete = "delete from EX_Objective where ObjectiveQuestionID='" + oListQuestion[i].QuestionID+"'";
                            oListString.Add(sDelete);
                            //sDelete = "delete from EX_Question where QuestionID='" + oListQuestion[i].QuestionID + "' and QuestionTypeName='" + oListQuestion[i].QuestionObjectiveType.TypeName + "'";
                            sDelete = "delete from EX_Question where QuestionID='" + oListQuestion[i].QuestionID + "'";
                            oListQuestion1.Add(null);
                            oListString.Add(sDelete);
                        }

                    }
                    else
                    {
                        oListQuestion1.Add(oListQuestion[i]);
                    }
                }

                oListQuestion1.RemoveAll(delegate(Question oQuestion) { if (oQuestion != null) { return false; } return true; });

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultObject = oListQuestion1;

                    if (oListQuestion1.Count < oListQuestion.Count)
                    {
                        oResult.ResultMessage = "Question Delete Success...";
                    }
                    else if(oListQuestion1.Count==oListQuestion.Count)
                    {
                        oResult.ResultMessage = "Your selected questions are used...";
                    }

                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Question Delete Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Exception occured during Question Delete...";

                logger.Info("Exception DeleteQuestionList QuestionDAO+DAO", oEx);
            }

            logger.Info("End DeleteQuestionList QuestionDAO+DAO");

            return oResult;
        }
コード例 #6
0
        //r
        /// <summary>
        /// This method inserts a Question
        /// </summary>
        /// <param name="oQuestion"> It takes Question Object </param>
        /// <returns> It returns Result Object </returns>
        public Result QuestionEntry(Question oQuestion)
        {
            logger.Info("Start QuestionEntry QuestionDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            String sInsert = String.Empty;
            List<String> oListInsert = new List<String>();

            int i=0;
            int iBit = 0;

            try
            {
                oQuestion.QuestionID = Guid.NewGuid();

                sInsert = "insert into EX_Question(QuestionID,QuestionText,QuestionCreatorID,QuestionDefaultMark,QuestionCategoryID,QuestionTypeID,QuestionPossibleAnswerTime,QuestionLabelID) values('" + oQuestion.QuestionID + "','" + oQuestion.QuestionText + "','" + oQuestion.QuestionCreator.SystemUserID + "','" + oQuestion.QuestionDefaultMark + "','" + oQuestion.QuestionCategory.CategoryID + "','" + oQuestion.QuestionQuestionType.QuestionTypeID + "','" + oQuestion.QuestionPossibleAnswerTime+"','"+oQuestion.QuestionLevel.LevelID + "')";
                oListInsert.Add(sInsert);

                if (oQuestion.QuestionQuestionType.QuestionTypeID == 0)
                {
                    for (i = 0; i < oQuestion.QuestionObjectiveType.ListOfChoices.Count; i++)
                    {
                        iBit = 0;

                        if (oQuestion.QuestionObjectiveType.ListOfChoices[i].ChoiceIsValid)
                        {
                            iBit = 1;
                        }

                        sInsert = "insert into EX_Objective(ObjectiveQuestionID,ObjectiveAnswer,ObjectiveAnswerIsValid) values('" + oQuestion.QuestionID + "','" + oQuestion.QuestionObjectiveType.ListOfChoices[i].ChoiceName + "','" + iBit + "')";
                        oListInsert.Add(sInsert);
                    }
                }

                if (oDAOUtil.ExecuteNonQuery(oListInsert))
                {
                    oResult.ResultObject = oQuestion;
                    oResult.ResultMessage = "Question Entry Success...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Question Entry Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultMessage = "Exception occured during Question Entry...";
                oResult.ResultException = oEx;

                logger.Info("Exception QuestionEntry QuestionDAO+DAO", oEx);
            }

            logger.Info("End QuestionEntry QuestionDAO+DAO");

            return oResult;
        }
コード例 #7
0
        //r
        /// <summary>
        /// This method Update a Question
        /// </summary>
        /// <param name="oQuestion"> It takes Question Object </param>
        /// <returns> It returns Result Object </returns>
        public Result UpdateQuestion(Question oQuestion)
        {
            logger.Info("Start UpdateQuestion QuestionDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            List<String> oListString = new List<String>();
            String sString = String.Empty;

            int iBit = 0;

            try
            {
                sString = "update EX_Question set QuestionDefaultMark='" + oQuestion.QuestionDefaultMark + "',QuestionPossibleAnswerTime='"+oQuestion.QuestionPossibleAnswerTime +"' where QuestionID='" + oQuestion.QuestionID + "'";
                oListString.Add(sString);

                //if (!oQuestion.QuestionIsDescriptive)
                if (oQuestion.QuestionQuestionType.QuestionTypeID==0)
                {
                    sString = "delete from EX_Objective where ObjectiveQuestionID='" + oQuestion.QuestionID + "'";
                    oListString.Add(sString);

                    foreach (Choice oChoice in oQuestion.QuestionObjectiveType.ListOfChoices)
                    {
                        iBit = 0;

                        if (oChoice.ChoiceIsValid)
                        {
                            iBit = 1;
                        }

                        sString = "insert into EX_Objective(ObjectiveQuestionID,ObjectiveAnswer,ObjectiveAnswerIsValid) values('" + oQuestion.QuestionID + "','" + oChoice.ChoiceName + "','" + iBit + "')";
                        oListString.Add(sString);
                    }
                }

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultObject = oQuestion;
                    oResult.ResultMessage = "Question Update Success...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Question Update Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Exception occured during Question Update...";

                logger.Info("Exception UpdateQuestion QuestionDAO+DAO", oEx);
            }

            logger.Info("End UpdateQuestion QuestionDAO+DAO");

            return oResult;
        }
コード例 #8
0
        /// <summary>
        /// This method remove 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 QuestionSetupRemove(List<QuestionSetup> oListQuestionSetup, int[] iarrChecked)
        {
            logger.Info("Start QuestionSetupRemove QuestionDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            List<String> oListString = new List<String>();
            String sDelete = String.Empty;

            List<QuestionSetup> oListQuestionSetup1 = new List<QuestionSetup>();

            try
            {
                int i = 0;

                for (i = 0; i < iarrChecked.Length; i++)
                {
                    if (iarrChecked[i] == 1)
                    {
                        sDelete = "delete from EX_QuestionGeneration where ExamID='" + oListQuestionSetup[i].QuestionSetupExam.ExamID + "' and QuestionID='" + oListQuestionSetup[i].QuestionSetupQuestion.QuestionID + "' and GeneratorID='" + oListQuestionSetup[i].QuestionSetupSystemUser.SystemUserID + "'";
                        oListQuestionSetup1.Add(null);
                        oListString.Add(sDelete);
                    }
                    else
                    {
                        oListQuestionSetup1.Add(oListQuestionSetup[i]);
                    }
                }

                oListQuestionSetup1.RemoveAll(delegate(QuestionSetup oQuestionSetup) { if (oQuestionSetup != null) { return false; } return true; });

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultObject = oListQuestionSetup1;
                    oResult.ResultMessage = "Question Setup Remove Success...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Question Setup Remove Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultMessage = "Exception occured during Question Setup Remove...";
                oResult.ResultException = oEx;

                logger.Info("Exception QuestionSetupRemove QuestionDAO+DAO", oEx);
            }

            logger.Info("End QuestionSetupRemove QuestionDAO+DAO");

            return oResult;
        }
コード例 #9
0
        /// <summary>
        /// This method update the systemuser delete time, indicating that, the systemuser is deleted.
        /// </summary>
        /// <param name="oListSystemUser"> It takes List<SystemUser> Object </param>
        /// <param name="iArrCheck"> It takes integer array which indicates the marked system user</param>
        /// <returns> It returns Result Object </returns>
        public Result SystemUserDelete(List<SystemUser> oListSystemUser, int[] iArrCheck)
        {
            logger.Info("Start SystemUserDelete SystemUserDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            List<SystemUser> oListSystemUser1 = new List<SystemUser>();

            List<String> oListString = new List<String>();

            String sUpdate = String.Empty;

            int i = 0;

            try
            {
                for (i = 0; i < iArrCheck.Length; i++)
                {
                    if (iArrCheck[i] == 1)
                    {
                        sUpdate = "update EX_SystemUser set DeleteTime='" + DateTime.Now + "' where SystemUserID='" + oListSystemUser[i].SystemUserID + "'";
                        oListString.Add(sUpdate);
                        oListSystemUser1.Add(null);
                    }
                    else
                    {
                        oListSystemUser1.Add(oListSystemUser[i]);
                    }
                }

                oListSystemUser1.RemoveAll(delegate(SystemUser oSystemUser) { if (oSystemUser != null) { return false; } return true; });

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultObject = oListSystemUser1;
                    oResult.ResultMessage = "System User Delete Success...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "System User Delete Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Exception occured during System User Delete...";

                logger.Info("Exception SystemUserDelete SystemUserDAO+DAO", oEx);
            }

            logger.Info("End SystemUserDelete SystemUserDAO+DAO");

            return oResult;
        }
コード例 #10
0
        //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;
        }
コード例 #11
0
        /// <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;
        }
コード例 #12
0
        /// <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;
        }
コード例 #13
0
        /// <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;
        }
コード例 #14
0
        /// <summary>
        /// This Method remove a candidate if he has not appeared for an exam. 
        /// </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 remove</param>
        /// <returns> It returns Result Object </returns>
        public Result RemoveCandidate(List<CandidateForExam> oListCandidateForExam, int[] iArrCheck)
        {
            //new CLogger("Start RemoveCandidate CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start RemoveCandidate CandidateDAO+DAO", ELogLevel.Debug);

            logger.Info("Start RemoveCandidate CandidateDAO+DAO");

            Result oResult = new Result();
            DAOUtil oDAOUtil = new DAOUtil();

            List<CandidateForExam> oListCandidateForExam1 = new List<CandidateForExam>();

            List<String> oListString = new List<String>();

            String sDelete = String.Empty;

            int i=0;

            try
            {
                for (i = 0; i < iArrCheck.Length; i++)
                {
                    if (iArrCheck[i] == 1)
                    {
                        sDelete = "delete from EX_CandidateForExam where"
                        + " EX_CandidateForExam.ExamID='" + oListCandidateForExam[i].CadidateCandidateExam.CandiadteExamExam.ExamID + "'"
                        + " and EX_CandidateForExam.CandidateID='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateCompositeID + "'"
                        + " and EX_CandidateForExam.CandidateID not in (select EX_CandidateExam.CandidateID"
                        + " from EX_CandidateExam where EX_CandidateExam.ExamID='" + oListCandidateForExam[i].CadidateCandidateExam.CandiadteExamExam.ExamID + "'"
                        + " and EX_CandidateExam.CandidateID='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateCompositeID + "')"
                        + " ; delete from EX_Candidate where CompositeCandidateID='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateCompositeID + "'"
                        + " and CompositeCandidateID not in"
                        + " (select CandidateID from EX_CandidateForExam where CandidateID='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateCompositeID + "')";

                        oListString.Add(sDelete);

                        oListCandidateForExam1.Add(null);
                    }
                    else
                    {
                        oListCandidateForExam1.Add(oListCandidateForExam[i]);
                    }
                }

                oListCandidateForExam1.RemoveAll(delegate(CandidateForExam oCandidateForExam) { if (oCandidateForExam != null) { return false; } return true; });

                if (oDAOUtil.ExecuteNonQuery(oListString))
                {
                    oResult.ResultObject = oListCandidateForExam1;
                    oResult.ResultMessage = "Candidate Remove Success...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Candidate Delete Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Exception occured during Candidate Remove...";

                logger.Info("Exception RemoveCandidate CandidateDAO+DAO", oEx);

                //new CLogger("Exception RemoveCandidate CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Exception RemoveCandidate CandidateDAO+DAO", ELogLevel.Debug, oEx);
            }

            //new CLogger("Out RemoveCandidate CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Out RemoveCandidate CandidateDAO+DAO", ELogLevel.Debug);

            logger.Info("End RemoveCandidate CandidateDAO+DAO");

            return oResult;
        }