protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        if (!WebUtils.CheckPermission(Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            EmployeeSelectAllPanel.Visible = false;
            IsAllowEdit = false;
        }

        empSBinding = new SearchBinding(dbConn, EEmpPersonalInfo.db);
        empSBinding.add(new DropDownVLSearchBinder(MPFPlanID, "MPFPlanID", EMPFPlan.VLMPFPlan));
        empSBinding.initValues("EmpStatus", null, EEmpPersonalInfo.VLEmpStatus, HROne.Common.WebUtility.GetSessionUICultureInfo(Session));
        empSBinding.init(DecryptedRequest, null);

        empInfo = ListFooter.ListInfo;

        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);

        mpfFileControl = getMPFFileControl();
    }
    private MPFFileControlInterface getMPFFileControl()
    {
        HROne.ProductLicense license = WebUtils.productLicense(Session);

        MPFFileControlInterface tmpMPFFileControl = null;

        //btnSubmit.Visible = false;
        string strMPDPlanID = MPFPlanID.SelectedValue;
        int    intMPFPlanID = 0;

        if (int.TryParse(strMPDPlanID, out intMPFPlanID))
        {
            EMPFPlan mpfPlan = new EMPFPlan();
            mpfPlan.MPFPlanID = intMPFPlanID;
            if (EMPFPlan.db.select(dbConn, mpfPlan))
            {
                EMPFScheme mpfScheme = new EMPFScheme();
                mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID;
                if (EMPFScheme.db.select(dbConn, mpfScheme))
                {
                    if (mpfScheme.MPFSchemeTrusteeCode.Equals("HSBC") || mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng"))
                    {
                        Payroll_GenerateMPFFile_HSBCControl.Visible     = true;
                        Payroll_GenerateMPFFile_BOCIControl.Visible     = false;
                        Payroll_GenerateMPFFile_ManulifeControl.Visible = false;
                        Payroll_GenerateMPFFile_AIAControl.Visible      = false;
                        Payroll_GenerateMPFFile_HSBCOISControl.Visible  = false;
                        tmpMPFFileControl = Payroll_GenerateMPFFile_HSBCControl;
                        Payroll_GenerateMPFFile_HSBCControl.BankCode = mpfScheme.MPFSchemeTrusteeCode;
                        //if (Payroll_GenerateMPFFile_HSBCControl.GetSelectedFileTypeValue().Equals("AMPFF") && Session["CompanyDBID"] != null)
                        //    btnSubmit.Visible = true;
                    }
                    else if (mpfScheme.MPFSchemeTrusteeCode.Equals("BOCI") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers))
                    {
                        Payroll_GenerateMPFFile_HSBCControl.Visible     = false;
                        Payroll_GenerateMPFFile_BOCIControl.Visible     = true;
                        Payroll_GenerateMPFFile_ManulifeControl.Visible = false;
                        Payroll_GenerateMPFFile_AIAControl.Visible      = false;
                        Payroll_GenerateMPFFile_HSBCOISControl.Visible  = false;
                        tmpMPFFileControl = Payroll_GenerateMPFFile_BOCIControl;
                    }
                    else if (mpfScheme.MPFSchemeTrusteeCode.Equals("Manulife") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers))
                    {
                        Payroll_GenerateMPFFile_HSBCControl.Visible     = false;
                        Payroll_GenerateMPFFile_BOCIControl.Visible     = false;
                        Payroll_GenerateMPFFile_ManulifeControl.Visible = true;
                        Payroll_GenerateMPFFile_AIAControl.Visible      = false;
                        Payroll_GenerateMPFFile_HSBCOISControl.Visible  = false;
                        tmpMPFFileControl = Payroll_GenerateMPFFile_ManulifeControl;
                    }
                    else if (mpfScheme.MPFSchemeTrusteeCode.Equals("AIA") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers))
                    {
                        Payroll_GenerateMPFFile_HSBCControl.Visible     = false;
                        Payroll_GenerateMPFFile_BOCIControl.Visible     = false;
                        Payroll_GenerateMPFFile_ManulifeControl.Visible = false;
                        Payroll_GenerateMPFFile_AIAControl.Visible      = true;
                        Payroll_GenerateMPFFile_HSBCOISControl.Visible  = false;
                        tmpMPFFileControl = Payroll_GenerateMPFFile_AIAControl;
                    }
                    else if (mpfScheme.MPFSchemeCode.Equals("MT00288") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers))
                    {
                        // Fidelity is using HSBC's Open-Interface-System
                        Payroll_GenerateMPFFile_HSBCControl.Visible     = false;
                        Payroll_GenerateMPFFile_BOCIControl.Visible     = false;
                        Payroll_GenerateMPFFile_ManulifeControl.Visible = false;
                        Payroll_GenerateMPFFile_AIAControl.Visible      = false;
                        Payroll_GenerateMPFFile_HSBCOISControl.Visible  = true;
                        tmpMPFFileControl = Payroll_GenerateMPFFile_HSBCOISControl;
                    }
                    else
                    {
                        Payroll_GenerateMPFFile_HSBCControl.Visible     = false;
                        Payroll_GenerateMPFFile_BOCIControl.Visible     = false;
                        Payroll_GenerateMPFFile_ManulifeControl.Visible = false;
                        Payroll_GenerateMPFFile_AIAControl.Visible      = false;
                        Payroll_GenerateMPFFile_HSBCOISControl.Visible  = false;
                    }
                    return(tmpMPFFileControl);
                }
            }
        }
        Payroll_GenerateMPFFile_HSBCControl.Visible     = false;
        Payroll_GenerateMPFFile_BOCIControl.Visible     = false;
        Payroll_GenerateMPFFile_ManulifeControl.Visible = false;
        Payroll_GenerateMPFFile_AIAControl.Visible      = false;
        return(null);
    }