protected void Page_PreRender(object sender, EventArgs e)
    {
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);

        HROne.ProductVersion.Database database = new HROne.ProductVersion.Database(dbConn);

        SYSTEM_DB_VERSION.Text  = ProductVersion.CURRENT_DB_VERSION;
        RUNNING_DB_VERSION.Text = database.RunningDatabaseVersion();
        if (!Page.IsPostBack)
        {
            cbxPARAM_CODE_DEFAULT_RECORDS_PER_PAGE.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_RECORDS_PER_PAGE);

            txtPARAM_CODE_DEFAULT_DOCUMENT_FOLDER.Text   = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_DOCUMENT_FOLDER);
            txtPARAM_CODE_BANKFILE_UPLOAD_FOLDER.Text    = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_BANKFILE_UPLOAD_FOLDER);
            txtPARAM_CODE_HSBC_MRI_DIRECTORY.Text        = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_HSBC_MRI_DIRECTORY);
            txtPARAM_CODE_BANKFILE_CUTOFF_TIME.Text      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_BANKFILE_CUTOFF_TIME);
            txtPARAM_CODE_BANKFILE_LAST_CANCEL_TIME.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_BANKFILE_LAST_CANCEL_TIME);


            txtPARAM_CODE_LOGIN_MAX_FAIL_COUNT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_LOGIN_MAX_FAIL_COUNT);
            txtPARAM_CODE_SESSION_TIMEOUT.Text      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SESSION_TIMEOUT);

            txtPARAM_CODE_SMTP_SERVER_NAME.Text   = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME);
            txtPARAM_CODE_SMTP_PORT.Text          = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PORT);
            chkPARAM_CODE_SMTP_ENABLE_SSL.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;
            txtPARAM_CODE_SMTP_USERNAME.Text      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_USERNAME);
            txtPARAM_CODE_SMTP_PASSWORD.Attributes.Add("value", PASSWORD_NO_CHANGE_KEYWORD);//ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PASSWORD);
            txtPARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS);

            txtPARAM_CODE_DEFAULT_MAX_INBOX_SIZE_MB.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_MAX_INBOX_SIZE_MB);
        }
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        HROneSaaSConfig SaaSconfig = HROneSaaSConfig.GetCurrentConfig();
        string          HROnePath  = new System.IO.FileInfo(SaaSconfig.HROneConfigFullPath).Directory.FullName;

        ECompanyDatabase c      = new ECompanyDatabase();
        Hashtable        values = new Hashtable();

        binding.toValues(values);

        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();


        db.validate(errors, values);

        if (!errors.isEmpty())
        {
            return;
        }

        db.parse(values, c);

        if (!chkAutoCreateID.Checked && string.IsNullOrEmpty(c.CompanyDBClientCode))
        {
            errors.addError("Client ID is required");
            return;
        }



        HROne.ProductKey key = new HROne.ProductKey();
        key.ProductType    = HROne.ProductKey.ProductLicenseType.HROneSaaS;
        key.NumOfCompanies = Convert.ToUInt16(c.CompanyDBMaxCompany);
        key.NumOfUsers     = Convert.ToUInt16(c.CompanyDBMaxUser);
        if (c.CompanyDBHasIMGR)
        {
            key.IsLeaveManagement = true;
            key.IsPayroll         = true;
            key.IsTaxation        = true;
        }
        if (c.CompanyDBHasIStaff)
        {
            key.IsESS = true;
        }

        if (string.IsNullOrEmpty(c.CompanyDBClientCode))
        {
            const int MAX_LENGTH = 8;
            string    prefix     = CreateClientCodePrefix(c.CompanyDBClientName);
            //if (c.CompanyDBClientBank.Equals("HSBC", StringComparison.CurrentCultureIgnoreCase))
            //    prefix = "H";
            //else if (c.CompanyDBClientBank.Equals("HangSeng", StringComparison.CurrentCultureIgnoreCase))
            //    prefix = "X";
            int idx = 0;
            if (prefix.Length >= MAX_LENGTH)
            {
                prefix = prefix.Substring(0, MAX_LENGTH);
            }
            else
            {
                idx++;
                string idxString = idx.ToString().Trim();
                prefix = prefix.PadRight(MAX_LENGTH - idxString.Length, '0') + idxString;
            }
            c.CompanyDBClientCode = prefix;
            while (!AppUtils.checkDuplicate(dbConn, ECompanyDatabase.db, c, new PageErrors(), "CompanyDBClientCode"))
            {
                idx++;
                string idxString = idx.ToString().Trim();
                c.CompanyDBClientCode = prefix.Substring(0, MAX_LENGTH - idxString.Length) + idxString;
            }
        }
        if (!AppUtils.checkDuplicate(dbConn, ECompanyDatabase.db, c, errors, "CompanyDBClientCode"))
        {
            return;
        }

        EDatabaseServer dbServer = new EDatabaseServer();

        dbServer.DBServerID = c.DBServerID;
        if (EDatabaseServer.db.select(dbConn, dbServer))
        {
            if (dbServer.DBServerDBType.Equals("MSSQL"))
            {
                System.Data.SqlClient.SqlConnectionStringBuilder saConnStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder();
                saConnStringBuilder.DataSource = dbServer.DBServerLocation;
                saConnStringBuilder.UserID     = dbServer.DBServerSAUserID;
                saConnStringBuilder.Password   = dbServer.DBServerSAPassword;

                DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.DBType           = WebUtils.DBTypeEmun.MSSQL;
                dbConfig.ConnectionString = saConnStringBuilder.ConnectionString;
                if (dbConfig.TestServerConnectionWithoutDatabase())
                {
                    string DBSchemaName = c.CompanyDBSchemaName.Trim();
                    if (DBSchemaName.Equals(string.Empty))
                    {
                        DBSchemaName = c.CompanyDBClientCode;
                    }
                    System.Data.SqlClient.SqlConnectionStringBuilder connStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder();
                    connStringBuilder.DataSource     = dbServer.DBServerLocation;
                    connStringBuilder.InitialCatalog = DBSchemaName;
                    connStringBuilder.UserID         = dbServer.DBServerUserID;
                    connStringBuilder.Password       = dbServer.DBServerPassword;
                    dbConfig.ConnectionString        = connStringBuilder.ConnectionString;
                    if (!dbConfig.TestConnection())
                    {
                        if (chkCreateDB.Checked)
                        {
                            try
                            {
                                HROne.ProductVersion.Database.CreateSchema(saConnStringBuilder.ConnectionString, DBSchemaName, dbServer.DBServerUserID);
                                //c.CompanyDBSchemaName = DBSchemaName;
                                saConnStringBuilder.InitialCatalog = DBSchemaName;
                                HROne.ProductVersion.Database.CreateTableAndData(HROnePath, saConnStringBuilder.ConnectionString);
                                // drop all the connection so that new "normal user" connection to database is accepted
                                System.Data.SqlClient.SqlConnection.ClearAllPools();
                            }
                            catch (Exception ex)
                            {
                                errors.addError(ex.Message);
                                return;
                            }
                        }
                        else
                        {
                            errors.addError("Fail to connect to database");
                            return;
                        }
                    }
                }
                else
                {
                    errors.addError("Fail to connect to server");
                    return;
                }
            }
        }
        if (CurID < 0)
        {
            //            Utils.MarkCreate(Session, c);

            db.insert(dbConn, c);
            CurID = c.CompanyDBID;
            HSBCExchangeProfile_List1.CompanyDBID = CurID;
            //            url = Utils.BuildURL(-1, CurID);
        }
        else
        {
            //            Utils.Mark(Session, c);
        }

        key.SerialNo          = Convert.ToUInt16(c.CompanyDBID);
        c.CompanyDBProductKey = key.GetProductKey();
        db.update(dbConn, c);

        HROne.ProductVersion.Database databaseProcess = new HROne.ProductVersion.Database(new DatabaseConnection(c.getConnectionString(dbConn), DatabaseConnection.DatabaseType.MSSQL), HROnePath);
        databaseProcess.UpdateDatabaseVersion(true);
        errors.addError("Saved");
        loadObject();
        //Response.Redirect("~/CompanyDB_List.aspx");
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     database                  = new HROne.ProductVersion.Database(dbConn);
     lblDBVersion.Text         = database.RunningDatabaseVersion();
     lblRequiredDBVersion.Text = HROne.ProductVersion.Database.CURRENT_DB_VERSION;
 }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);

        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();
        if (string.IsNullOrEmpty(HSBCMRICommandLineDirectory))
        {
            errors.addError("MRI Command Line Folder has not been set");
            Renew.Visible = false;
        }
        else
        {
            string commandLinePath = System.IO.Path.Combine(HSBCMRICommandLineDirectory, "MRI2.exe");
            if (!System.IO.File.Exists(commandLinePath))
            {
                errors.addError("MRI2.exe does not exists on Command Line Folder");
                Renew.Visible = false;
            }
            else
            {
                HROne.ProductVersion.Database database = new HROne.ProductVersion.Database(dbConn);
                try
                {
                    HROne.HSBC.Utility.HSBCMRICommandLineDirectory = HSBCMRICommandLineDirectory;

                    string HSBCKeyPath = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PATH);
                    if (System.IO.File.Exists(HSBCKeyPath))
                    {
                        lblHSBCKeyID.Text = HROne.HSBC.Utility.getKeyId(HSBCKeyPath);
                        if (!HROne.HSBC.Utility.isKeyExpired(HSBCKeyPath))
                        {
                            lblHSBCKeyDaysExpired.Text = HROne.HSBC.Utility.keyExpiredLeftDays(HSBCKeyPath) + " Days";
                        }
                        else
                        {
                            lblHSBCKeyDaysExpired.Text = "Expired";
                        }
                    }

                    string HASEKeyPath = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_BANKKEY_HASE_PATH);
                    if (System.IO.File.Exists(HASEKeyPath))
                    {
                        lblHASEKeyID.Text = HROne.HSBC.Utility.getKeyId(HASEKeyPath);
                        if (!HROne.HSBC.Utility.isKeyExpired(HASEKeyPath))
                        {
                            lblHASEKeyDaysExpired.Text = HROne.HSBC.Utility.keyExpiredLeftDays(HASEKeyPath) + " Days";
                        }
                        else
                        {
                            lblHASEKeyDaysExpired.Text = "Expired";
                        }
                    }
                }
                catch (Exception ex)
                {
                    errors.addError(ex.Message);
                    Renew.Visible = false;
                }
            }
        }
    }
    protected void Page_PreRender(object sender, EventArgs e)
    {
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);

        lblDefault_MAX_MONTHLY_LSPSP_AMOUNT.Text = DEFAULT_MAX_MONTHLY_LSPSP_AMOUNT.ToString();
        lblDefault_MAX_TOTAL_LSPSP_AMOUNT.Text   = DEFAULT_MAX_TOTAL_LSPSP_AMOUNT.ToString();

        HROne.ProductVersion.Database database = new HROne.ProductVersion.Database(dbConn);

        SYSTEM_APP_VERSION.Text = ProductVersion.CURRENT_PROGRAM_VERSION;
        SYSTEM_DB_VERSION.Text  = HROne.ProductVersion.Database.CURRENT_DB_VERSION;
        RUNNING_DB_VERSION.Text = database.RunningDatabaseVersion();
        PRODUCT_TYPE.Text       = productLicense.ProductType.ToString();
        MAX_COMPANY.Text        = productLicense.NumOfCompanies.ToString();
        MAX_USERS.Text          = productLicense.NumOfUsers.ToString();
        if (productLicense.MaxInboxSizeMB.Equals(uint.MaxValue))
        {
            MAX_INBOX_SIZE_MB.Text = HROne.Common.WebUtility.GetLocalizedString("Unlimited");
        }
        else
        {
            MAX_INBOX_SIZE_MB.Text = productLicense.MaxInboxSizeMB.ToString();
        }

        if (productLicense.NumOfEmployees.Equals(uint.MaxValue))
        {
            MAX_EMPLOYEES.Text = HROne.Common.WebUtility.GetLocalizedString("Unlimited");
        }
        else
        {
            MAX_EMPLOYEES.Text = productLicense.NumOfEmployees.ToString();
        }

        lblActiveUser.Text = WebUtils.TotalActiveUser(dbConn, 0).ToString();

        lblActiveCompany.Text = WebUtils.TotalActiveCompany(dbConn, 0).ToString();

        lblActiveEmployee.Text = WebUtils.TotalActiveEmployee(dbConn, 0).ToString();
        lblTotalInboxSize.Text = ((double)EInboxAttachment.GetTotalSize(dbConn, 0) / 1000.0 / 1000.0).ToString("0.000");

        if (!productLicense.IsValidAuthorizationCode())
        {
            TrialPeriodPanel.Visible = true;
            TRIAL_PERIOD_TO.Text     = productLicense.LastTrialDate.ToString("yyyy-MM-dd");
        }
        else
        {
            TrialPeriodPanel.Visible = false;
        }
        if (!Page.IsPostBack)
        {
            WebUtils.AddLanguageOptionstoDropDownList(cbxPARAM_CODE_DEFAULT_LANGUAGE);
            WebUtils.AddLanguageOptionstoDropDownList(cbxPARAM_CODE_ESS_DEFAULT_LANGUAGE);

            cbxPARAM_CODE_DEFAULT_LANGUAGE.SelectedValue         = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_LANGUAGE);
            cbxPARAM_CODE_ESS_DEFAULT_LANGUAGE.SelectedValue     = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEFAULT_LANGUAGE);
            cbxPARAM_CODE_DEFAULT_RECORDS_PER_PAGE.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DEFAULT_RECORDS_PER_PAGE);
            txtPARAM_CODE_DB_TITLE.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DB_TITLE);
            txtPARAM_CODE_DOCUMENT_UPLOAD_FOLDER.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_DOCUMENT_UPLOAD_FOLDER);
            if (string.IsNullOrEmpty(txtPARAM_CODE_DOCUMENT_UPLOAD_FOLDER.Text))
            {
                txtPARAM_CODE_DOCUMENT_UPLOAD_FOLDER.Text = HROne.CommonLib.FileIOProcess.DefaultUploadFolder();
            }


            txtPARAM_CODE_LOGIN_MAX_FAIL_COUNT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_LOGIN_MAX_FAIL_COUNT);
            txtPARAM_CODE_SESSION_TIMEOUT.Text      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SESSION_TIMEOUT);

            chkPARAM_CODE_HKID_CHECKDIGIT_AUTO_GENERATE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_HKID_CHECKDIGIT_AUTO_GENERATE).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;
            // Start 0000044, Miranda, 2014-05-09
            chkPARAM_CODE_EMP_NO_AUTO_GENERATE.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_NO_AUTO_GENERATE).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;
            txtPARAM_CODE_EMP_NO_FORMAT.Text           = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_NO_FORMAT);
            // End 0000044, Miranda, 2014-05-09

            cbxPARAM_CODE_USE_ORSO.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_USE_ORSO).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;
            txtPARAM_CODE_PAYROLL_MAX_MONTHLY_LSPSP_AMOUNT.Text   = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAYROLL_MAX_MONTHLY_LSPSP_AMOUNT);
            txtPARAM_CODE_PAYROLL_MAX_TOTAL_LSPSP_AMOUNT.Text     = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAYROLL_MAX_TOTAL_LSPSP_AMOUNT);
            cbxPARAM_CODE_PAY_SLIP_HIDE_LEAVE_BALANCE.Checked     = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAY_SLIP_HIDE_LEAVE_BALANCE).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            cbxPARAM_CODE_PAY_SLIP_HIDE_MINIMUM_WAGE_INFO.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAY_SLIP_HIDE_MINIMUM_WAGE_INFO).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;
            txtPARAM_CODE_MPF_FILE_BOCI_ENCRYPT_PATH.Text         = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_MPF_FILE_BOCI_ENCRYPT_PATH);

            ddbPARAM_CODE_REPORT_CHINESE_FONT.SelectedValue = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_REPORT_CHINESE_FONT);

            chkPARAM_CODE_TAXATION_USE_CHINESE_NAME.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_TAXATION_USE_CHINESE_NAME).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;

            txtPARAM_CODE_SMTP_SERVER_NAME.Text   = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME);
            txtPARAM_CODE_SMTP_PORT.Text          = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PORT);
            chkPARAM_CODE_SMTP_ENABLE_SSL.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;
            txtPARAM_CODE_SMTP_USERNAME.Text      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_USERNAME);
            txtPARAM_CODE_SMTP_PASSWORD.Attributes.Add("value", PASSWORD_NO_CHANGE_KEYWORD);//ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PASSWORD);
            txtPARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS);

            chkPARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO.Checked           = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION.Checked        = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_CANCEL_LEAVE_APPLICATION.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CANCEL_LEAVE_APPLICATION).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_LEAVE_HISTORY.Checked            = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_ENQUIRY.Checked    = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_ENQUIRY).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_REPORT.Checked     = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION_LIST.Checked   = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION_LIST).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_ROSTER_TABLE.Checked             = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ROSTER_TABLE).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_PRINT_PAYSLIP.Checked            = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_PRINT_PAYSLIP).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_PRINT_TAXREPORT.Checked          = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_PRINT_TAXREPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_OVERALL_PAYMENT_SUMMARY.Checked  = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OVERALL_PAYMENT_SUMMARY).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            // Start 0000060, Miranda, 2014-07-22
            if (ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM))
            {
                chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS.Checked         = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
                chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            }
            // End 0000060, Miranda, 2014-07-22
            // Start 0000112, Miranda, 2014-12-10
            if (ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE))
            {
                chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE.Checked         = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LATE_WAIVE).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
                chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            }
            // End 0000112, Miranda, 2014-12-10
            // Start 0000057, KuangWei, 2014-07-08
            chkPARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD.Checked           = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            // End 0000057, KuangWei, 2014-07-08
            // Start 0000076, Miranda, 2014-08-21
            chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_REPORT.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            // End 0000076, Miranda, 2014-08-21
            txtPARAM_CODE_ESS_LEAVE_MEDICIAL_CERT_ALERT.Text = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_LEAVE_MEDICIAL_CERT_ALERT);

            wdpPARAM_CODE_ESS_PAYSLIP_START_DATE.Value       = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_PAYSLIP_START_DATE);
            chkPARAM_CODE_ESS_PAYSLIP_AUTO_RELEASE.Checked   = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_PAYSLIP_AUTO_RELEASE).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            wdpPARAM_CODE_ESS_LEAVE_HISTORY_START_DATE.Value = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_LEAVE_HISTORY_START_DATE);
            // Start 0000060, Miranda, 2014-07-22
            //wdpPARAM_CODE_ESS_DEF_EOT_EXPIRY_DATE.Value = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEF_EOT_EXPIRY_DATE);

            string essDefEotExpiry = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEF_EOT_EXPIRY);
            txtPARAM_CODE_ESS_DEF_EOT_EXPIRY.Text = string.IsNullOrEmpty(essDefEotExpiry) ? "1" : essDefEotExpiry;
            WebUtils.AddYearMonthDayOptionstoDropDownList(cbxPARAM_CODE_ESS_DEF_EOT_EXPIRY_TYPE);
            string essDefEotExpiryType = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_DEF_EOT_EXPIRY_TYPE);
            cbxPARAM_CODE_ESS_DEF_EOT_EXPIRY_TYPE.SelectedValue = string.IsNullOrEmpty(essDefEotExpiryType) ? "M" : essDefEotExpiryType;// "M" means Month
            // End 0000060, Miranda, 2014-07-22

            chkPARAM_CODE_EMP_LIST_SHOW_COMPANY.Checked = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_COMPANY).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_EMP_LIST_SHOW_H1.Checked      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H1).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_EMP_LIST_SHOW_H2.Checked      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H2).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
            chkPARAM_CODE_EMP_LIST_SHOW_H3.Checked      = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H3).Equals("Y", StringComparison.CurrentCultureIgnoreCase);
        }

        if (productLicense.IsESS)
        {
            PanelESSSection.Visible = true;
        }
        else
        {
            PanelESSSection.Visible = false;
        }

        if (productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROne)
        {
            DBTitleRow.Visible = true;
            BOCIEncryptPathSettingRow.Visible    = true;
            DocumentUploadPathSettingRow.Visible = true;
            //ORSOSettingRow.Visible = true;
            PanelSMTPSection.Visible = true;
        }
        else
        {
            DBTitleRow.Visible = false;
            BOCIEncryptPathSettingRow.Visible    = false;
            DocumentUploadPathSettingRow.Visible = false;
            //ORSOSettingRow.Visible = false;
            PanelSMTPSection.Visible = false;
        }

        eot_row.Visible = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM);

        this.chkPARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_TIMECARD_RECORD);
        this.lblEnabledTimeCardRecord.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD.Enabled;

        this.chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_ATTENDANCE_TIMEENTRY_LIST);
        this.lblEnabledAttendanceTimeEntryList.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST.Enabled;

        this.chkPARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_MONTHLY_ATTENDANCE_REPORT);
        this.lblEnabledMonthlyAttendanceReport.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT.Enabled;

        this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS.Enabled         = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM);
        this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM);
        this.lblEnabledOTClaims.Visible        = !this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS.Enabled;
        this.lblEnabledOTClaimsHistory.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY.Enabled;
        // Start 000112, Ricky So, 2014/12/18
        this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE.Enabled         = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE);
        this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY.Enabled = ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE);
        this.lblEnabledLateWaive.Visible        = !this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE.Enabled;
        this.lblEnabledLateWaiveHistory.Visible = !this.chkPARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY.Enabled;
        // End 000112, Ricky So, 2014/12/18
    }