예제 #1
0
        /// <summary>
        /// This method updates level information
        /// </summary>
        /// <param name="oLevel"> It takes Level Object </param>
        /// <returns> It returns Result Object </returns>
        public Result LevelUpdate(Level oLevel)
        {
            logger.Info("Start LevelUpdate LevelDAO+DAO");

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

            //String sUpdate = String.Empty;

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

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();
            List<int> oListInt = new List<int>();

            try
            {
                //sUpdate = "if not exists(select LabelName from EX_Label where LabelName='" + oLevel.LevelName + "')"
                //+ " update EX_Label set LabelName='" + oLevel.LevelName
                //+ "',LabelPrerequisite='" + oLevel.LevelDescription
                //+ "' where LabelID='" + oLevel.LevelID + "'";

                //sUpdate = "update EX_Label set"
                //    + " LabelName="
                //    + " ( case when not exists"
                //    + " (select LabelName from EX_Label where LabelName='" + oLevel.LevelName + "')"
                //    + " then '" + oLevel.LevelName + "'"
                //    + " end ),"
                //    + " LabelPrerequisite='" + oLevel.LevelDescription
                //    + "' where LabelID='" + oLevel.LevelID + "'";

                //oListString.Add(sUpdate);

                //if (oDAOUtil.ExecuteNonQuery(oListString))
                //{
                //    oResult.ResultObject = oLevel;
                //    oResult.ResultMessage = "Level Update Success(if not updated, then level name is existed)...";
                //    oResult.ResultIsSuccess = true;
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "Level Update failed...";
                //}

                SqlCommand oSqlCommand = new SqlCommand("SP_LevelUpdate");
                oSqlCommand.CommandType = CommandType.StoredProcedure;

                oSqlCommand.Parameters.Add("@LabelID", SqlDbType.UniqueIdentifier);
                oSqlCommand.Parameters["@LabelID"].Value = oLevel.LevelID;

                oSqlCommand.Parameters.Add("@LabelName", SqlDbType.VarChar);
                oSqlCommand.Parameters["@LabelName"].Value = oLevel.LevelName;

                oSqlCommand.Parameters.Add("@LabelPrerequisite", SqlDbType.VarChar);
                oSqlCommand.Parameters["@LabelPrerequisite"].Value = oLevel.LevelDescription;

                oListSqlCommand.Add(oSqlCommand);

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    if (oListInt[0] > 0)
                    {
                        oResult.ResultObject = oLevel;
                        oResult.ResultMessage = "Level Update Success...";
                        oResult.ResultIsSuccess = true;
                    }
                    else
                    {
                        oResult.ResultIsSuccess = false;
                        oResult.ResultMessage = "Level name is existed...";
                    }
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Level Update failed...";
                }

            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Level Update Exception...";

                logger.Info("Exception LevelUpdate LevelDAO+DAO", oEx);
            }

            logger.Info("End LevelUpdate LevelDAO+DAO");

            return oResult;
        }
예제 #2
0
        /// <summary>
        /// This method deletes a level if that level is not
        /// used for any question
        /// </summary>
        /// <param name="oLevel"> It takes Level Object </param>
        /// <returns> It returns Result Object </returns>
        public Result Delete(Level oLevel)
        {
            logger.Info("Start Delete LevelDAO+DAO");

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

            String sDelete= String.Empty;

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

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();
            List<int> oListInt = new List<int>();

            try
            {
                sDelete = "delete from EX_Label where EX_Label.LabelID='" + oLevel.LevelID + "' and EX_Label.LabelID not in (select EX_Question.QuestionLabelID from EX_Question where EX_Question.QuestionLabelID='" + oLevel.LevelID + "')";

                //oListString.Add(sDelete);

                //if (oDAOUtil.ExecuteNonQuery(oListString))
                //{
                //    oResult.ResultObject = oLevel;
                //    oResult.ResultMessage = "Level Delete Success(if not deleted, then it is used)...";
                //    oResult.ResultIsSuccess = true;
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "Level Delete failed...";
                //}

                SqlCommand oSqlCommand = new SqlCommand(sDelete);
                oSqlCommand.CommandType = CommandType.Text;

                oListSqlCommand.Add(oSqlCommand);

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    if (oListInt[0] > 0)
                    {
                        oResult.ResultObject = oLevel;
                        oResult.ResultMessage = "Level Delete Success...";
                        oResult.ResultIsSuccess = true;
                    }
                    else
                    {
                        oResult.ResultIsSuccess = false;
                        oResult.ResultMessage = "Level name is used...";
                    }
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Level Delete failed...";
                }

            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Level Delete Exception...";

                logger.Info("Exception Delete LevelDAO+DAO", oEx);
            }

            logger.Info("End Delete LevelDAO+DAO");

            return oResult;
        }
예제 #3
0
        /// <summary>
        /// This method inserts a Level
        /// </summary>
        /// <param name="oLevel"> It takes Level Object </param>
        /// <returns> It returns Result Object </returns>
        public Result LevelEntry(Level oLevel)
        {
            logger.Info("Start LevelEntry LevelDAO+DAO");

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

            String sInsert = String.Empty;

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

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();
            List<int> oListInt = new List<int>();

            try
            {
                sInsert = "if not exists(select LabelName from EX_Label where LabelName='" + oLevel.LevelName + "') insert into EX_Label(LabelID,LabelName,LabelPrerequisite)"
                +" values('"+oLevel.LevelID+"','"+oLevel.LevelName+"','"+oLevel.LevelDescription+"')";

                //oListString.Add(sInsert);

                //if (oDAOUtil.ExecuteNonQuery(oListString))
                //{
                //    oResult.ResultObject = oLevel;
                //    oResult.ResultMessage = "Level Entry Success(if not inserted, then level name is existed)...";
                //    oResult.ResultIsSuccess = true;
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "Level Entry failed...";
                //}

                SqlCommand oSqlCommand = new SqlCommand(sInsert);
                oSqlCommand.CommandType = CommandType.Text;

                oListSqlCommand.Add(oSqlCommand);

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    if (oListInt[0] > 0)
                    {
                        oResult.ResultObject = oLevel;
                        oResult.ResultMessage = "Level Entry Success...";
                        oResult.ResultIsSuccess = true;
                    }
                    else
                    {
                        oResult.ResultIsSuccess = false;
                        oResult.ResultMessage = "Level name is existed...";
                    }
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Level Entry failed...";
                }

            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Exception occured during Level Entry...";

                logger.Info("Exception LevelEntry LevelDAO+DAO", oEx);
            }

            logger.Info("End LevelEntry LevelDAO+DAO");

            return oResult;
        }
        /// <summary>
        /// This method update the systemuser
        /// It updates systemuser name, if the name is not duplicated
        /// </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 UpdateSystemUser(List<SystemUser> oListSystemUser, int[] iArrCheck)
        {
            logger.Info("Start UpdateSystemUser SystemUserDAO+DAO");

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

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

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();

            List<int> oListInt = new List<int>();

            //String sUpdate = String.Empty;

            int i = 0;

            try
            {
                for (i = 0; i < iArrCheck.Length; i++)
                {
                    if (iArrCheck[i] == 1)
                    {
                        //sUpdate = "if not exists(select SystemUserName from EX_SystemUser where SystemUserName='******') update EX_SystemUser set SystemUserName='******',SystemUserPassword='******',EmailAddress='" + oListSystemUser[i].SystemUserEmail + "' where SystemUserID='" + oListSystemUser[i].SystemUserID + "' and DeleteTime is NULL";

                        SqlCommand oSqlCommand = new SqlCommand("SP_SystemUserModification");
                        oSqlCommand.CommandType = CommandType.StoredProcedure;

                        oSqlCommand.Parameters.Add("@SystemUserID", SqlDbType.UniqueIdentifier);
                        oSqlCommand.Parameters["@SystemUserID"].Value = oListSystemUser[i].SystemUserID;

                        oSqlCommand.Parameters.Add("@SystemUserName", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@SystemUserName"].Value = oListSystemUser[i].SystemUserName;

                        oSqlCommand.Parameters.Add("@SystemUserPassword", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@SystemUserPassword"].Value = oListSystemUser[i].SystemUserPassword;

                        oSqlCommand.Parameters.Add("@EmailAddress", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@EmailAddress"].Value = oListSystemUser[i].SystemUserEmail;

                        oListSqlCommand.Add(oSqlCommand);

                        //sUpdate = "update EX_SystemUser set"
                        //        + " SystemUserName="******" ( case when not exists(select SystemUserName from EX_SystemUser where SystemUserName='******')"
                        //        + " then  '" + oListSystemUser[i].SystemUserName + "' else '" + oListSystemUser[i].SystemUserName + "' end )"
                        //        + " ,SystemUserPassword='******'"
                        //        + ",EmailAddress= ( case  when not exists(select EmailAddress from EX_SystemUser where EmailAddress='" + oListSystemUser[i].SystemUserEmail + "')"
                        //        + " then '" + oListSystemUser[i].SystemUserEmail + "' else '" + oListSystemUser[i].SystemUserEmail + "' end )"
                        //        + " where SystemUserID='" + oListSystemUser[i].SystemUserID + "' and DeleteTime is NULL";

                        //oListString.Add(sUpdate);

                    }
                }

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    oResult.ResultObject = oListSystemUser;
                    oResult.ResultMessage = "SystemUser Update Success(if email or name not update, then it is duplicate)...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "SystemUser Update Failed...";
                }

                //if (oDAOUtil.ExecuteNonQuery(oListString))
                //{
                //    oResult.ResultObject = oListSystemUser;
                //    oResult.ResultMessage = "SystemUser Update Success(if email or name not update, then it is duplicate)...";
                //    oResult.ResultIsSuccess = true;
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "SystemUser Update Fail...";
                //}
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "SystemUser Update Exception...";

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

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

            return oResult;
        }
        /// <summary>
        /// This method inserts systemuser, if that systemuser name is not existed
        /// </summary>
        /// <param name="oSystemUser"> It takes SystemUser Object </param>
        /// <returns> It returns Result Object </returns>
        public Result SystemUserEntry(SystemUser oSystemUser)
        {
            logger.Info("Start SystemUserEntry SystemUserDAO+DAO");

            Result oResult = new Result();

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();
            List<int> oListInt = new List<int>();

            try
            {
                DAOUtil oDAOUtil = new DAOUtil();

                //Boolean flag = true;

                //String sSelect = "select SystemUserName from EX_SystemUser where (SystemUserName='******' or EmailAddress='" + oSystemUser.SystemUserEmail + "') and DeleteTime is NULL";
                //String sInsert = String.Empty;
                //List<String> oListOfString = new List<String>();

                //oSqlDataReader = oDAOUtil.GetReader(sSelect);

                //if (oSqlDataReader.HasRows)
                //{
                //    flag = false;
                //}

                //oSqlDataReader.Close();

                //if (flag)
                //{
                //    oSystemUser.SystemUserID = Guid.NewGuid();

                //    sInsert = "if not exists(select SystemUserName from EX_SystemUser where (SystemUserName='******' or EmailAddress='" + oSystemUser.SystemUserEmail + "')"
                //    +" and DeleteTime is NULL)"
                //    +" insert into EX_SystemUser(SystemUserID,SystemUserName,SystemUserPassword,EmailAddress)"
                //    +" values('" + oSystemUser.SystemUserID + "','" + oSystemUser.SystemUserName + "','" + oSystemUser.SystemUserPassword + "','" + oSystemUser.SystemUserEmail + "')";
                //    oListOfString.Add(sInsert);

                //    if (oDAOUtil.ExecuteNonQuery(oListOfString))
                //    {
                //        oResult.ResultObject = oSystemUser;
                //        oResult.ResultMessage = "System User Entry Success...";
                //        oResult.ResultIsSuccess = true;
                //    }
                //    else
                //    {
                //        oResult.ResultIsSuccess = false;
                //        oResult.ResultMessage = "System User Entry Failed...";
                //    }
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "System User is already Existed...";
                //}

                SqlCommand oSqlCommand = new SqlCommand("SP_SystemUserEntry");
                oSqlCommand.CommandType = CommandType.StoredProcedure;

                oSystemUser.SystemUserID = Guid.NewGuid();

                oSqlCommand.Parameters.Add("@SystemUserID", SqlDbType.UniqueIdentifier);
                oSqlCommand.Parameters["@SystemUserID"].Value = oSystemUser.SystemUserID;

                oSqlCommand.Parameters.Add("@SystemUserName", SqlDbType.VarChar);
                oSqlCommand.Parameters["@SystemUserName"].Value = oSystemUser.SystemUserName;

                oSqlCommand.Parameters.Add("@SystemUserPassword", SqlDbType.VarChar);
                oSqlCommand.Parameters["@SystemUserPassword"].Value = oSystemUser.SystemUserPassword;

                oSqlCommand.Parameters.Add("@EmailAddress", SqlDbType.VarChar);
                oSqlCommand.Parameters["@EmailAddress"].Value = oSystemUser.SystemUserEmail;

                oListSqlCommand.Add(oSqlCommand);

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    if (oListInt[0] > 0)
                    {
                        oResult.ResultObject = oSystemUser;
                        oResult.ResultMessage = "System User Entry Success...";
                        oResult.ResultIsSuccess = true;
                    }
                    else
                    {
                        oResult.ResultIsSuccess = false;
                        oResult.ResultMessage = "System User Name or Email is already Existed...";
                    }
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "SystemUser Entry Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "System User Entry Exception...";

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

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

            return oResult;
        }
        /// <summary>
        /// This Method update candidate informations
        /// </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 Update</param>
        /// <returns> It returns Result Object </returns>
        public Result UpdateCandidate(List<CandidateForExam> oListCandidateForExam, int[] iArrCheck)
        {
            //new CLogger("Start UpdateCandidate CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start UpdateCandidate CandidateDAO+DAO", ELogLevel.Debug);

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

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

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

            //String sUpdate = String.Empty;

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();
            List<int> oListInt = new List<int>();

            int i=0;

            try
            {
                for (i = 0; i < iArrCheck.Length; i++)
                {
                    if (iArrCheck[i] == 1)
                    {
                        //sUpdate = "if not exists(select EmailAddress from EX_Candidate"
                        //+ " where EmailAddress='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateEmail + "')"
                        //+ " update EX_Candidate set CandidatePassword='******'"
                        //+ " ,Name='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateName + "'"
                        //+ " ,LastResult='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateLastResult + "'"
                        //+ " ,LastInstitution='" + oListCandidateForExam[i].CandidateForExamCandidate.CandiadteLastInstitution + "'"
                        //+ " ,LastPassingYear='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateLastPassingYear + "'"
                        //+ " ,CvPath='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateCvPath + "'"
                        //+ " ,EmailAddress='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateEmail + "'"
                        //+ " ,LastResultRange='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateLastResultRange + "'"
                        //+ " ,LastResultTypeName='" + oListCandidateForExam[i].CandidateForExamCandidate.LastResultTypaName + "'"
                        //+ " ,CandidatePicturePath='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidatePicturePath + "'"
                        //+ " where CompositeCandidateID='" + oListCandidateForExam[i].CandidateForExamCandidate.CandidateCompositeID + "'";

                        SqlCommand oSqlCommand = new SqlCommand("SP_CandidateUpdate");
                        oSqlCommand.CommandType = CommandType.StoredProcedure;

                        oSqlCommand.Parameters.Add("@CompositeCandidateID", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@CompositeCandidateID"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateCompositeID;

                        oSqlCommand.Parameters.Add("@CandidatePassword", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@CandidatePassword"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidatePassword;

                        oSqlCommand.Parameters.Add("@Name", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@Name"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateName;

                        oSqlCommand.Parameters.Add("@LastResult", SqlDbType.Float);
                        oSqlCommand.Parameters["@LastResult"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateLastResult;

                        oSqlCommand.Parameters.Add("@LastInstitution", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@LastInstitution"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandiadteLastInstitution;

                        oSqlCommand.Parameters.Add("@LastPassingYear", SqlDbType.Int);
                        oSqlCommand.Parameters["@LastPassingYear"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateLastPassingYear;

                        oSqlCommand.Parameters.Add("@CvPath", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@CvPath"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateCvPath;

                        oSqlCommand.Parameters.Add("@EmailAddress", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@EmailAddress"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateEmail;

                        oSqlCommand.Parameters.Add("@LastResultRange", SqlDbType.Float);
                        oSqlCommand.Parameters["@LastResultRange"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidateLastResultRange;

                        oSqlCommand.Parameters.Add("@LastResultTypeName", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@LastResultTypeName"].Value = oListCandidateForExam[i].CandidateForExamCandidate.LastResultTypaName;

                        oSqlCommand.Parameters.Add("@CandidatePicturePath", SqlDbType.VarChar);
                        oSqlCommand.Parameters["@CandidatePicturePath"].Value = oListCandidateForExam[i].CandidateForExamCandidate.CandidatePicturePath;

                        oListSqlCommand.Add(oSqlCommand);

                    }
                }

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    oResult.ResultObject = oListCandidateForExam;
                    oResult.ResultMessage = "Candidate Update Success(if email not updtaed, then it is duplicate)...";
                    oResult.ResultIsSuccess = true;
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Candidate Update Fail...";
                }

                //if (oDAOUtil.ExecuteNonQuery(oListString))
                //{
                //    oResult.ResultObject = oListCandidateForExam;
                //    oResult.ResultMessage = "Candidate Update Success(if email not updtaed, then it is duplicate)...";
                //    oResult.ResultIsSuccess = true;
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "Candidate Update Fail...";
                //}
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Candidate Update Exception...";

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

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

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

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

            return oResult;
        }
        //r
        /// <summary>
        /// This Method Setup Candidate for an exam.
        /// </summary>
        /// <param name="oCandidateForExam"> It takes CandidateForExam Object </param>
        /// <returns> It returns Result Object </returns>
        public Result CandidateSetup(CandidateForExam oCandidateForExam)
        {
            //new CLogger("Start CandidateSetup CandidateDAO+DAO", FileNameManagerInDLL.sLogFileName, 1).WriteLog("Start CandidateSetup CandidateDAO+DAO", ELogLevel.Debug);

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

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

            String sInsert = String.Empty;

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

            SqlCommand oSqlCommand = null;

            List<SqlCommand> oListSqlCommand = new List<SqlCommand>();
            List<int> oListInt = new List<int>();

            try
            {
                //sInsert = "DECLARE @rows int SET @rows = (SELECT  max(CandidateIDInt) from EX_Candidate) if @rows is null insert into EX_Candidate(ExamID,CompositeCandidateID,CandidatePassword,Name,LastResult,LastInstitution,LastPassingYear,CvPath,CandidateID) values('" + oCandidate.CadidateCandidateExam.CandiadteExamExam.ExamID + "','" + oCandidate.CandidateName + "_1','" + oCandidate.CandidateName + "_1','" + oCandidate.CandidateName + "','" + oCandidate.CandidateLastResult + "','" + oCandidate.CandiadteLastInstitution + "','" + oCandidate.CandidateLastPassingYear + "','" + oCandidate.CandidateCvPath + "','" + oCandidate.CandidateID + "')  else insert into EX_Candidate(ExamID,CompositeCandidateID,CandidatePassword,Name,LastResult,LastInstitution,LastPassingYear,CvPath,CandidateID) values('" + oCandidate.CadidateCandidateExam.CandiadteExamExam.ExamID + "','" + oCandidate.CandidateName + "_'" + "+Convert(varchar(50),@rows+1),'" + oCandidate.CandidateName + "_'" + "+Convert(varchar(50),@rows+1),'" + oCandidate.CandidateName + "','" + oCandidate.CandidateLastResult + "','" + oCandidate.CandiadteLastInstitution + "','" + oCandidate.CandidateLastPassingYear + "','" + oCandidate.CandidateCvPath + "','" + oCandidate.CandidateID + "')";     //values('abc' + Convert(varchar(50),@rows+1))";

                //sInsert = "insert into EX_Candidate(CompositeCandidateID,CandidatePassword,Name,LastResult,LastInstitution,LastPassingYear,CvPath,EmailAddress,LastResultRange,LastResultTypeName,CandidatePicturePath) values('" + oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID + "','" + oCandidateForExam.CandidateForExamCandidate.CandidatePassword + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateName + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateLastResult + "','" + oCandidateForExam.CandidateForExamCandidate.CandiadteLastInstitution + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateLastPassingYear + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateCvPath + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateEmail + "','" + oCandidateForExam.CandidateForExamCandidate.CandidateLastResultRange + "','" + oCandidateForExam.CandidateForExamCandidate.LastResultTypaName + "','" + oCandidateForExam.CandidateForExamCandidate.CandidatePicturePath + "')";
                //oListString.Add(sInsert);
                //sInsert = "insert into EX_CandidateForExam(CandidateID,ExamID) values('" + oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID + "','" + oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID + "')";
                //oListString.Add(sInsert);

                //if (oDAOUtil.ExecuteNonQuery(oListString))
                //{
                //    oResult.ResultMessage = "Candidate Setup Success...";
                //    oResult.ResultObject = oCandidateForExam;
                //    oResult.ResultIsSuccess = true;
                //}
                //else
                //{
                //    oResult.ResultIsSuccess = false;
                //    oResult.ResultMessage = "Candidate Setup Failed...";
                //}

                oSqlCommand = new SqlCommand("SP_CandidateSetup");
                oSqlCommand.CommandType = CommandType.StoredProcedure;

                oSqlCommand.Parameters.Add("@CompositeCandidateID", SqlDbType.VarChar);
                oSqlCommand.Parameters["@CompositeCandidateID"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID;

                oSqlCommand.Parameters.Add("@CandidatePassword", SqlDbType.VarChar);
                oSqlCommand.Parameters["@CandidatePassword"].Value = oCandidateForExam.CandidateForExamCandidate.CandidatePassword;

                oSqlCommand.Parameters.Add("@Name", SqlDbType.VarChar);
                oSqlCommand.Parameters["@Name"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateName;

                oSqlCommand.Parameters.Add("@LastResult", SqlDbType.Float);
                oSqlCommand.Parameters["@LastResult"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateLastResult;

                oSqlCommand.Parameters.Add("@LastInstitution", SqlDbType.VarChar);
                oSqlCommand.Parameters["@LastInstitution"].Value = oCandidateForExam.CandidateForExamCandidate.CandiadteLastInstitution;

                oSqlCommand.Parameters.Add("@LastPassingYear", SqlDbType.Int);
                oSqlCommand.Parameters["@LastPassingYear"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateLastPassingYear;

                oSqlCommand.Parameters.Add("@CvPath", SqlDbType.VarChar);
                oSqlCommand.Parameters["@CvPath"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateCvPath;

                oSqlCommand.Parameters.Add("@EmailAddress", SqlDbType.VarChar);
                oSqlCommand.Parameters["@EmailAddress"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateEmail;

                oSqlCommand.Parameters.Add("@LastResultRange", SqlDbType.Float);
                oSqlCommand.Parameters["@LastResultRange"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateLastResultRange;

                oSqlCommand.Parameters.Add("@LastResultTypeName", SqlDbType.VarChar);
                oSqlCommand.Parameters["@LastResultTypeName"].Value = oCandidateForExam.CandidateForExamCandidate.LastResultTypaName;

                oSqlCommand.Parameters.Add("@CandidatePicturePath", SqlDbType.VarChar);
                oSqlCommand.Parameters["@CandidatePicturePath"].Value = oCandidateForExam.CandidateForExamCandidate.CandidatePicturePath;

                oSqlCommand.Parameters.Add("@CandidateID", SqlDbType.VarChar);
                oSqlCommand.Parameters["@CandidateID"].Value = oCandidateForExam.CandidateForExamCandidate.CandidateCompositeID;

                oSqlCommand.Parameters.Add("@ExamID", SqlDbType.UniqueIdentifier);
                oSqlCommand.Parameters["@ExamID"].Value = oCandidateForExam.CadidateCandidateExam.CandiadteExamExam.ExamID;

                oListSqlCommand.Add(oSqlCommand);

                oListInt = oDAOUtil.ExecuteNonQueryForStoredProcedure(oListSqlCommand);

                if (oListInt.Count > 0)
                {
                    if (oListInt[0] > 0 )
                    {
                        oResult.ResultMessage = "Candidate Setup Success...";
                        oResult.ResultObject = oCandidateForExam;
                        oResult.ResultIsSuccess = true;
                    }
                    else
                    {
                        oResult.ResultIsSuccess = false;
                        oResult.ResultMessage = "Duplicate Candidate Email not allowed...";
                    }
                }
                else
                {
                    oResult.ResultIsSuccess = false;
                    oResult.ResultMessage = "Candidate Setup Failed...";
                }
            }
            catch (Exception oEx)
            {
                oResult.ResultIsSuccess = false;
                oResult.ResultException = oEx;
                oResult.ResultMessage = "Candidate Setup Exception...";

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

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

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

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

            return oResult;
        }