/// <summary>
    /// Handles the Click event of the btnAdd control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Rave.HR.BusinessLayer.Employee.CertificationDetails objCertificationDetailsBAL;

        if (ValidateControls())
        {
            BusinessEntities.CertificationDetails objCertificationDetails = new BusinessEntities.CertificationDetails();
            objCertificationDetailsBAL = new Rave.HR.BusinessLayer.Employee.CertificationDetails();

            if (gvCertification.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
            {
                CertificationDetailsCollection.Clear();
            }

            objCertificationDetails.CertificationName = txtName.Text;
            objCertificationDetails.CertificateDate   = Convert.ToDateTime(ucDatePickerCertificationDate.Text);
            if (ucDatePickerCertficationValidDate.Text != "")
            {
                objCertificationDetails.CertificateValidDate = Convert.ToDateTime(ucDatePickerCertficationValidDate.Text);
            }
            // Mohamed :Issue 50440 : 10/04/2014 : Starts
            // Desc : Remove Mandatory validation from "TotalScore" and "OutOf" Fields
            objCertificationDetails.Score = float.Parse(txtTotalScore.Text == "" ? "0" : txtTotalScore.Text);
            objCertificationDetails.OutOf = float.Parse(txtOutOf.Text == "" ? "0" : txtOutOf.Text);
            // Mohamed :Issue 50440 : 10/04/2014 : Ends
            objCertificationDetails.Mode  = 1;
            objCertificationDetails.EMPId = int.Parse(EMPId.Value);

            CertificationDetailsCollection.Add(objCertificationDetails);

            objCertificationDetailsBAL.AddCertificationDetails(objCertificationDetails);

            this.PopulateGrid(objCertificationDetails.EMPId);

            this.ClearControls();
            //To solved the issue no 19221
            //Comment by Rahul P
            //Start
            //btnAddRow.Text = CommonConstants.BTN_AddRow;
            btnAddRow.Text = "Save";
            //End
            lblMessage.Text = "Certification details saved successfully.";
        }
    }
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //Clearing the error label
        lblError.Text   = string.Empty;
        lblMessage.Text = string.Empty;

        btnAddRow.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");
        btnUpdate.Attributes.Add(Common.CommonConstants.EVENT_ONCLICK, "return ButtonClickValidate();");

        txtName.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtName.ClientID + "','" + imgName.ClientID + "','" + Common.CommonConstants.VALIDATE_ALPHABET_WITHSPACE + "');");
        imgName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanName.ClientID + "','" + Common.CommonConstants.MSG_ONLY_ALPHABET + "');");
        imgName.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanName.ClientID + "');");

        txtTotalScore.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtTotalScore.ClientID + "','" + imgTotalScore.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgTotalScore.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanTotalScore.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgTotalScore.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanTotalScore.ClientID + "');");

        txtOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONBLUR, "return ValidateControl('" + txtOutOf.ClientID + "','" + imgOutOf.ClientID + "','" + Common.CommonConstants.VALIDATE_NUMERIC_FUNCTION + "');");
        imgOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOVER, "ShowTooltip('" + spanOutOf.ClientID + "','" + Common.CommonConstants.MSG_NUMERIC + "');");
        imgOutOf.Attributes.Add(Common.CommonConstants.EVENT_ONMOUSEOUT, "HideTooltip('" + spanOutOf.ClientID + "');");

        ucDatePickerCertificationDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + ucDatePickerCertificationDate.ClientID + "','','');");
        ucDatePickerCertificationDate.Attributes.Add(ReadOnly, ReadOnly);
        ucDatePickerCertficationValidDate.Attributes.Add(CommonConstants.EVENT_ONBLUR, "javascript:ValidateControl('" + ucDatePickerCertficationValidDate.ClientID + "','','');");
        ucDatePickerCertficationValidDate.Attributes.Add(ReadOnly, ReadOnly);

        if (!ValidateURL())
        {
            Response.Redirect(CommonConstants.INVALIDURL, false);
        }

        if (Session[Common.SessionNames.EMPLOYEEDETAILS] != null)
        {
            employee = (BusinessEntities.Employee)Session[Common.SessionNames.EMPLOYEEDETAILS];
        }

        if (employee != null)
        {
            employeeID      = employee.EMPId;
            lblempName.Text = employee.FirstName.ToUpper() + " " + employee.LastName.ToUpper();
        }

        if (!IsPostBack)
        {
            Session["isSaved"]             = null;
            Session[SessionNames.PAGEMODE] = Common.MasterEnum.PageModeEnum.View;
            this.PopulateGrid(employeeID);
        }

        if (gvCertification.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
        {
            CertificationDetailsCollection.Clear();
            ShowHeaderWhenEmptyGrid();
        }

        // Get logged-in user's email id
        AuthorizationManager objRaveHRAuthorizationManager = new AuthorizationManager();

        UserRaveDomainId = objRaveHRAuthorizationManager.getLoggedInUser();
        UserMailId       = UserRaveDomainId.Replace("co.in", "com");

        arrRolesForUser = RaveHRAuthorizationManager.getRolesForUser(objRaveHRAuthorizationManager.getLoggedInUser());

        if (UserMailId.ToLower() == employee.EmailId.ToLower() || arrRolesForUser.Contains(AuthorizationManagerConstants.ROLEHR))
        {
            if (Session[SessionNames.PAGEMODE] != null)
            {
                PageMode = Session[SessionNames.PAGEMODE].ToString();

                if (PageMode == Common.MasterEnum.PageModeEnum.View.ToString() && IsPostBack == false && gvCertification.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
                {
                    Certificationdetails.Enabled = false;
                    btnEdit.Visible       = true;
                    btnEditCancel.Visible = true;
                    btnCancel.Visible     = false;
                    btnAddRow.Visible     = false;
                }
            }
        }
        else
        {
            Certificationdetails.Enabled = false;
        }


        SavedControlVirtualPath = "~/EmployeeMenuUC.ascx";
        ReloadControl();
    }