//Update Applicant Result
    public DataTable UpdateApplicantResult(VacancyEvaluationForm vacancyEvaluationForm, Vacancy vacancy)
    {
        //prepare parameters
        IDictionary<string, object> argumentsMap = new Dictionary<string, object>();
        argumentsMap.Add("@Emp_ID", vacancyEvaluationForm.EmpId);
        argumentsMap.Add("@vacancy_No", vacancy.VacancyNo);
        argumentsMap.Add("@vacancy_date", vacancy.PostedDate);
        argumentsMap.Add("@education_level_mark", vacancyEvaluationForm.EducationLevelMark);
        argumentsMap.Add("@general_work_expr", vacancyEvaluationForm.GeneralWorkExpr);
        argumentsMap.Add("@specific_work_expr", vacancyEvaluationForm.SpecificWorkRxpr);
        argumentsMap.Add("@recommendation_of_mgr_line", vacancyEvaluationForm.RecommendationOfMgrLine);
        argumentsMap.Add("@interview_result_recommendation", vacancyEvaluationForm.InterviewResult);
        argumentsMap.Add("@remark", vacancyEvaluationForm.Remark);
        argumentsMap.Add("@evaluation_status", vacancyEvaluationForm.ApplicantStatus);

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

        //call getRecord method and get DataTable
        DataTable dataTable = storeToDb.getRecord();

        return dataTable;
    }
    protected void passAppGVform1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        clearMsgPanel();
        int index = passAppGVform1.EditIndex;
        GridViewRow row = passAppGVform1.Rows[index];

        Label EmpID = (Label)row.FindControl("lblEmpID");
        TextBox txtMarkEdu = (TextBox)row.FindControl("txtMarkEdu");
        TextBox txtGenWorExp = (TextBox)row.FindControl("txtGenWorExp");
        TextBox txtSpecWorExp = (TextBox)row.FindControl("txtSpecWorExp");
        TextBox txtMgrRec = (TextBox)row.FindControl("txtMgrRec");
        TextBox txtInterRes = (TextBox)row.FindControl("txtInterRes");
        DropDownList DropDRemark = (DropDownList)row.FindControl("DropDRemark");
        DropDownList DropDStatus = (DropDownList)row.FindControl("DropDStatus");

        double markEdu = 0;
        double genWorkExp = 0;
        double specWorkExp = 0;
        double mgrRec = 0;
        double? interviewres = null;
        
        try
        {
            markEdu = Convert.ToDouble(txtMarkEdu.Text.Trim());
            genWorkExp = Convert.ToDouble(txtGenWorExp.Text.Trim());
            specWorkExp = Convert.ToDouble(txtSpecWorExp.Text.Trim());
            mgrRec = Convert.ToDouble(txtMgrRec.Text.Trim());

            if (txtInterRes.Text.Trim() != "")
            {
                interviewres = Convert.ToDouble(txtInterRes.Text.Trim());
            }
        }
        catch (FormatException)
        {
            clearMsgPanel();
            msgPanel.Visible = true;
            ErroroDIV.Visible = true;
            lblErrorMsg.Text = "Invalid value inserted.";
            return;
        }
        catch (Exception ex)
        {
            clearMsgPanel();
            msgPanel.Visible = true;
            ErroroDIV.Visible = true;
            lblErrorMsg.Text = ex.StackTrace;
            return;
        }

        VacancyEvaluationForm vacancyEvaluationForm = new VacancyEvaluationForm();

        vacancyEvaluationForm.EmpId = EmpID.Text.Trim();
        vacancyEvaluationForm.EducationLevelMark = markEdu.ToString();
        vacancyEvaluationForm.GeneralWorkExpr = genWorkExp.ToString();
        vacancyEvaluationForm.SpecificWorkRxpr = specWorkExp.ToString();
        vacancyEvaluationForm.RecommendationOfMgrLine = mgrRec.ToString();
        if (txtInterRes.Text.Trim() == "")
        {
            vacancyEvaluationForm.InterviewResult = "";
        }
        else
        {
            vacancyEvaluationForm.InterviewResult = interviewres.ToString();
        }
        vacancyEvaluationForm.Remark = DropDRemark.SelectedValue.Trim();
        vacancyEvaluationForm.ApplicantStatus = DropDStatus.SelectedValue.Trim();

        Vacancy vacancy = getSelectedVacancy(DropDPassVac);

        DateTime datTime = Convert.ToDateTime(vacancy.PostedDate);

        EmployeeManager applicantManager = new EmployeeManager();

        applicantManager.UpdateApplicantResult(vacancyEvaluationForm, vacancy);
        passAppGVform1.EditIndex = -1;

        TransactionResponse response = getAppResult(getSelectedVacancy(DropDPassVac));
        DataTable dataTable = (DataTable)response.Data;
        passAppGVform1.DataSource = dataTable;
        passAppGVform1.DataBind();
    }
    private VacancyEvaluationForm getAppicantDetailForThisFormType(DataRow row, string formType)
    {
        //we should return null if forType is not good one.
        VacancyEvaluationForm applicantRatingDetail = null;
        if (FORM1.Equals(formType))
        {
            applicantRatingDetail = new VacancyEvaluationForm();
            applicantRatingDetail.EmpId = row["EID"].ToString();
            applicantRatingDetail.VacancyNo = row["vacancy_No"].ToString();
            applicantRatingDetail.VacancyDate = row["vacancy_date"].ToString();
            applicantRatingDetail.EducationLevelMark = row["education_level_mark"].ToString();
            applicantRatingDetail.GeneralWorkExpr = row["general_work_expr"].ToString();
            applicantRatingDetail.SpecificWorkRxpr = row["specific_work_expr"].ToString();
            applicantRatingDetail.RecommendationOfMgrLine = row["recommendation_of_mgr_line"].ToString();
            applicantRatingDetail.InterviewResultRecommendation = row["interview_result_recommendation"].ToString();
            applicantRatingDetail.Remark = row["remark"].ToString();
        }

        else if (FORM2.Equals(formType))
        {
            applicantRatingDetail = new VacancyEvaluationForm();
            applicantRatingDetail.EmpId = row["EID"].ToString();
            applicantRatingDetail.VacancyNo = row["vacancy_No"].ToString();
            applicantRatingDetail.VacancyDate = row["vacancy_date"].ToString();
            applicantRatingDetail.EducationLevelMark = row["education_level_mark"].ToString();
            applicantRatingDetail.RelatedWorExperiance = row["related_work_experiance"].ToString();
            applicantRatingDetail.ExaminationResult = row["examination_result"].ToString();
            applicantRatingDetail.InterviewResult = row["interview_result"].ToString();
            applicantRatingDetail.Remark = row["remark"].ToString();
        }
        return applicantRatingDetail;
    }
 public VacancyRegistrationAndEvaluationManager(VacancyEvaluationForm vacanyEvaluationForm)
 {
     this.vacanyEvaluationForm = vacanyEvaluationForm;
 }
    protected void btnGenOnlyUpdate_Click(object sender, EventArgs e)
    {
        VacancyEvaluationForm vacancyEvaluationForm = new VacancyEvaluationForm();

        //VLIDATE INPUT AND GET ALL INPUTS
        bool isAllInputValid = validateInputPopulateEvaluationForm2(vacancyEvaluationForm);

        //STOP the flow if there is invalid input. 
        if (!isAllInputValid)
        {
            return;
        }
        updateVacancyEvaluation(vacancyEvaluationForm);
    }
    protected void btnNextEmp_Click(object sender, EventArgs e)
    {
        clearMsgPanelAndLabel();
        countNextClick += 1;
        string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN };
        VacancyInfoTosplit = (DropDVacancyProcessed.SelectedItem.Text).Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        vacancyNo = VacancyInfoTosplit[0];
        VacancyDate = VacancyInfoTosplit[1];

        string[] tempVacancyInfoTosplit = (DropDVacancyProcessed.SelectedValue).Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        isGenOrGSpecificForm = tempVacancyInfoTosplit[2].Trim();

        try
        {
            //Verify if vacancy complete is possible.
            VacancyEvaluationForm evaluationForm = new VacancyEvaluationForm();
            evaluationForm.VacancyNo = vacancyNo.Trim();
            evaluationForm.VacancyDate = VacancyDate.Trim();
            VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(evaluationForm);
            List<string> response = manager.getNextEvaluatedApplicants2ndPhase(Convert.ToInt16(isGenOrGSpecificForm));

            if (response.Count > 0 && response != null)
            {
                int countNotEvaluatedEmp = response.Count;

                if (countNextClick >= countNotEvaluatedEmp)
                {
                    countNextClick = 0;
                }

                string nextEmployee = response[countNextClick].ToString();

                evaluateAnotherEmployeeform1();
                evaluateAnotherEmployeeform2();

                txtEmpID.Text = nextEmployee;
            }
            else
            {
                PanelApplicantmsg.Visible = true;
                ApplInfoDiv.Visible = true;
                lblApplicantInfomsg.Text = "All Applicant is evaluated. You can complete the evaluation if you are sure.";
            }
        }
        catch (Exception)
        {
            PanelApplicantmsg.Visible = true;
            ApplInfoDiv.Visible = true;
            lblApplicantInfomsg.Text = "We have a problem trying to get the next evaluated employee. Please contact your system administrator.";
        }
    }
    private bool validateInputPopulateEvaluationForm2(VacancyEvaluationForm vacancyEvaluationForm)
    {
        bool trackAll = true;
        if (vacancyStatus == "7" || vacancyStatus == "9")
        {
            if (txtGenOnlyInterviewRes.Text != "")
            {

                try
                {
                    vacancyEvaluationForm.InterviewResult = txtGenOnlyInterviewRes.Text.Trim();
                }
                catch (Exception)
                {
                    trackAll = false;
                    lblonlyGInterviewRes.Visible = true;
                    lblonlyGInterviewRes.Text = "Invalid input for Interview result!";
                    return false;
                }
            }

            else
            {
                trackAll = false;
                lblonlyGInterviewRes.Visible = true;
                lblonlyGInterviewRes.Text = "Interview result can't be Empty!";
            }
        }
        else
        {
            vacancyEvaluationForm.InterviewResult = "0";
        }

        if (vacancyStatus == "8" || vacancyStatus == "9")
        {
            if (txtGenOnlyExamRes.Text != "")
            {

                try
                {
                    vacancyEvaluationForm.ExaminationResult = txtGenOnlyExamRes.Text.Trim();
                }
                catch (Exception)
                {
                    trackAll = false;
                    lblonlyGExamRes.Visible = true;
                    lblonlyGExamRes.Text = "Invalid input for Exam result!";
                    return false;
                }
            }

            else
            {
                trackAll = false;
                lblonlyGExamRes.Visible = true;
                lblonlyGExamRes.Text = "Exam result can't be Empty!";
            }
        }
        else
        {
            vacancyEvaluationForm.ExaminationResult = "0";
        }

        string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN };
        VacancyInfoTosplit = (lblTheCurrentVacancy.Text).Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        vacancyNo = VacancyInfoTosplit[0].Trim();
        VacancyDate = VacancyInfoTosplit[1].Trim();
        vacancyEvaluationForm.EmpId = txtEmployeeID.Text.Trim();
        vacancyEvaluationForm.VacancyNo = vacancyNo.Trim();
        vacancyEvaluationForm.VacancyDate = VacancyDate.Trim();
        vacancyEvaluationForm.FormType = FORM2.Trim();
        vacancyEvaluationForm.ApplicantType = applicantType.Trim();

        return trackAll;
    }
    private void updateVacancyEvaluation(VacancyEvaluationForm vacancyEvaluationForm)
    {
        //CALL The manager
        VacancyRegistrationAndEvaluationManager vacancyRegistrationAndEvaluationManager = new VacancyRegistrationAndEvaluationManager(vacancyEvaluationForm);
        TransactionResponse response = vacancyRegistrationAndEvaluationManager.updateApplicantRatingForSecondPhase(applicantType);

        if (response.isSuccessful())
        {
            //take care of buttons to be displayed. 
            if (FORM1.Equals(isGenOrGSpecificForm))
            {
                btnGenAddNew.Enabled = true;
                btnGenAddNew.Visible = true;
                btnGenUpdate.Visible = false;
                btnGenCancelUpdate.Visible = false;
                btnGenSave.Visible = false;
            }
            else if(FORM2.Equals(isGenOrGSpecificForm))
            {
                btnGOnlyNew.Enabled = true;
                btnGOnlyNew.Visible = true;
                btnGenOnlyUpdate.Visible = false;
                btnGenOnlyCancelUpdate.Visible = false;
                btnGOnlySave.Visible = false;
            }
        }
        displayMessageToTheUser(response);
    }
    private bool validateInputPopulateEvaluationForm1(VacancyEvaluationForm vacancyEvaluationForm)
    {
        //first clear all message. 
        clearLabelmgs();

        bool trackAll = true;

        if (txtGSInterviewRes.Text != "")
        {
            try
            {
                vacancyEvaluationForm.InterviewResult = Convert.ToDouble(txtGSInterviewRes.Text).ToString();
            }
            catch (Exception)
            {
                trackAll = false;
                lblGSinterviewRes.Visible = true;
                lblGSinterviewRes.Text = "Invalid input for Interview result!";
                return false;
            }
        }
        else
        {
            trackAll = false;
            lblGSinterviewRes.Visible = true;
            lblGSinterviewRes.Text = "Interview result can't be Empty!";
            return false;
        }

        string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN };
        VacancyInfoTosplit = (lblTheCurrentVacancy.Text).Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        vacancyNo = VacancyInfoTosplit[0].Trim();
        VacancyDate = VacancyInfoTosplit[1].Trim();
        vacancyEvaluationForm.EmpId = txtEmployeeID.Text.Trim();
        vacancyEvaluationForm.VacancyNo = vacancyNo.Trim();
        vacancyEvaluationForm.VacancyDate = VacancyDate.Trim();
        vacancyEvaluationForm.FormType = FORM1.Trim();
        vacancyEvaluationForm.ApplicantType = applicantType.Trim();

        return trackAll;
    }
    protected void btnCompleteVacancy_Click(object sender, EventArgs e)
    {
        string vacancyWithTitle = "";
        try
        {
            if (DropDVacancyProcessed.SelectedValue != "-1")
            {
                vacancyWithTitle = DropDVacancyProcessed.SelectedItem.Text;
            }
            else
            {
                lblSelectVacmsg.Visible = true;
                return;
            }
        }
        catch (Exception)
        {
            lblSelectVacmsg.Visible = true;
            lblSelectVacmsg.Text = "Something went wrong. Please contact your administrator";
            return;
        }
        readInputsAndInitVariables();
        
        PanelVacList.Visible = false;
        PanelConfirmVacancyComplete.Visible = true;
        btnConfirmComplete.Visible = true;
        PanelCurrentVacancySelected.Visible = false;
        EmpInfoRatingPanel.Visible = false;


        //Verify if vacancy complete is possible.
        VacancyEvaluationForm evaluationForm = new VacancyEvaluationForm();
        evaluationForm.VacancyNo = vacancyNo.Trim();
        evaluationForm.VacancyDate = VacancyDate.Trim();
        VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(evaluationForm);
        TransactionResponse response = manager.getNotEvaluatedApplicantsForSecondPhase(Convert.ToInt32(isGenOrGSpecificForm));

        if (response.isSuccessful())
        {
            lblVacancyComplete.Text = "<span style='size:XX-Large'>Vacancy to complete :" +
                vacancyWithTitle + "</span><br/><br/>" + response.getMessage() + "<br/><br/>";
            btnCancel.Text = "NO NOT NOW";
        }
        else
        {
            string listOfNotEvaluatedApplicant = (string)response.Data;
            lblVacancyComplete.Text = "<span style='size:XX-Large'> Vacancy to complete : "
            + vacancyWithTitle + "</span><br/><br/> <b>Not evaluated applicant(s) EID: </b>"
            + listOfNotEvaluatedApplicant + "<br/><br/>";

            btnCancel.Text = "OK";
            btnConfirmComplete.Visible = false;
            displayMessageToTheUser(response);
        }

    }
    private void populateEvaluationFormForEdit(VacancyEvaluationForm applicantRatingDetail)
    {
        if (FORM1.Equals(isGenOrGSpecificForm))
        {
            txtGSInterviewRes.Text = applicantRatingDetail.InterviewResultRecommendation;

            btnGenSave.Visible = false;
            btnGenAddNew.Visible = false;
            btnGenCancelUpdate.Visible = true;
            btnGenUpdate.Visible = true;
        }

        else if (FORM2.Equals(isGenOrGSpecificForm))
        {
            txtGenOnlyInterviewRes.Text = applicantRatingDetail.InterviewResult;
            txtGenOnlyExamRes.Text = applicantRatingDetail.ExaminationResult;

            btnGOnlySave.Visible = false;
            btnGOnlyNew.Visible = false;
            btnGenOnlyUpdate.Visible = true;
            btnGenOnlyCancelUpdate.Visible = true;
        }
    }
    private bool checkAlreadyEvaluatedApplicantAndDisplayForUpdate(Employee employee, Vacancy vacancy)
    {
        //CHECK IF THIS EMPLOYEE IS ALREADY PROCESSED EMPLOYEE
        VacancyEvaluationForm vacanyEvaluationForm = new VacancyEvaluationForm();
        vacanyEvaluationForm.EmpId = employee.EmpID;
        vacanyEvaluationForm.VacancyNo = vacancy.VacancyNo;
        vacanyEvaluationForm.VacancyDate = vacancy.PostedDate;
        vacanyEvaluationForm.FormType = isGenOrGSpecificForm;

        //get employee type. - it can be internal or external. 
        applicantType = employee.EmployeeType;

        VacancyRegistrationAndEvaluationManager vacancyManager = new VacancyRegistrationAndEvaluationManager(vacanyEvaluationForm);
        TransactionResponse response = vacancyManager.checkIfItIslreadyEvaluatedEmployeeForSecondPhase(employee);

        //If the employee is already evaluated employee
        if (response.isSuccessful())
        {
            if (response.getMessageType() != TransactionResponse.SeverityLevel.WARNING)
            {
                //display detail of Existing data for update 
                displayEmployeeDetailForUpdate(employee, response.Data);
            }

            displayMessageToTheUser(response);

            //we stop the flow 
            return true;
        }

        return false;
    }
Example #13
0
    //Update Applicant Result
    public DataTable UpdateApplicantResult(VacancyEvaluationForm vacancyEvaluationForm, Vacancy vacancy)
    {
        //prepare parameters
        IDictionary<string, object> argumentsMap = new Dictionary<string, object>();
        argumentsMap.Add("@Emp_ID", vacancyEvaluationForm.EmpId);
        argumentsMap.Add("@vacancy_No", vacancy.VacancyNo);
        argumentsMap.Add("@vacancy_date", vacancy.PostedDate);
        argumentsMap.Add("@education_level_mark", vacancyEvaluationForm.EducationLevelMark);
        argumentsMap.Add("@general_work_expr", vacancyEvaluationForm.GeneralWorkExpr);
        argumentsMap.Add("@specific_work_expr", vacancyEvaluationForm.SpecificWorkRxpr);
        argumentsMap.Add("@recommendation_of_mgr_line", vacancyEvaluationForm.RecommendationOfMgrLine);
        argumentsMap.Add("@interview_result_recommendation", vacancyEvaluationForm.InterviewResult);
        argumentsMap.Add("@remark", vacancyEvaluationForm.Remark);
        argumentsMap.Add("@evaluation_status", vacancyEvaluationForm.ApplicantStatus);

        DataTable dataTable = null;
        try
        {
            //Pass Stored Procedure Name and parameter list. 
            DBOperationsUtil storeToDb = new DBOperationsUtil(DbAccessConstants.spUpdateApplicantDetailform1, argumentsMap);

            //call getRecord method and get DataTable
            dataTable = storeToDb.getRecord();
        }
        catch (SqlException ex)
        {
            //return emptylist
            return dataTable;
        }

        //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);
            return dataTable;
        }

        return dataTable;
    }