Ejemplo n.º 1
0
    protected void btnGetHROfficers_Click(object sender, EventArgs e)
    {
        clearControl();
        lblVacancy.Visible = false;

        //validate input
        if (dpdCompletedVacancyList.SelectedValue == "-1")
        {
            lblVacancy.Visible = true;
            return;
        }

        string temp = dpdCompletedVacancyList.SelectedValue.ToString();

        string[] splitter = new string[] { PageConstants.GREATER_GREATER_THAN };
        string[] VacancyInfoTosplit = (temp).Split(splitter, StringSplitOptions.RemoveEmptyEntries);


        pnlVacancyList.Visible = false;


        //get Processor and checker name of the selected Vacany.
        string processorName;
        string checkerName;

        vacancyNo = VacancyInfoTosplit[0].Trim();
        vacancyDate = VacancyInfoTosplit[1].Trim();

        Vacancy vacancy = new Vacancy();
        vacancy.VacancyNo = vacancyNo;
        vacancy.PostedDate = vacancyDate;

        //First Check if Vacancy is opened for Promotion
        VacancyRegistrationAndEvaluationManager manager = new VacancyRegistrationAndEvaluationManager(vacancy);
        TransactionResponse promotionReponse = manager.getPromotionForWhichVacancyOpened();
        if (promotionReponse.isSuccessful())
        {
            DataTable dataTbl = (DataTable)promotionReponse.Data;
            if (dataTbl != null && dataTbl.Rows.Count > 0)
            {
                pnlVacancyForPromotion.Visible = true;
                
               // DateTime formatedDate = DateTime.ParseExact(dataTbl.Rows[0]["deadLine"].ToString(), "ddMMyyyy", CultureInfo.InvariantCulture);
                //yyyy-mm-dd
                lblVacancyForPromotion.Text = "<u><b>This Vacancy is Opened for Promotion </b></u><br/> " +
                    "Promotion Minute No. : " + dataTbl.Rows[0]["MinuteNo"].ToString() + "<br/>" +
                    "Deadline for opening the Promotion : " + Convert.ToDateTime(dataTbl.Rows[0]["deadLine"]).ToString("yyyy-MM-dd") + "<br/>" +
                    "Vacancy Opened by : " + dataTbl.Rows[0]["hrOfficerName"].ToString() + "<br/>" +
                    "Vacancy Opened on : " + Convert.ToDateTime(dataTbl.Rows[0]["vacancyAnnouncedDate"]).ToString("yyyy-MM-dd") + "<br/>";
                eIdOfEmployeeOpenedVacancy = dataTbl.Rows[0]["EmpID"].ToString();
                trackPromotionAnnounce = true;
            }
        }

        TransactionResponse hrOfficerDtailReponse = manager.getHROfficersDetailOfAVacancy();
        DataTable dataTable = (DataTable)hrOfficerDtailReponse.Data;

        if (!hrOfficerDtailReponse.isSuccessful())
        {
            displayMessageToTheUser(hrOfficerDtailReponse);
            return;
        }
        if (dataTable.Rows.Count < 1 || dataTable == null
            || dataTable.Rows[0]["procName"].ToString() == "" || dataTable.Rows[0]["checkName"].ToString() == ""
            || dataTable.Rows[0]["procName"].ToString() == null || dataTable.Rows[0]["checkName"].ToString() == null)
        {
            clearMsgLabel();
            if (!trackPromotionAnnounce)
            {
                msgPanel.Visible = true;
                InfoDIV.Visible = true;
                lblInformationMsg.Text = NO_VACANCY_REPORT;
            }
            else
            {
                msgPanel.Visible = true;
                InfoDIV.Visible = true;
                lblInformationMsg.Text = ONLY_PROMOTION_REPORT;
            }
            return;
        }
        else
        {
            if (dataTable != null && dataTable.Rows.Count > 0)
            {
                processorID = dataTable.Rows[0]["procID"].ToString();
                processorName = dataTable.Rows[0]["procName"].ToString();
                checkerID = dataTable.Rows[0]["checkID"].ToString();
                checkerName = dataTable.Rows[0]["checkName"].ToString();

                //display the selected Vacancy
                descLabelPanel.Visible = true;
                lblReportHeader.Text = dpdCompletedVacancyList.SelectedItem.Text;

                //Display the processor Name and his report
                pnlProcessorReport.Visible = true;
                lblProcessorName.Text = processorName + "<br/> Assigned processing start Date : "
                    + Convert.ToDateTime(dataTable.Rows[0]["processor_start_date"]).ToString("yyyy-MM-dd")
                    + "<br/> Assigned processing end Date : "
                    + Convert.ToDateTime(dataTable.Rows[0]["processor_end_date"]).ToString("yyyy-MM-dd");
                //Display the Checker Name and his report
                pnlCheckerReport.Visible = true;
                lblCheckerName.Text = checkerName + "<br/> Assigned checking start Date : "
                    + Convert.ToDateTime(dataTable.Rows[0]["accessor_start_date"]).ToString("yyyy-MM-dd")
                    + "<br/> Assigned checking end Date : "
                    + Convert.ToDateTime(dataTable.Rows[0]["accessor_end_date"]).ToString("yyyy-MM-dd");
            }
            else
            {
                return;
            }

        }

        vacancy.ResponsibleProcessorEID = processorID;
        vacancy.ResponsibleAccessorEID = checkerID;

        VacancyRegistrationAndEvaluationManager manager2 = new VacancyRegistrationAndEvaluationManager(vacancy);
        TransactionResponse response = manager2.getHROfficersVacancyEvaluationReport();
        if (!response.isSuccessful())
        {
            displayMessageToTheUser(response);
            return;
        }

        if (response.Data != null)
        {
            DataTable[] dataTables = (DataTable[])response.Data;
            if (dataTables[0] != null && dataTables[0].Rows.Count > 0)
            {
                processorReportGV.DataSource = dataTables[0];
                processorReportGV.DataBind();
            }

            if (dataTables[1] != null && dataTables[1].Rows.Count > 0)
            {
                checkerReportGV.DataSource = dataTables[1];
                checkerReportGV.DataBind();
            }
        }
        else
        {
            clearMsgLabel();
            msgPanel.Visible = true;
            InfoDIV.Visible = true;
            lblInformationMsg.Text = NO_VACANCY_REPORT;
        }
    }