/**
     * Return list of vacancy which have this status.
     */
    public static TransactionResponse getAllActiveVacancy(string status)
    {
        TransactionResponse response = new TransactionResponse();
        IDictionary<string, object> statusParams = new Dictionary<string, object>();
        statusParams.Add("@status", status);
        statusParams.Add("@districtId", PageAccessManager.getDistrictID());

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spAllActiveVacancy, statusParams);
        try
        {
            DataTable dataTable = dpOperation.getRecord();

            response.Data = dataTable;
            response.setSuccess(true);
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setSuccess(false);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            LoggerManager.LogError(ex.ToString(), logger);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
Esempio n. 2
0
 public static void upDateWithGenericErrorMessage(TransactionResponse response)
 {
     //Display generic message.
     response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
     response.setMessage(DBOperationErrorConstants.M_SYSTEM_ENCOUNTERED_UNKNOWN_ERROR);
     response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR);
     response.setSuccess(false);
 }
    /**
     * Get applicant result after checking done, or while interview or exam result is entering
     */
    public TransactionResponse getApplicantPassedToSecPhase(Vacancy vacancy)
    {
        TransactionResponse response = new TransactionResponse();
        try
        {
            //Add List of Arguments for new employee
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("@vacancyNo", vacancy.VacancyNo);
            parameters.Add("@vacancyDate", vacancy.PostedDate);

            DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetApplicantPassedToSecPhase, parameters);

            DataTable appResult = dpOperation.getRecord();

            response.Data = appResult;
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_REPORT_GENERATED_SUCCESS);
            response.setSuccess(true);
            return response;
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_APPLICANT_RESULT);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            response.setSuccess(false);
        }
        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
    public TransactionResponse addNewPromotionAssignment()
    {
        //Add List of Arguments for new promotion Assigment
        IDictionary<string, object> promotionAssigmentParameters = new Dictionary<string, object>();

        promotionAssigmentParameters.Add("@minNo", promotionAssigment.MinuteNo);
        promotionAssigmentParameters.Add("@hROfficerID", promotionAssigment.HROfficerID);
        promotionAssigmentParameters.Add("@deadLine", promotionAssigment.DeadLine);
        promotionAssigmentParameters.Add("@remark", promotionAssigment.Remark);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spAddPromotionAssignmentToHROfficer, promotionAssigmentParameters);
        TransactionResponse response = new TransactionResponse();
        try
        {
            //call update to DB mathod and get reponse.
            dpOperation.updateRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_VACANCY_ASSIGNED_SUCCESS);
        }

        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR + ". "+ DBOperationErrorConstants.M_DUPLICATE_PROMOTION_ASSIGNEMENT);
            response.setErrorCode(DBOperationErrorConstants.E_PROMOTION_ASSIGNEMETN_FAILED);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
    /**
     * Get recently selected, lateral and penality employee
     */
    public TransactionResponse getRecentlySelectedEmpResult()
    {
        TransactionResponse response = new TransactionResponse();
        try
        {
            //Add List of Arguments for new employee
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("@vacancy_No", vacancy.VacancyNo);
            parameters.Add("@vacancy_date", vacancy.PostedDate);

            DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetRecSelectedLateralPenality, parameters);

            DataTable recSelectedEmployee = dpOperation.getRecord();

            //if (recSelectedEmployee != null && recSelectedEmployee.Rows.Count != 0)
            //{
            response.Data = recSelectedEmployee;
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            return response;
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_GET_RECENTLY_SELECTED_RESULT);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            response.setSuccess(false);
        }
        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
    //delete resigned employee from database
    public TransactionResponse deleteResignedEmployee()
    {
        TransactionResponse response = new TransactionResponse();
        try
        {
            IDictionary<string, object> argumentMap = new Dictionary<string, object>();
            //task referance
            argumentMap.Add("@UserId", employee.UserName);

            //Pass Stored Procedure Name and parameter list.
            DBOperationsUtil dbOperation = new DBOperationsUtil(DbAccessConstants.spDeleteEmployeeInfor, argumentMap);
            bool isDeleteOk = dbOperation.deleteRecord();

            //put the data on Transaction response
            response.Data = isDeleteOk;

            response.setSuccess(true);

            //get delete status inside the TransactionResponse.
            return response;
        }
        catch (SqlException ex)
        {
            response.setErrorCode(DBOperationErrorConstants.E_ERROR_WHILE_REMOVING_INACTIVE_EMPLOYEE);
            response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_REMOVING_INACTIVE_EMPLOYEE);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setSuccess(false);
            return response;
        }

           //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setSuccess(false);
            return response;
        }
    }
 public TransactionResponse updatePromotionStatus(Promotion promotion, string promoStatus)
 {
     TransactionResponse response = new TransactionResponse();
     try
     {
         //Add List of Arguments for new employee
         IDictionary<string, object> parameters = new Dictionary<string, object>();
         DBOperationsUtil dpOperation = getDBOperationToUpdatePromotionStatus4Assignment(parameters, promotion, promoStatus);
         dpOperation.updateRecord();
         response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
         response.setSuccess(true);
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
         response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_UPDATE_VACANCY);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
     catch (Exception ex)
     {
         //Write this exception to file for investigation of the issue later.
         logException(ex);
         LoggerManager.upDateWithGenericErrorMessage(response);
     }
     return response;
 }
    /**
     * Add employee remark
    */
    public TransactionResponse storeEmployeeremark(MembershipUser currentUser)
    {
        //get detail of the logged on user.
        Employee employee = EmployeeManager.getLoggedOnUser((Guid)currentUser.ProviderUserKey);
        if (employee == null)
        {
            return EmployeeManager.handleLoggedInUserCanNotBeIdentfied();
        }

        //Add List of Arguments for new employee
        IDictionary<string, object> employeeRemarkMap = new Dictionary<string, object>();

        employeeRemarkMap.Add("@EmpID", employeeRemark.EmployeeID);
        employeeRemarkMap.Add("@remarkRefNo", employeeRemark.RemarkReferanceNo);
        employeeRemarkMap.Add("@dateOfRemark", employeeRemark.DateOfRemark);
        employeeRemarkMap.Add("@remarkType", employeeRemark.RemarkType);
        employeeRemarkMap.Add("@penalityPerc", employeeRemark.PenaltyPerc);
        employeeRemarkMap.Add("@managerID", employeeRemark.ManagerID);
        employeeRemarkMap.Add("@managerPosition", employeeRemark.ManagerPosition);
        employeeRemarkMap.Add("@remarkReason", employeeRemark.RemarkReason);
        employeeRemarkMap.Add("@responsiblehrOfficerID", employee.EmpID);
        employeeRemarkMap.Add("@Branch", employeeRemark.Branch);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddEmployeeRemark, employeeRemarkMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_REMARK_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_REF_NO_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
 public static TransactionResponse handleLoggedInUserCanNotBeIdentfied()
 {
     TransactionResponse response = new TransactionResponse();
     response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
     response.setErrorCode(DBOperationErrorConstants.M_CAN_NOT_IDENTIFY_CURRENT_USER);
     response.setMessage(DBOperationErrorConstants.M_CAN_NOT_IDENTIFY_CURRENT_USER);
     return response;
 }
 public TransactionResponse updateVacancyStatusToAssgnedFromReAdvertise()
 {
     TransactionResponse response = new TransactionResponse();
     try
     {
         bool updateStatus = sendVacancyUpdateStatus(response);
         if (updateStatus)
         {
             response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_CHANGED_TO_ASSIGNED_FROM_READVERTISE);
             response.setSuccess(true);
         }
         else
         {
             response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_CHANGED_TO_ASSIGNED_FROM_READVERTISE_FAIL);
             response.setErrorCode(DBOperationErrorConstants.E_VACANCY_READVERTISE_TO_REASSIGNED_FAILED);
             response.setSuccess(true);
         }
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
         response.setMessage(DBOperationErrorConstants.M_VACANCY_CHANGED_TO_ASSIGNED_FROM_READVERTISE_FAIL);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     return response;
 }
 /**
  * Update status fo Vacancy to Readverised after rating
  */
 public TransactionResponse updateVacancyStatusToReAdvertisedAfterRating()
 {
     TransactionResponse response = new TransactionResponse();
     try
     {
         bool updateStatus = readvertiseVacancyAfterRating(response);
         if (updateStatus)
         {
             response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_READVERTISED_SUCCESS);
             response.setSuccess(true);
         }
         else
         {
             response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_READVERTISE_FAIL);
             response.setErrorCode(DBOperationErrorConstants.E_VACANCY_READVERTISE_FAILED);
             response.setSuccess(true);
         }
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
         response.setMessage(DBOperationErrorConstants.M_VACANCY_CANCELLATION_FAIL);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     return response;
 }
    /*
     * Update Profile arrived date.
     */
    public TransactionResponse updateProfileArrivedDateAndVacancyStatus()
    {
        TransactionResponse response = new TransactionResponse();
        try
        {
            //Add List of Arguments for new employee
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("@vacancy_No", vacancy.VacancyNo);
            parameters.Add("@posted_date ", vacancy.PostedDate);

            DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spUpdateProfileArrivedDate, parameters);
            //COUNT NUMBER OF ROW UPDATED.
            bool updateProfDate = dpOperation.updateRecord();
            if (updateProfDate)
            {
                response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
                response.setMessage(DBOperationErrorConstants.M_PROFILE_DATE_REGISTERED);
                response.setSuccess(true);
            }
            else
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_PROFILE_DATE_NOT_REGISTERED);
                response.setErrorCode(DBOperationErrorConstants.E_PROFILE_ARRIVED_DATE_UPDATE_FAILED);
                response.setSuccess(true);
            }
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.E_PROFILE_ARRIVED_DATE_UPDATE_FAILED);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            response.setSuccess(false);
        }
        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
    public TransactionResponse updateVacancyEvaluation()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> vacancyParameters = new Dictionary<string, object>();

        vacancyParameters.Add("@vacancyNo", vacancy.VacancyNo);
        vacancyParameters.Add("@postedDate", vacancy.PostedDate);
        vacancyParameters.Add("@responsibleProcessor_EID", vacancy.ResponsibleProcessorEID);
        vacancyParameters.Add("@reponsibleAccessorEID", vacancy.ResponsibleAccessorEID);
        vacancyParameters.Add("@processorStartDate", vacancy.ProcessorStartDate);
        vacancyParameters.Add("@processorEendDate", vacancy.ProcessorEndDate);
        vacancyParameters.Add("@accessorStartDate", vacancy.AccessorStartDate);
        vacancyParameters.Add("@accessorEndDate", vacancy.AccessorEndDate);
        vacancyParameters.Add("@status", vacancy.Status);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spUpdateVacancyEvaluators, vacancyParameters);
        TransactionResponse response = new TransactionResponse();
        try
        {
            //call update to DB mathod and get reponse.
            dpOperation.updateRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_VACANCY_ASSIGNED_SUCCESS);
        }

        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_UPDATE_VACANCY);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
 /**
  * Update diploma applicant on vacancy readvertise
  */
 public TransactionResponse updateDiplomaApplicantToIncludeInEvaluation()
 {
     TransactionResponse response = new TransactionResponse();
     try
     {
         bool updateStatus = updateDiplomaApplicantToNull(response);
         if (updateStatus)
         {
             response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
             response.setMessage(DBOperationErrorConstants.M_DIPLOMA_APPLICANT_SUCCESS);
             response.setSuccess(true);
         }
         else
         {
             response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
             response.setMessage(DBOperationErrorConstants.M_INCLUDE_DIPLOMA_FAIL);
             response.setErrorCode(DBOperationErrorConstants.E_INCLUDE_DIPLOMA_APPLICANT_FAILED);
             response.setSuccess(true);
         }
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.WARNING);
         response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_GENERATING_REPORT);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     return response;
 }
    public TransactionResponse updateApplicantsEvaluationStatus(DataTable dataTable, string newStatus, int ranklimit)
    {
        //update Vacancy status
        bool vacancyStatusUpsateOk = false;
        TransactionResponse response = new TransactionResponse();

        try
        {
            vacancyStatusUpsateOk = sendVacancyUpdateStatus(new TransactionResponse());
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_UPDATE_APP_EVA_STATUS);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            return response;
        }
        //vacancy update is not OK, we stop the flow.
        if (!vacancyStatusUpsateOk)
        {
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_UPDATE_APP_EVA_STATUS);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            return response;
        }

        //convert the data in datatable, specifically in EID column to list of string separated by comma
        string listOfApplicants = DBOperationsUtil.getDataTableColumnAsListOfString(dataTable, "Employee ID", "Rank", ranklimit);

        //Add List of Arguments for new employee
        IDictionary<string, object> parameters = new Dictionary<string, object>();

        parameters.Add("@vacancyNo", vacancy.VacancyNo);
        parameters.Add("@vacancyDate", vacancy.PostedDate);
        parameters.Add("@newStatus", newStatus);
        parameters.Add("@listOfApplicants", listOfApplicants);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spUpdateAppicantsStatus, parameters);

        try
        {
            //call update to DB mathod and get reponse.
            dpOperation.updateRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_APPLICANTS_PASSED_SUCCESS);
        }

        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_UPDATE_APP_EVA_STATUS);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
    /**
     * Get complete vacancy evaluation report. - PHASE 1 and PHASE 2
     */
    public TransactionResponse getVacancyEvaluationResult(string reportPhase)
    {
        TransactionResponse response = new TransactionResponse();
        try
        {
            //Add List of Arguments for new employee
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("@vacancyNo", vacancy.VacancyNo);
            parameters.Add("@vacancyDate", vacancy.PostedDate);

            DBOperationsUtil dpOperation = null;
            if (PageConstants.REPORT_PHASE1.Equals(reportPhase))
            {
                dpOperation = new DBOperationsUtil(DbAccessConstants.spGetApplicantPhas1Evaluation, parameters);
            }
            else
            {
                dpOperation = new DBOperationsUtil(DbAccessConstants.spGetApplicantPhas2Evaluation, parameters);
            }

            DataTable updateApplRegComplete = dpOperation.getRecord();
            if (updateApplRegComplete == null || updateApplRegComplete.Rows.Count == 0)
            {
                response.setMessageType(TransactionResponse.SeverityLevel.WARNING);
                response.setMessage(DBOperationErrorConstants.M_NO_VACANCY_EVALUTION_RESULT);
                response.setErrorCode(DBOperationErrorConstants.E_NO_EVALUATION_RESULT);
                response.setSuccess(false);
                return response;
            }

            return rankApplicants(updateApplRegComplete, response);
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_GET_VACANCY_EVALUATION_RESULT);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            response.setSuccess(false);
        }
        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
Esempio n. 17
0
    /**
     * calls Store to DB utility for the current employee.
     */
    public TransactionResponse storeEmployee()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> employeeArgumentaMap = new Dictionary<string, object>();

        employeeArgumentaMap.Add("@Emp_ID", employee.EmpID);
        employeeArgumentaMap.Add("@UserId", employee.UserID);
        employeeArgumentaMap.Add("@First_Name", employee.FName);
        employeeArgumentaMap.Add("@Middle_Name", employee.MName);
        employeeArgumentaMap.Add("@Last_Name", employee.LName);
        employeeArgumentaMap.Add("@Sex", employee.Sex);
        employeeArgumentaMap.Add("@Prev_Job_Tittle", employee.PrevJob);
        employeeArgumentaMap.Add("@Job_Tittle", employee.JobTitle);
        employeeArgumentaMap.Add("@Grade", employee.JobGrade);
        employeeArgumentaMap.Add("@Salary", employee.Salary);
        employeeArgumentaMap.Add("@branch", employee.Branch);
        DateTime HDatefinal = DateTime.ParseExact(employee.Hdate, "dd/MM/yyyy", CultureInfo.InvariantCulture);
        employeeArgumentaMap.Add("@HDate", HDatefinal);
        employeeArgumentaMap.Add("@MajorCategory", employee.MajorCategory);
        employeeArgumentaMap.Add("@district", employee.District);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddNewEmployee, employeeArgumentaMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
    //this methode is used to update vacancy status from profile arrived to readvertise
    //and also set profile arrived & applicant registeration to NULL
    public TransactionResponse updateVacancyStatusToReadvertiseFromProfileArrived()
    {
        TransactionResponse response = new TransactionResponse();
        bool isUpdated = false;
        try
        {
            try
            {
                //Add List of Arguments for new employee
                IDictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add("@vacancy_No", vacancy.VacancyNo.Trim());
                parameters.Add("@posted_date ", vacancy.PostedDate.Trim());
                parameters.Add("@status", vacancy.Status);
                parameters.Add("@vancy_deadline", vacancy.VancyDeadline);

                DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spReadvertiseVacFromProfileArr, parameters);
                isUpdated = dpOperation.updateRecord();
            }
            //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
            catch (Exception ex)
            {
                //Write this exception to file for investigation of the issue later.
                logException(ex);
                LoggerManager.upDateWithGenericErrorMessage(response);
            }

            if (isUpdated)
            {
                response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
                response.setMessage(DBOperationErrorConstants.M_VACANCY_READVERTISED_SUCCESS);
                response.setSuccess(true);
            }
            else
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_VACANCY_READVERTISED_FAIL);
                response.setErrorCode(DBOperationErrorConstants.E_VACANCY_READVERTISE_FAILED);
                response.setSuccess(true);
            }
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_VACANCY_READVERTISED_FAIL);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            response.setSuccess(false);
        }
        return response;
    }
Esempio n. 19
0
    /**
     * Add promoted employee from other district
    */
    public TransactionResponse storeEmployeefromOtherDistrictForPromotion(string minNumber, string districtID)
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> employeeArgumentaMap = new Dictionary<string, object>();

        employeeArgumentaMap.Add("@Minute_No", minNumber);
        employeeArgumentaMap.Add("@Emp_ID", employee.EmpID);
        employeeArgumentaMap.Add("@First_Name", employee.FName);
        employeeArgumentaMap.Add("@Middle_Name", employee.MName);
        employeeArgumentaMap.Add("@Last_Name", employee.LName);
        employeeArgumentaMap.Add("@Curr_Jtitle", employee.PrevJob);
        employeeArgumentaMap.Add("@Curr_JGrade", employee.PrevJobGrade);
        employeeArgumentaMap.Add("@Exp_JGrade", employee.JobGrade);
        employeeArgumentaMap.Add("@Salary", employee.Salary);
        employeeArgumentaMap.Add("@district", districtID);
        employeeArgumentaMap.Add("@status", "Active");

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddPromotedEmployeefromOtherDistrict, employeeArgumentaMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_EMPLOYEE_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
 public TransactionResponse updateVacancyStatusToVacActiveforVacancyReversal()
 {
     TransactionResponse response = new TransactionResponse();
     try
     {
         bool updateStatus = sendVacancyUpdateStatus(response);
         if (updateStatus)
         {
             response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_REVERSED_SUCCESS);
             response.setSuccess(true);
         }
         else
         {
             response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_REVERSE_FAIL);
             response.setErrorCode(DBOperationErrorConstants.E_VACANCY_REVERSE_FAILED);
             response.setSuccess(true);
         }
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
         response.setMessage(DBOperationErrorConstants.M_VACANCY_REVERSE_FAIL);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     return response;
 }
Esempio n. 21
0
    // Insert Inactive Employeee into DB
    public TransactionResponse storeInactiveEmployee()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> employeeArgumentaMap = new Dictionary<string, object>();

        employeeArgumentaMap.Add("@EmpID", employee.EmpID);
        employeeArgumentaMap.Add("@FName", employee.FName);
        employeeArgumentaMap.Add("@MName", employee.MName);
        employeeArgumentaMap.Add("@LName", employee.LName);
        employeeArgumentaMap.Add("@Sex", employee.Sex);
        employeeArgumentaMap.Add("@JobTitle", employee.JobTitle);
        employeeArgumentaMap.Add("@branch", employee.Branch);
        employeeArgumentaMap.Add("@dateOfEmp", inactiveEmployee.DateOfEmployment);
        employeeArgumentaMap.Add("@dateOfTerm", inactiveEmployee.DateOfTermination);
        employeeArgumentaMap.Add("@majorCategory", inactiveEmployee.MajorCategory);
        employeeArgumentaMap.Add("@ReasonForleave", inactiveEmployee.ReasonForLeave);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddInactiveEmployee, employeeArgumentaMap);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_INACTIVE_EMPLOYEE_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

           //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_EVIL_ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setSuccess(false);
            return response;
        }
        return response;
    }
    /**
     * Return list of all managarial job positions
     */
    public static TransactionResponse getAllManagerialJobPosition()
    {
        TransactionResponse response = new TransactionResponse();

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetAllManagerialJobposition, null);
        try
        {
            DataTable dataTable = dpOperation.getRecord();

            response.Data = dataTable;
            response.setSuccess(true);
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setSuccess(false);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            LoggerManager.LogError(ex.ToString(), logger);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
Esempio n. 23
0
    /**
     * calls Store to DB utility for the current employee.
     */
    public TransactionResponse AddHROfficerOrClerk(string SPName, string EmpID)
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> paramater = new Dictionary<string, object>();

        paramater.Add("@Emp_ID", EmpID);

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(SPName, paramater);

        TransactionResponse response = new TransactionResponse();

        //call store to DB mathod and get reponse.
        try
        {
            storeToDb.instertNewRecord();
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setSuccess(true);
            response.setMessage(DBOperationErrorConstants.M_HR_OFFICER_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_EID_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_EMP_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
    /**
     * Return list of vacancy which have this status.
     */
    public static TransactionResponse getNotAnnouncedPromotion()
    {
        // Get a reference to the currently logged on user
        MembershipUser currentUser = Membership.GetUser();

        //get employee detail of the current user.
        Employee employee = EmployeeManager.getLoggedOnUser((Guid)currentUser.ProviderUserKey);

        TransactionResponse response = new TransactionResponse();

        //Pass Stored Procedure Name and parameter list.
        IDictionary<string, object> parameter = new Dictionary<string, object>();
        parameter.Add("@hROfficerID", employee.EmpID);
        DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetNotAnnouncedPromotion, parameter);
        try
        {
            DataTable dataTable = dpOperation.getRecord();

            response.Data = dataTable;
            response.setSuccess(true);
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setSuccess(false);
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_EVIL_ERROR);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            LoggerManager.LogError(ex.ToString(), logger);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
Esempio n. 25
0
    /**
     * Get Inactive employee by date interval
     */
    public TransactionResponse getInactiveEmployeeResult(string startedDate, string endDate)
    {
        TransactionResponse response = new TransactionResponse();
        try
        {
            //Add List of Arguments for new employee
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            parameters.Add("@startDate", startedDate);
            parameters.Add("@endDate", endDate);

            DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetInactiveEmployeeDetail, parameters);

            DataTable getResult = dpOperation.getRecord();
            if (getResult != null && getResult.Rows.Count > 0)
            {
                response.Data = getResult;
                response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
                response.setMessage(DBOperationErrorConstants.M_REPORT_GENERATED_SUCCESS);
                response.setSuccess(true);
                return response;
            }
            else
            {
                response.setMessageType(TransactionResponse.SeverityLevel.INFO);
                response.setMessage(DBOperationErrorConstants.M_GENERATE_INACTIVE_EMPLOYEE_REPORT_EMPTY);
                response.setSuccess(false);
                return response;
            }
        }
        catch (SqlException ex)
        {
            //Other SqlException is catched
            response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
            response.setMessage(DBOperationErrorConstants.M_UNABLE_TO_GENERATE_INACTIVE_EMPLOYEE);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            response.setSuccess(false);
        }
        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }
 public TransactionResponse getNotEvaluatedApplicantsForSecondPhase(int formType)
 {
     TransactionResponse response = new TransactionResponse();
     try
     {
         //Add List of Arguments for new employee
         IDictionary<string, object> parameters = new Dictionary<string, object>();
         parameters.Add("@vacancy_No", vacanyEvaluationForm.VacancyNo);
         parameters.Add("@vacancy_date", vacanyEvaluationForm.VacancyDate);
         parameters.Add("@formType", formType);
         DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetNotEvaluatedApplicantsforSecondPhase, parameters);
         List<string> listOfNotEvaluatedEmployee = dpOperation.getRecordAsListOfString("EID");
         if (listOfNotEvaluatedEmployee != null && listOfNotEvaluatedEmployee.Count > 0)
         {
             //convert list of string to one string seprated by ','
             response.Data = String.Join(", ", listOfNotEvaluatedEmployee.ToArray());
             response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_COMPLETION_NOT_POSSIBLE);
             response.setErrorCode(DBOperationErrorConstants.E_VACANCY_COMPLETION_NOT_POSSIBLE);
             response.setSuccess(false);
         }
         else
         {
             response.setMessageType(TransactionResponse.SeverityLevel.WARNING);
             response.setMessage(DBOperationErrorConstants.M_VACANCY_COMPLETION_WARNING);
             response.setSuccess(true);
         }
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
         response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_VERIFY_COMPLETE_VANCANCY);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
     catch (Exception ex)
     {
         //Write this exception to file for investigation of the issue later.
         logException(ex);
         LoggerManager.upDateWithGenericErrorMessage(response);
     }
     return response;
 }
    private TransactionResponse sendInsertPromotionToDb(string spName, IDictionary<string, object> parameters)
    {
        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(spName, parameters);

        TransactionResponse response = new TransactionResponse();
        try
        {
            //call store to DB mathod and get reponse.
            storeToDb.instertNewRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_PROMOTION_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_PROMOTION_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_APP_RATING_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
    public TransactionResponse addNewVacancy()
    {
        //Add List of Arguments for new employee
        IDictionary<string, object> vacancyParameters = new Dictionary<string, object>();

        vacancyParameters.Add("@vacancy_No", vacancy.VacancyNo);
        vacancyParameters.Add("@Vancay_title", vacancy.VancayTitle);
        vacancyParameters.Add("@branch_id", vacancy.BranchId);
        vacancyParameters.Add("@vancy_deadline", vacancy.VancyDeadline);
        vacancyParameters.Add("@vacancy_for_JobGrade", vacancy.VacancyforJobGrade);
        vacancyParameters.Add("@vacancy_opened_for", vacancy.VacancyOpenedFor);
        vacancyParameters.Add("@vacancy_evaluation_form", vacancy.VacancyEvaluationForm);
        vacancyParameters.Add("@year_gen_required", vacancy.YearRequiredforGeneral);
        vacancyParameters.Add("@year_spec_required", vacancy.YearRequiredforSpec);
        vacancyParameters.Add("@general_wrk_expr_percent", vacancy.GeneralWrkExprPercent);
        vacancyParameters.Add("@specific_wrk_expr_percent", vacancy.SpecificWrkExprPercent);
        vacancyParameters.Add("@related_wrk_expr_percent", vacancy.RelatedWrkExprPercent);
        vacancyParameters.Add("@examination_percent", vacancy.ExaminationPercent);
        vacancyParameters.Add("@manager_Recom_percent", vacancy.ManagerRecPercent);
        vacancyParameters.Add("@interview_percent", vacancy.InterviewPercent);
        vacancyParameters.Add("@JobDescription", vacancy.JobDescription);
        vacancyParameters.Add("@JobRequirement", vacancy.JobRequirement);
        vacancyParameters.Add("@JobBenefit", vacancy.SalaryAndBenefit);
        vacancyParameters.Add("@districtId", PageAccessManager.getDistrictID());

        //Pass Stored Procedure Name and parameter list.
        DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spAddNewVacancy, vacancyParameters);

        TransactionResponse response = new TransactionResponse();
        try
        {
            //call store to DB mathod and get reponse.
            storeToDb.instertNewRecord();
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
            response.setMessage(DBOperationErrorConstants.M_VACANCY_REGISTER_OK);
        }

        catch (SqlException ex)
        {
            //Determine if the cause was duplicate KEY.
            if (ex.ToString().Contains(DBOperationErrorConstants.PK_DUPLICATE_INDICATOR))
            {
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_DUPLICATE_VACANCY_KEY_ERROR);
                response.setErrorCode(DBOperationErrorConstants.E_DUPLICATE_KEY_ERROR);
            }
            else
            {
                //Other SqlException is catched
                response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
                response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_VACANCY_REGISTER);
                response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
            }
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }

        return response;
    }
 //The method to get the next applicant for 1st phase evaluation
 public List<string> getNextEvaluatedApplicants1stPhase(int hrOfficerType)
 {
     List<string> listOfNotEvaluatedEmployee = null;
     TransactionResponse response = new TransactionResponse();
     try
     {
         //Add List of Arguments for new employee
         IDictionary<string, object> parameters = new Dictionary<string, object>();
         parameters.Add("@vacancy_No", vacanyEvaluationForm.VacancyNo);
         parameters.Add("@vacancy_date", vacanyEvaluationForm.VacancyDate);
         parameters.Add("@hrOfficerType", hrOfficerType);
         DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spGetNotEvaluatedApplicants, parameters);
         listOfNotEvaluatedEmployee = dpOperation.getRecordAsListOfString("EID");
         if (listOfNotEvaluatedEmployee != null && listOfNotEvaluatedEmployee.Count > 0)
         {
             response.Data = listOfNotEvaluatedEmployee.ToArray();
         }
     }
     catch (SqlException ex)
     {
         //Other SqlException is catched
         response.setMessageType(TransactionResponse.SeverityLevel.ERROR);
         response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_VERIFY_COMPLETE_VANCANCY);
         response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
         response.setSuccess(false);
     }
     //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
     catch (Exception ex)
     {
         //Write this exception to file for investigation of the issue later.
         logException(ex);
         LoggerManager.upDateWithGenericErrorMessage(response);
     }
     return listOfNotEvaluatedEmployee;
 }
    /**
     * ReturnsPromotion detail: Minute No + HrOfficer name if this vacany is opened for it.
     */
    public TransactionResponse getPromotionForWhichVacancyOpened()
    {
        TransactionResponse response = new TransactionResponse();

        try
        {
            //Add List of Arguments for new employee
            IDictionary<string, object> parameters = new Dictionary<string, object>();

            parameters.Add("@vacancyNo", vacancy.VacancyNo);
            parameters.Add("@vacancyDate", vacancy.PostedDate);

            //get report for the Processor
            DBOperationsUtil dpOperation = new DBOperationsUtil(DbAccessConstants.spPromotionDetailThisVacancyOpenedFor, parameters);
            DataTable dataTable = dpOperation.getRecord();

            response.Data = dataTable;
            response.setSuccess(true);
            response.setMessageType(TransactionResponse.SeverityLevel.SUCESS);
        }

        catch (SqlException ex)
        {
            //Other SqlException is catched -  we can keep the same error message as if it is generating report issue
            response.setMessageType(TransactionResponse.SeverityLevel.WARNING);
            response.setMessage(DBOperationErrorConstants.M_UNKNOWN_ERROR_GENERATING_REPORT);
            response.setErrorCode(DBOperationErrorConstants.E_UNKNOWN_ERROR_AT_DB_OOPERATION);
        }

        //CATCH ANY OTHER EXCEPTION, dont let user see any kind of unexpected error
        catch (Exception ex)
        {
            //Write this exception to file for investigation of the issue later.
            logException(ex);
            LoggerManager.upDateWithGenericErrorMessage(response);
        }
        return response;
    }