//protected void Page_Init(object sender, EventArgs e)
    //{
    //    EUser defaultUser = (HROne.Lib.Entities.EUser)Session["User"];
    //    if (defaultUser != null)
    //    {
    //        EUser user = new EUser();
    //        user.UserID = defaultUser.UserID;
    //        user.UserLanguage = cboLanguage.SelectedValue;
    //        WebUtils.SetSessionLanguage(Session, user);

    //        HROne.Common.WebUtility.initLanguage(Session);
    //    }
    //}


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session))
        {
            return;
        }


        reminderBinding = new SearchBinding(dbConn, EReminderType.db);
        EUser user = WebUtils.GetCurUser(this.Session);

        if (user != null)
        {
            CurID = user.UserID;
        }

        string selectedLanguage = cboLanguage.SelectedValue;

        cboLanguage.Items.Clear();
        cboLanguage.Items.Add(new ListItem("System Default", ""));
        WebUtils.AddLanguageOptionstoDropDownList(cboLanguage);
        cboLanguage.SelectedIndex = cboLanguage.Items.IndexOf(cboLanguage.Items.FindByValue(selectedLanguage));
        reminderInfo = ListFooter.ListInfo;

        productLicense = WebUtils.productLicense(Session);

        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            UserIsKeepConnectedRow.Visible = false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.IsCostCenter)
        {
            this.CostCenterPanel.Visible = true;
        }
        else
        {
            this.CostCenterPanel.Visible = false;
        }

        if (productLicense.IsTraining)
        {
            this.TrainingPanel.Visible = true;
        }
        else
        {
            this.TrainingPanel.Visible = false;
        }

        if (productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROne)
        {
            DocumentTypePanel.Visible = true;
            PermitTypePanel.Visible   = true;
        }
        else
        {
            DocumentTypePanel.Visible = false;
            PermitTypePanel.Visible   = false;
        }

        BoldActiveLink(this);
    }
    //private const string FUNCTION_CODE = "RPT002";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session))
        {
            return;
        }
        if (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_USE_ORSO).Equals("Y"))
        {
            ReportPFundPanel.Visible = false;
        }

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

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            //  Use FindControl to prevent compatibility with customized menu
            PlaceHolder section = (PlaceHolder)Master.FindControl("mainContentPlaceHolder").FindControl("HROneOnlyReportSection");
            if (section != null)
            {
                section.Visible = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        //Start 0000173, Miranda, 2015-06-03
        this.Page.Form.DefaultButton = "mainContentPlaceHolder$Jump";
        //End 0000173, Miranda, 2015-06-03
        if (!Page.IsPostBack)
        {
            //prevPage = Request.UrlReferrer.ToString();
        }
        if (!WebUtils.CheckAccess(Response, Session))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;

        if (!WebUtils.CheckPermission(Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            Emp_PersonalInfo1.Visible = false;
        }
        if (!int.TryParse(DecryptedRequest["EmpID"], out CurID))
        {
            CurID = -1;
        }
        EmpID.Value = CurID.ToString();

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

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.iMGR)
        {
            IsAllowAddRow = false;
        }
    }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;



        binding = new Binding(dbConn, db);
        binding.add(LeaveTypeID);
        binding.add(LeaveType);
        binding.add(LeaveTypeDesc);
        binding.add(LeaveDecimalPlace);
        binding.add(new LabelVLBinder(db, LeaveTypeIsUseWorkHourPattern, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveTypeIsSkipStatutoryHolidayChecking, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveTypeIsSkipPublicHolidayChecking, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveTypeIsDisabled, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveTypeIsESSHideLeaveBalance, Values.VLTrueFalseYesNo));
        binding.add(new CheckBoxBinder(db, LeaveTypeIsESSIgnoreEntitlement));
        binding.add(new CheckBoxBinder(db, LeaveTypeIsESSRestrictNegativeBalanceAsOfToday));
        binding.add(new CheckBoxBinder(db, LeaveTypeIsESSRestrictNegativeBalanceAsOfApplicationDateFrom));
        binding.add(new CheckBoxBinder(db, LeaveTypeIsESSRestrictNegativeBalanceAsOfApplicationDateTo));
        binding.add(new CheckBoxBinder(db, LeaveTypeIsESSRestrictNegativeBalanceAsOfEndOfLeaveYear));
        binding.add(LeaveTypeIsESSAllowableAdvanceBalance);

        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["LeaveTypeID"], out CurID))
        {
            CurID = -1;
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.IsESS)
        {
            ESSRow.Visible = true;
        }
        else
        {
            ESSRow.Visible = false;
        }

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

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     productLicense = WebUtils.productLicense(Session);
     if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
     {
         return;
     }
     if (!WebUtils.CheckPermission(Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
     {
         Save.Visible = false;
     }
 }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense != null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.iMGR)
        {
            if (!productLicense.IsLeaveManagement)
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/eChannel_CompanyInbox_List.aspx");
            }
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Emp_List.aspx");
    }
Exemple #8
0
    protected void Page_Init(object sender, EventArgs e)
    {
        Session["LastURL"] = Request.Url.PathAndQuery;

        user = WebUtils.GetCurUser(Session);
        //WebUtils.SetSessionLanguage(Session, user);

        lblVersionNo.Text = ProductVersion.CURRENT_PROGRAM_VERSION;

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense != null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.iMGR)
        {
            Page.Title = "iMGR";
            lblCopyrightCompanyName.Text = "iGlobe Technology Limited";
        }
    }
Exemple #9
0
    protected static bool LoadProductKey(HttpSessionState Session)
    {
        DatabaseConnection dbConn = HROne.Common.WebUtility.GetDatabaseConnection(Session);

        HROne.ProductLicense tmpProductKey = new HROne.ProductLicense();
        //  will create dummy product license if not exists
        tmpProductKey.LoadProductLicense(dbConn);
        //tmpProductKey.SetFeatureByCode(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PRODUCTFEATURECODE));
        Session[SESSION_PRODUCTLICENSE] = tmpProductKey;
        if (tmpProductKey.IsValidProductKey)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Exemple #10
0
        public void SetNewTrialKey(DatabaseConnection dbConn)
        {
            ProductLicense originalProductKey = new ProductLicense();

            originalProductKey.LoadProductLicense(dbConn);
            if (ProductKey != originalProductKey.ProductKey && (originalProductKey.IsValidProductKey || string.IsNullOrEmpty(originalProductKey.ProductKey)))
            {
                Crypto crypto   = new Crypto(Crypto.SymmProvEnum.DES);
                string trialKey = string.Empty;
                if (IsValidProductKey)
                {
                    trialKey = crypto.Encrypting(AppUtils.ServerDateTime().Date.AddDays(PRODUCT_TRIALPERIOD).ToString("yyyyMMdd"), m_ProductType.ToString());
                }
                else
                {
                    trialKey = crypto.Encrypting(AppUtils.ServerDateTime().Date.AddDays(DEFAULT_TRIALPERIOD).ToString("yyyyMMdd"), m_ProductType.ToString());
                }

                trialKey = base32.ConvertBase64ToBase32(trialKey);
                LoadTrialKey(trialKey, dbConn);
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense != null)
        {
            if (productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.iMGR)
            {
                if (ci.Name.Equals("zh-cht", StringComparison.CurrentCultureIgnoreCase))
                {
                    Response.Redirect("http://www.peopletech.hk/userguide/to_be_provided_Userguide(chi).pdf");
                }
                else
                {
                    Response.Redirect("http://www.peopletech.hk/userguide/to_be_provided_Userguide.pdf");
                }
            }
            else
            {
                Response.Redirect("http://www.peopletech.hk/userguide/HROne_Userguide_Standard.pdf");
            }
        }
    }
Exemple #12
0
    protected void Page_Init(object sender, EventArgs e)
    {
        Session["LastURL"]    = Request.Url.PathAndQuery;
        Session["CurrentURI"] = Request.Url;
        if (!Request.AppRelativeCurrentExecutionFilePath.Equals("~/ESS_EmpChangePassword.aspx"))
        {
            if (Session["ForceChangePassword"] != null)
            {
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/ESS_EmpChangePassword.aspx");
            }
        }

        user = WebUtils.GetCurUser(Session);
        //WebUtils.SetSessionLanguage(Session, user);

        //lblVersionNo.Text = ProductVersion.CURRENT_PROGRAM_VERSION;

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense != null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.iMGR)
        {
            Page.Title = "iStaff";
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        toolBar.FunctionCode       = FUNCTION_CODE;
        PayPeriodEditPanel.Visible = toolBar.EditButton_Visible;

        toolBar.FunctionCode = FUNCTION_CODE;

        if (!int.TryParse(DecryptedRequest["PayGroupID"], out CurID))
        {
            CurID = -1;
        }

        sbinding = new SearchBinding(dbConn, db);
        sbinding.init(DecryptedRequest, null);

        binding = new Binding(dbConn, db);
        binding.add(PayGroupCode);
        binding.add(PayGroupDesc);
        binding.add(new LabelVLBinder(db, PayGroupFreq, EPayrollGroup.VLPayGroupFreq));
        binding.add(PayGroupDefaultStartDay);
        //binding.add(PayGroupDefaultEndDay);
        binding.add(PayGroupDefaultNextStartDay);
        binding.add(PayGroupLeaveDefaultCutOffDay);
        binding.add(PayGroupLeaveDefaultNextCutOffDay);

        binding.add(PayGroupNextStartDate);
        binding.add(PayGroupNextEndDate);

        binding.add(new BlankZeroLabelVLBinder(db, PayGroupDefaultProrataFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new LabelVLBinder(db, PayGroupRestDayHasWage, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PayGroupLunchTimeHasWage, Values.VLTrueFalseYesNo));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupRestDayProrataFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new LabelVLBinder(db, PayGroupAdditionalRemunerationPayCodeID, EPaymentCode.VLPaymentCode));

        binding.add(new LabelVLBinder(db, PayGroupIsCNDProrata, Values.VLTrueFalseYesNo));

        //binding.add(new LabelVLBinder(db, PayGroupLeaveAllowFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        //binding.add(new LabelVLBinder(db, PayGroupLeaveDeductFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupStatHolAllowFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupStatHolDeductFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new LabelVLBinder(db, PayGroupStatHolNextMonth, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PayGroupIsStatHolUsePublicHoliday, Values.VLTrueFalseYesNo));

        binding.add(new BlankZeroLabelVLBinder(db, PayGroupNewJoinFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupExistingFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedALCompensationDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedALCompensationDailyFormulaAlternative, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new CheckBoxBinder(db, PayGroupTerminatedALCompensationIsSkipRoundingRule));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedALCompensationPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedALCompensationByEEPaymentCodeID, EPaymentCode.VLPaymentCode));

        binding.add(new LabelVLBinder(db, PayGroupTerminatedPaymentInLieuMonthlyBaseMethod, Values.VLPaymentBaseMethod));
        binding.add(new LabelVLBinder(db, PayGroupTerminatedPaymentInLieuMonthlyBaseMethodAlternative, Values.VLPaymentBaseMethod));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedPaymentInLieuDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedPaymentInLieuDailyFormulaAlternative, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedPaymentInLieuERPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedPaymentInLieuEEPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new LabelVLBinder(db, PayGroupTerminatedLSPSPMonthlyBaseMethod, Values.VLPaymentBaseMethod));
        binding.add(new LabelVLBinder(db, PayGroupTerminatedLSPSPMonthlyBaseMethodAlternative, Values.VLPaymentBaseMethod));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedLSPPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedSPPaymentCodeID, EPaymentCode.VLPaymentCode));

        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedRestDayCompensationDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedRestDayCompensationPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedStatutoryHolidayCompensationDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupTerminatedStatutoryHolidayCompensationPaymentCodeID, EPaymentCode.VLPaymentCode));

        binding.add(PayGroupTerminatedALCompensationProrataEligiblePeriod);
        binding.add(new LabelVLBinder(db, PayGroupTerminatedALCompensationProrataEligibleUnit, Values.VLEmpUnit));
        binding.add(new CheckBoxBinder(db, PayGroupTerminatedALCompensationProrataEligibleCheckEveryLeaveYear));
        binding.add(new CheckBoxBinder(db, PayGroupTerminatedALCompensationEligibleAfterProbation));

        binding.add(new CheckBoxBinder(db, PayGroupPayAdvance));
        binding.add(new CheckBoxBinder(db, PayGroupPayAdvanceCompareTotalPaymentOnly));

        binding.add(new LabelVLBinder(db, PayGroupUseCNDForDailyHourlyPayment, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PayGroupIsSkipStatHol, Values.VLTrueFalseYesNo));
        binding.add(PayGroupStatHolEligiblePeriod);
        binding.add(new LabelVLBinder(db, PayGroupStatHolEligibleUnit, Values.VLEmpUnit));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupStatHolDeductPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new BlankZeroLabelVLBinder(db, PayGroupStatHolAllowPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new CheckBoxBinder(db, PayGroupStatHolEligibleAfterProbation));
        binding.add(new CheckBoxBinder(db, PayGroupStatHolEligibleSkipDeduction));
        binding.add(new LabelVLBinder(db, PayGroupYEBStartPayrollMonth, Values.VLMonth));
        binding.add(new LabelVLBinder(db, PayGroupYEBMonthFrom, Values.VLMonth));
        binding.add(new LabelVLBinder(db, PayGroupYEBMonthTo, Values.VLMonth));

        DBFilter payPeriodFilter = new DBFilter();

        payPeriodFilter.add(new Match("PayPeriodStatus", "<>", "E"));
        payPeriodFilter.add(new Match("PayGroupID", CurID));

        binding.add(new DropDownVLBinder(EPayrollPeriod.db, PayPeriodID, EPayrollPeriod.VLPayrollPeriod, payPeriodFilter));

        binding.init(Request, Session);

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            FinalPaymentHolidayPanel.Visible    = false;
            PayGroupIsCNDProrataRow.Visible     = false;
            PayGroupStatHolNextMonthRow.Visible = false;
            PayGroupPayAdvanceCompareTotalPaymentOnly.Visible  = false;
            PayGroupUseCNDForDailyHourlyPaymentSection.Visible = false;
        }
        else
        {
            FinalPaymentHolidayPanel.Visible    = true;
            PayGroupIsCNDProrataRow.Visible     = true;
            PayGroupStatHolNextMonthRow.Visible = true;
            PayGroupPayAdvanceCompareTotalPaymentOnly.Visible  = true;
            PayGroupUseCNDForDailyHourlyPaymentSection.Visible = true;
        }

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

        PayGroupID.Value = CurID.ToString();
        //if (!string.IsNullOrEmpty(DecryptedRequest["PayPeriodID"]))
        //    CurPayPeriodID = Int32.Parse(DecryptedRequest["PayPeriodID"]);
        //else
        if (!int.TryParse(PayPeriodID.SelectedValue, out CurPayPeriodID))
        {
            EPayrollGroup obj = new EPayrollGroup();
            obj.PayGroupID = CurID;
            if (db.select(dbConn, obj))
            {
                CurPayPeriodID = obj.CurrentPayPeriodID;
            }
        }

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
            LoadLeaveCalculationOverrideList(LeaveCodeOverrideListFooter.ListInfo, LeaveCodeOverrideRepeater);
            // Start 0000069, Ricky So, 2014-08-08
            LoadUserList(SecurityRepeater);
            // End 0000069, Ricky So, 2014-08-08
        }
    }
    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);
    }
Exemple #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;

        DBFilter LeaveTypeFilter = new DBFilter();

        LeaveTypeFilter.add(new Match("LeaveTypeIsDisabled", false));

        binding = new Binding(dbConn, db);
        binding.add(LeaveCodeID);
        binding.add(new DropDownVLBinder(db, LeaveTypeID, ELeaveType.VLLeaveType, LeaveTypeFilter));
        binding.add(LeaveCode);
        binding.add(LeaveCodeDesc);
        binding.add(LeaveCodePayRatio);
        binding.add(new DropDownVLBinder(db, LeaveCodeLeaveAllowPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, LeaveCodeLeaveDeductPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, LeaveCodeLeaveDeductFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, LeaveCodeLeaveAllowFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new CheckBoxBinder(db, LeaveCodeIsSkipPayrollProcess));
        binding.add(new CheckBoxBinder(db, LeaveCodePayAdvance));
        binding.add(new CheckBoxBinder(db, LeaveCodeIsPayrollProcessNextMonth));
        binding.add(new CheckBoxBinder(db, LeaveCodeIsShowMedicalCertOption));
        binding.add(new CheckBoxBinder(db, LeaveCodeHideInESS));
        binding.add(new CheckBoxBinder(db, LeaveCodeUseAllowancePaymentCodeIfSameAmount));
        binding.add(new CheckBoxBinder(db, LeaveCodeIsCNDProrata));
        binding.add(LeaveAppUnit);
        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["LeaveCodeID"], out CurID))
        {
            CurID = -1;
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.IsESS)
        {
            ESSRow.Visible = true;
        }
        else
        {
            ESSRow.Visible = false;
        }
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            LeaveCodeIsCNDProrataRow.Visible = false;
        }
        else
        {
            LeaveCodeIsCNDProrataRow.Visible = true;
        }
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                DBFilter defaultPayrollProrataFormulaFilter = new DBFilter();
                defaultPayrollProrataFormulaFilter.add(new Match("PayFormCode", EPayrollProrataFormula.DEFAULT_FOEMULA_CODE));
                ArrayList defaultPayrollFormulaList = EPayrollProrataFormula.db.select(dbConn, defaultPayrollProrataFormulaFilter);
                if (defaultPayrollFormulaList.Count > 0)
                {
                    int defaultPayrollFormulaID = ((EPayrollProrataFormula)defaultPayrollFormulaList[0]).PayFormID;
                    LeaveCodeLeaveAllowFormula.SelectedValue  = defaultPayrollFormulaID.ToString();
                    LeaveCodeLeaveDeductFormula.SelectedValue = defaultPayrollFormulaID.ToString();
                }
                toolBar.DeleteButton_Visible = false;
            }
        }

        PayrollProcessPanel.Visible = !LeaveCodeIsSkipPayrollProcess.Checked;
    }
Exemple #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;



        binding = new Binding(dbConn, db);
        binding.add(AVCPlanID);
        binding.add(AVCPlanCode);
        binding.add(AVCPlanDesc);

        binding.add(new CheckBoxBinder(db, AVCPlanEmployerResidual));
        binding.add(AVCPlanEmployerResidualCap);
        binding.add(new CheckBoxBinder(db, AVCPlanEmployeeResidual));
        binding.add(AVCPlanEmployeeResidualCap);
        binding.add(new CheckBoxBinder(db, AVCPlanUseMPFExemption));
        binding.add(new CheckBoxBinder(db, AVCPlanJoinDateStart));
        binding.add(new CheckBoxBinder(db, AVCPlanContributeMaxAge));
        binding.add(new CheckBoxBinder(db, AVCPlanContributeMinRI));
        binding.add(AVCPlanMaxEmployerVC);
        binding.add(AVCPlanMaxEmployeeVC);
        binding.add(new DropDownVLBinder(db, AVCPlanEmployerRoundingRule, Values.VLRoundingRule));
        binding.add(new DropDownVLBinder(db, AVCPlanEmployerDecimalPlace, Values.VLDecimalPlace));
        binding.add(new DropDownVLBinder(db, AVCPlanEmployeeRoundingRule, Values.VLRoundingRule));
        binding.add(new DropDownVLBinder(db, AVCPlanEmployeeDecimalPlace, Values.VLDecimalPlace));
        binding.add(new CheckBoxBinder(db, AVCPlanNotRemoveContributionFromTopUp));


        binding.init(Request, Session);

        sbinding = new SearchBinding(dbConn, EPaymentCode.db);

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            NotRemoveContributionFromTopUpRow.Visible = false;
            PaymentCeilingSection.Visible             = false;
        }
        else
        {
            NotRemoveContributionFromTopUpRow.Visible = true;
            PaymentCeilingSection.Visible             = true;
        }
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);

        info = ListFooter.ListInfo;

        if (!int.TryParse(DecryptedRequest["AVCPlanID"], out CurID))
        {
            CurID = -1;
        }

        if (!Page.IsPostBack)
        {
            view = loadData(info, EPaymentCode.db, Repeater);

            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;

        bool isAutoGenerateHKIDCheckDigit = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_HKID_CHECKDIGIT_AUTO_GENERATE).Equals("Y", StringComparison.CurrentCultureIgnoreCase) ? true : false;

        binding = new Binding(dbConn, db);
        binding.add(EmpBeneficiariesID);
        binding.add(EmpID);
        binding.add(EmpBeneficiariesName);
        binding.add(EmpBeneficiariesShare);
        binding.add(new HKIDBinder(db, EmpBeneficiariesHKID, EmpBeneficiariesHKID_Digit, isAutoGenerateHKIDCheckDigit));
        binding.add(EmpBeneficiariesRelation);
        binding.add(EmpBeneficiariesAddress);
        binding.add(EmpBeneficiariesDistrict);
        // Start 0000139, Miranda, 2014-12-20
        binding.add(new DropDownVLBinder(db, EmpBeneficiariesArea, Values.VLArea));
        // End 0000139, Miranda, 2014-12-20
        binding.add(EmpBeneficiariesCountry);

        binding.init(Request, Session);

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            EmpBeneficiariesHKID.MaxLength = 8;
        }

        if (!int.TryParse(DecryptedRequest["EmpBeneficiariesID"], out CurID))
        {
            CurID = -1;
        }

        if (!int.TryParse(DecryptedRequest["EmpID"], out CurEmpID))
        {
            CurEmpID = -1;
        }

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

        EmpID.Value = CurEmpID.ToString();
        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
                // Start 0000139, Miranda, 2014-12-20
                EEmpPersonalInfo empObj = new EEmpPersonalInfo();
                DBFilter         filter = new DBFilter();
                if (CurEmpID > 0)
                {
                    filter.add(new Match("EmpID", CurEmpID));
                    ArrayList empInfoList = empDB.select(dbConn, filter);
                    if (empInfoList.Count > 0)
                    {
                        empObj = (EEmpPersonalInfo)empInfoList[0];
                        EmpBeneficiariesAddress.Text       = empObj.EmpResAddr;
                        EmpBeneficiariesArea.SelectedValue = empObj.EmpResAddrAreaCode;
                    }
                }
                // End 0000139, Miranda, 2014-12-20
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;



        binding = new Binding(dbConn, db);
        binding.add(AVCPlanID);
        binding.add(AVCPlanCode);
        binding.add(AVCPlanDesc);
        binding.add(new LabelVLBinder(db, AVCPlanEmployerResidual, Values.VLTrueFalseYesNo));
        binding.add(AVCPlanEmployerResidualCap);
        binding.add(new LabelVLBinder(db, AVCPlanEmployeeResidual, Values.VLTrueFalseYesNo));
        binding.add(AVCPlanEmployeeResidualCap);
        binding.add(new LabelVLBinder(db, AVCPlanUseMPFExemption, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, AVCPlanJoinDateStart, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, AVCPlanContributeMaxAge, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, AVCPlanContributeMinRI, Values.VLTrueFalseYesNo));
        binding.add(AVCPlanMaxEmployerVC);
        binding.add(AVCPlanMaxEmployeeVC);
        binding.add(new LabelVLBinder(db, AVCPlanNotRemoveContributionFromTopUp, Values.VLTrueFalseYesNo));

        //Add
        AVCPlanDetailbinding = new Binding(dbConn, AVCPlanDetaildb);
        AVCPlanDetailbinding.add(AVCPlanID);
        AVCPlanDetailbinding.add(AVCPlanDetailYearOfService);
        AVCPlanDetailbinding.add(AVCPlanDetailERBelowRI);
        AVCPlanDetailbinding.add(AVCPlanDetailERAboveRI);
        AVCPlanDetailbinding.add(AVCPlanDetailERFix);
        AVCPlanDetailbinding.add(AVCPlanDetailEEBelowRI);
        AVCPlanDetailbinding.add(AVCPlanDetailEEAboveRI);
        AVCPlanDetailbinding.add(AVCPlanDetailEEFix);
        AVCPlanDetailbinding.init(Request, Session);
        binding.add(new LabelVLBinder(db, AVCPlanEmployerRoundingRule, Values.VLRoundingRule));
        binding.add(AVCPlanEmployerDecimalPlace);
        binding.add(new LabelVLBinder(db, AVCPlanEmployeeRoundingRule, Values.VLRoundingRule));
        binding.add(AVCPlanEmployeeDecimalPlace);

        sbinding = new SearchBinding(dbConn, AVCPlanDetaildb);
        sbinding.add(new HiddenMatchBinder(AVCPlanID));
        sbinding.init(DecryptedRequest, null);

        ceilingbinding = new SearchBinding(dbConn, EPaymentCode.db);
        ceilingbinding.add(new HiddenMatchBinder(AVCPlanID, "apc.AVCPlanID"));
        ceilingbinding.add(new HiddenMatchBinder(AVCPlanID, "apcc.AVCPlanID"));
        ceilingbinding.initValues("AVCPlanPaymentConsiderAfterMPF", null, Values.VLYesNo, null);
        ceilingbinding.init(DecryptedRequest, null);

        binding.init(Request, Session);

        avcCeilingInfo = avcCeilingListFooter.ListInfo;
        info           = ListFooter.ListInfo;

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            NotRemoveContributionFromTopUpRow.Visible = false;
            PaymentCeilingSection.Visible             = false;
        }
        else
        {
            NotRemoveContributionFromTopUpRow.Visible = true;
            PaymentCeilingSection.Visible             = true;
        }

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

        if (!int.TryParse(DecryptedRequest["AVCPlanID"], out CurID))
        {
            CurID = -1;
        }

        Delete.OnClientClick = HROne.Translation.PromptMessage.CreateDeleteConfirmDialogJavascript(Delete);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }

        toolBar.FunctionCode = FUNCTION_CODE;

        if (cboReportFilter.SelectedValue.Equals("ALL", StringComparison.CurrentCultureIgnoreCase))
        {
            SystemPanel.Visible           = true;
            SecurityPanel.Visible         = true;
            PersonnelPanel.Visible        = true;
            LeavePanel.Visible            = true;
            PayrollPanel.Visible          = true;
            MPFPanel.Visible              = true;
            CostCenterPanel.Visible       = true;
            AttendancePanel.Visible       = true;
            TaxationPanel.Visible         = true;
            TrainingPanel.Visible         = true;
            PersonnelReportsPanel.Visible = true;
            PayrollReportsPanel.Visible   = true;
            TaxationReportsPanel.Visible  = true;
            eChannelPanel.Visible         = true;
        }
        else
        {
            SystemPanel.Visible           = false;
            SecurityPanel.Visible         = false;
            PersonnelPanel.Visible        = false;
            LeavePanel.Visible            = false;
            PayrollPanel.Visible          = false;
            MPFPanel.Visible              = false;
            CostCenterPanel.Visible       = false;
            AttendancePanel.Visible       = false;
            TaxationPanel.Visible         = false;
            TrainingPanel.Visible         = false;
            PersonnelReportsPanel.Visible = false;
            PayrollReportsPanel.Visible   = false;
            TaxationReportsPanel.Visible  = false;
            eChannelPanel.Visible         = false;

            if (cboReportFilter.SelectedValue.Equals("System", StringComparison.CurrentCultureIgnoreCase))
            {
                SystemPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Security", StringComparison.CurrentCultureIgnoreCase))
            {
                SecurityPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Personnel", StringComparison.CurrentCultureIgnoreCase))
            {
                PersonnelPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Leave", StringComparison.CurrentCultureIgnoreCase))
            {
                LeavePanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Payroll", StringComparison.CurrentCultureIgnoreCase))
            {
                PayrollPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("MPF", StringComparison.CurrentCultureIgnoreCase))
            {
                MPFPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("CostCenter", StringComparison.CurrentCultureIgnoreCase))
            {
                CostCenterPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Attendance", StringComparison.CurrentCultureIgnoreCase))
            {
                AttendancePanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Taxation", StringComparison.CurrentCultureIgnoreCase))
            {
                TaxationPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("Training", StringComparison.CurrentCultureIgnoreCase))
            {
                TrainingPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("PersonnelReports", StringComparison.CurrentCultureIgnoreCase))
            {
                PersonnelReportsPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("PayrollReports", StringComparison.CurrentCultureIgnoreCase))
            {
                PayrollReportsPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("TaxationReports", StringComparison.CurrentCultureIgnoreCase))
            {
                TaxationReportsPanel.Visible = true;
            }
            else if (cboReportFilter.SelectedValue.Equals("eChannel", StringComparison.CurrentCultureIgnoreCase))
            {
                eChannelPanel.Visible = true;
            }
        }

        HROne.ProductLicense license = WebUtils.productLicense(Session);
        if (license != null)
        {
            if (license.IsLeaveManagement || license.IsPayroll || license.IsTaxation)
            {
                cboReportFilter.Items.FindByValue("System").Enabled = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("System").Enabled = false;
                this.SystemPanel.Visible = false;
            }
            if (license.IsLeaveManagement)
            {
                cboReportFilter.Items.FindByValue("Personnel").Enabled        = true;
                cboReportFilter.Items.FindByValue("Leave").Enabled            = true;
                cboReportFilter.Items.FindByValue("PersonnelReports").Enabled = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("Personnel").Enabled        = false;
                cboReportFilter.Items.FindByValue("Leave").Enabled            = false;
                cboReportFilter.Items.FindByValue("PersonnelReports").Enabled = false;
                this.PersonnelPanel.Visible        = false;
                this.LeavePanel.Visible            = false;
                this.PersonnelReportsPanel.Visible = false;
            }
            if (license.IsPayroll)
            {
                cboReportFilter.Items.FindByValue("Payroll").Enabled        = true;
                cboReportFilter.Items.FindByValue("MPF").Enabled            = true;
                cboReportFilter.Items.FindByValue("PayrollReports").Enabled = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("Payroll").Enabled        = false;
                cboReportFilter.Items.FindByValue("MPF").Enabled            = false;
                cboReportFilter.Items.FindByValue("PayrollReports").Enabled = false;
                this.PayrollPanel.Visible        = false;
                this.MPFPanel.Visible            = false;
                this.PayrollReportsPanel.Visible = false;
            }
            if (license.IsTaxation)
            {
                cboReportFilter.Items.FindByValue("Taxation").Enabled        = true;
                cboReportFilter.Items.FindByValue("TaxationReports").Enabled = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("Taxation").Enabled        = false;
                cboReportFilter.Items.FindByValue("TaxationReports").Enabled = false;
                this.TaxationPanel.Visible        = false;
                this.TaxationReportsPanel.Visible = false;
            }
            if (license.IsCostCenter)
            {
                cboReportFilter.Items.FindByValue("CostCenter").Enabled = true;
                //this.CostCenterPanel.Visible = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("CostCenter").Enabled = false;
                this.CostCenterPanel.Visible = false;
            }
            if (license.IsAttendance)
            {
                cboReportFilter.Items.FindByValue("Attendance").Enabled = true;
                //this.AttendancePanel.Visible = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("Attendance").Enabled = false;
                this.AttendancePanel.Visible = false;
            }
            if (license.IsTraining)
            {
                cboReportFilter.Items.FindByValue("Training").Enabled = true;
                //this.TrainingPanel.Visible = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("Training").Enabled = false;
                this.TrainingPanel.Visible = false;
            }
            if (Session["CompanyDBID"] != null)
            {
                cboReportFilter.Items.FindByValue("eChannel").Enabled = true;
                //this.TrainingPanel.Visible = true;
            }
            else
            {
                cboReportFilter.Items.FindByValue("eChannel").Enabled = false;
                this.eChannelPanel.Visible = false;
            }
        }
        else
        {
            this.CostCenterPanel.Visible = false;
            this.AttendancePanel.Visible = false;
            this.TrainingPanel.Visible   = false;
            cboReportFilter.Items.FindByValue("CostCenter").Enabled = false;
            cboReportFilter.Items.FindByValue("Attendance").Enabled = false;
            cboReportFilter.Items.FindByValue("Training").Enabled   = false;
        }

        binding = new Binding(dbConn, db);
        binding.add(UserGroupID);
        binding.add(UserGroupName);
        binding.add(UserGroupDesc);
        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["UserGroupID"], out CurID))
        {
            CurID = -1;
        }

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

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }

            loadPermissions(SystemPermissions, "System");
            loadPermissions(SecurityPermissions, "Security");
            loadPermissions(PersonnelPermissions, "Personnel");
            loadPermissions(LeavePermissions, "Leave");
            loadPermissions(PayrollPermissions, "Payroll");
            loadPermissions(MPFPermissions, "MPF");
            loadPermissions(CostCenterPermissions, "Cost Center");
            loadPermissions(AttendancePermissions, "Attendance");
            loadPermissions(TaxationPermissions, "Taxation");
            loadPermissions(TrainingPermissions, "Training");
            loadPermissions(PersonnelReportsPermissions, "Personnel Reports");
            loadPermissions(PayrollReportsPermissions, "Payroll & MPF Reports");
            loadPermissions(TaxationReportsPermissions, "Taxation Reports");
            loadPermissions(eChannelPermissions, "e-channel");
        }
    }
Exemple #20
0
    private ArrayList GetRemoveMenuItemList(MenuItemCollection menuItemCollection)
    {
        HROne.ProductLicense productLicense         = WebUtils.productLicense(Session);
        ArrayList            removeSubMenuItemArray = new ArrayList();

        foreach (MenuItem subMenuItem in menuItemCollection)
        {
            if (WebUtils.IsEMUser(user))
            {
                if (!subMenuItem.Text.Equals("Security", StringComparison.CurrentCultureIgnoreCase))
                {
                    removeSubMenuItemArray.Add(subMenuItem);
                }
                continue;
            }
            if (productLicense != null)
            {
                if (subMenuItem.Text.Equals("Code Setup", StringComparison.CurrentCultureIgnoreCase) ||
                    subMenuItem.Text.Equals("Report", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    if (!productLicense.IsLeaveManagement && !productLicense.IsPayroll && !productLicense.IsTaxation)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Employee", StringComparison.CurrentCultureIgnoreCase) ||
                    subMenuItem.Text.Equals("Leave", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    if (!productLicense.IsLeaveManagement)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Payroll", StringComparison.CurrentCultureIgnoreCase) ||
                    subMenuItem.Text.Equals("MPF Setup", StringComparison.CurrentCultureIgnoreCase)
                    )
                {
                    if (!productLicense.IsPayroll)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Taxation", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsTaxation)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("P-Fund ", StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                    subMenuItem.Text.IndexOf("ORSO ", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_USE_ORSO).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }

                if (subMenuItem.Text.IndexOf("Commission Achievement Process", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_MONTHLY_ACHIEVEMENT_COMMISSION).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("Incentive Payment Process", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_INCENTIVE_PAYMENT).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("Double Pay Adjustment", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_ENABLE_DOUBLE_PAY_ADJUSTMENT).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("Bonus Process", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (!HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_ENABLE_BONUS_PROCESS).Equals("Y", StringComparison.CurrentCultureIgnoreCase))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.IndexOf("E-mail ", StringComparison.CurrentCultureIgnoreCase) >= 0 ||
                    subMenuItem.Text.IndexOf("Email ", StringComparison.CurrentCultureIgnoreCase) >= 0)
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Cost Allocation", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsCostCenter)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Attendance", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsAttendance)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("ESS Authorization Group Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("ESS Authorization Workflow Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Release Pay Slip to ESS", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Release Tax Report to ESS", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsESS)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Training", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!productLicense.IsTraining)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("e-channel", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROneSaaS || Session["CompanyDBID"] == null)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                //if (subMenuItem.Text.Equals("Work Hour Pattern Setup", StringComparison.CurrentCultureIgnoreCase))
                //    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                //    {
                //        removeSubMenuItemArray.Add(subMenuItem);
                //        continue;
                //    }
                if (subMenuItem.Text.Equals("Annual Leave Prorata Rounding Rule Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Import Leave Balance Adjustment", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("MPF Termination Code Mapping", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                if (subMenuItem.Text.Equals("Statutory Minimum Wage Setup", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }
                //if (subMenuItem.Text.Equals("User Guide", StringComparison.CurrentCultureIgnoreCase))
                //{
                //    if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.iMGR)
                //    {
                //        removeSubMenuItemArray.Add(subMenuItem);
                //        continue;
                //    }
                //}
                if (subMenuItem.Text.Equals("Import Employee Information", StringComparison.CurrentCultureIgnoreCase))
                {
                    HROne.Lib.Entities.ESystemFunction function = HROne.Lib.Entities.ESystemFunction.GetObjectByCode(dbConn, "PER999");
                    if (function != null)
                    {
                        if (function.FunctionIsHidden)
                        {
                            removeSubMenuItemArray.Add(subMenuItem);
                            continue;
                        }
                    }
                    else
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                        continue;
                    }
                }

                if (subMenuItem.Text.Equals("Shift Duty Code", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "SYS025");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.Text.Equals("Payment Calculation Formula", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "SYS026");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.Text.Equals("Report Builder", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "RPT004");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.Text.Equals("Customized Attendance Preparation Process", StringComparison.CurrentCultureIgnoreCase))
                {
                    ESystemFunction m_function = ESystemFunction.GetObjectByCode(dbConn, "CUSTOM003");
                    if (m_function == null || m_function.FunctionIsHidden)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                //{
                //    HROne.Lib.Entities.ESystemFunction function = HROne.Lib.Entities.ESystemFunction.GetObjectByCode(dbConn, "CUSTOM003");
                //    if (function != null)
                //    {
                //        if (function.FunctionIsHidden)
                //        {
                //            removeSubMenuItemArray.Add(subMenuItem);
                //            continue;
                //        }
                //    }
                //    else
                //    {
                //        removeSubMenuItemArray.Add(subMenuItem);
                //        continue;
                //    }
                //}
                removeSubMenuItemArray.AddRange(GetRemoveMenuItemList(subMenuItem.ChildItems));
            }
            else
            if (!subMenuItem.Text.Equals("Security", StringComparison.CurrentCultureIgnoreCase))
            {
                removeSubMenuItemArray.Add(subMenuItem);
            }
        }
        return(removeSubMenuItemArray);
    }
Exemple #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;

        binding = new Binding(dbConn, db);
        binding.add(PaymentCodeID);
        binding.add(PaymentCode);
        binding.add(PaymentCodeDesc);
        binding.add(new CheckBoxBinder(db, PaymentCodeIsProrata));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsProrataLeave));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsProrataStatutoryHoliday));
        binding.add(new LabelVLBinder(db, PaymentCodeIsMPF, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PaymentCodeIsWages, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PaymentCodeIsTopUp, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PaymentCodeIsORSO, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, PaymentTypeID, EPaymentType.VLPaymentType));
        binding.add(new LabelVLBinder(db, PaymentCodeRoundingRule, Values.VLRoundingRule));
        binding.add(PaymentCodeDecimalPlace);
        binding.add(new LabelVLBinder(db, PaymentCodeHideInPaySlip, Values.VLTrueFalseYesNo));
        binding.add(PaymentCodeDisplaySeqNo);
        binding.add(new LabelVLBinder(db, PaymentCodeNotRemoveContributionFromTopUp, Values.VLTrueFalseYesNo));
        // Start 000159, Ricky So, 2015-01-23
        binding.add(new LabelVLBinder(db, PaymentCodeIsHitRateBased, Values.VLTrueFalseYesNo));
        binding.add(PaymentCodeDefaultRateAtMonth1);
        binding.add(PaymentCodeDefaultRateAtMonth2);
        binding.add(PaymentCodeDefaultRateAtMonth3);
        // End 000159, Ricky So, 2015-01-23
        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["PaymentCodeID"], out CurID))
        {
            CurID = -1;
        }

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

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            PaymentCodeNotRemoveContributionFromTopUpRow.Visible = false;
        }
        else
        {
            PaymentCodeNotRemoveContributionFromTopUpRow.Visible = true;
        }

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
        }
    }
Exemple #22
0
    //public bool ValidateUser(string username, string encryptedPassword)
    //{
    //    string message = string.Empty;
    //    DBFilter filter = new DBFilter();
    //    filter.add(new Match("LoginID", username));
    //    filter.add(new Match("UserAccountStatus", "<>", "D"));
    //    ArrayList list = EUser.db.select(dbConn, filter);
    //    if (list.Count == 0)
    //    {
    //        message = "Invalid User Name or Password";
    //        throw new Exception(message);
    //        return;
    //    }
    //    EUser user = (EUser)list[0];
    //    if (user.UserPassword == null)
    //        user.UserPassword = "";
    //    if (!(user.UserAccountStatus == "A"))
    //    {
    //        message = "Account is Inactive/Locked";
    //        throw new Exception(message);
    //        return;
    //    }

    //    if (!user.UserPassword.Equals(encryptedPassword))
    //    {
    //        message = "Invalid User Name or Password";
    //        user.FailCount++;
    //        string maxFailCountParameterString = ESystemParameter.getParameter(ESystemParameter.PARAM_CODE_LOGIN_MAX_FAIL_COUNT);
    //        if (!maxFailCountParameterString.Equals(string.Empty))
    //        {
    //            int MaxFailCount = 0;
    //            if (int.TryParse(maxFailCountParameterString, out MaxFailCount))
    //                if (MaxFailCount > 0)
    //                    if (user.FailCount >= MaxFailCount)
    //                    {
    //                        user.UserAccountStatus = "I";
    //                        user.FailCount = 0;
    //                    }
    //                    else if (user.FailCount - MaxFailCount == 1)
    //                    {
    //                        message += "\r\n" + "The account will be locked if you fail to login 1 more time";
    //                    }

    //        }
    //        EUser.db.update(dbConn, user);
    //        throw new Exception(message);
    //        return;
    //    }

    //    Session["User"] = user;

    //    WebUtils.SetSessionLanguage(Session, user);

    //    user.FailCount = 0;
    //    EUser.db.update(dbConn, user);
    //    //WebUtils.RefreshPermission(Session);
    //    bool isForceChangePassword = false;

    //    if (user.UserChangePasswordUnit == "D")
    //    {
    //        if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddDays(user.UserChangePasswordPeriod))
    //            isForceChangePassword = false;
    //        else
    //            isForceChangePassword = true;
    //    }
    //    else if (user.UserChangePasswordUnit == "M")
    //    {
    //        if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddMonths(user.UserChangePasswordPeriod))
    //            isForceChangePassword = false;
    //        else
    //            isForceChangePassword = true;
    //    }
    //    else if (user.UserChangePasswordUnit == "Y")
    //    {
    //        if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddYears(user.UserChangePasswordPeriod))
    //            isForceChangePassword = false;
    //        else
    //            isForceChangePassword = true;
    //    }
    //    else
    //        isForceChangePassword = false;
    //    if (user.UserChangePassword)
    //        isForceChangePassword = true;

    //    //EInbox.GenerateInboxMessage(user.UserID);
    //    if (isForceChangePassword)
    //        Session["ForceChangePassword"] = true;
    //    if (Session["LastURL"] != null)
    //        Response.Redirect(Session["LastURL"].ToString());
    //    else
    //        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Emp_List.aspx");

    //}

    protected void Login_Click(object sender, EventArgs e)
    {
        HROne.Lib.Entities.EUser user = null;

        Session.Clear();

        HROne.DataAccess.DatabaseConnection  mainDBConn = null;
        HROne.SaaS.Entities.ECompanyDatabase companyDB  = null;
        bool   hasError = false;
        string message  = string.Empty;

        // always check whether companyDB exists after click
        if (Application["MasterDBConfig"] != null)
        {
            DatabaseConfig masterDBConfig = (DatabaseConfig)Application["MasterDBConfig"];
            HROne.DataAccess.DatabaseConnection masterDBConn = masterDBConfig.CreateDatabaseConnectionObject();
            DBFilter companyDatabaseFilter = new DBFilter();
            companyDatabaseFilter.add(new Match("CompanyDBClientCode", txtCustomerID.Text));
            ArrayList companyDatabaseList = HROne.SaaS.Entities.ECompanyDatabase.db.select(masterDBConn, companyDatabaseFilter);
            if (companyDatabaseList.Count > 0)
            {
                companyDB = (HROne.SaaS.Entities.ECompanyDatabase)companyDatabaseList[0];

                DatabaseConfig tempDBConfig = new DatabaseConfig();
                tempDBConfig.ConnectionString = companyDB.getConnectionString(masterDBConn);
                tempDBConfig.DBType           = WebUtils.DBTypeEmun.MSSQL;

                if (tempDBConfig.TestConnection())
                {
                    mainDBConn = tempDBConfig.CreateDatabaseConnectionObject();

                    HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTKEY, companyDB.CompanyDBProductKey);
                    HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTFEATURECODE, companyDB.getProductFeatureCode(masterDBConn));

                    string[] smtpParameterList = new string[]
                    {
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PORT,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_USERNAME,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS
                    };
                    foreach (string smptParameter in smtpParameterList)
                    {
                        HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, smptParameter, HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, smptParameter));
                    }
                    HROne.Lib.Entities.ESystemParameter.setParameterWithEncryption(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD
                                                                                   , HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD));
                }
                else
                {
                    if (HROne.DataAccess.DBAESEncryptStringFieldAttribute.InvalidRSAKey)
                    {
                        HttpRuntime.UnloadAppDomain();
                    }
                }
            }
        }
        else
        {
            mainDBConn = WebUtils.GetDatabaseConnection();
            if (mainDBConn == null)
            {
                if (multiDBRow.Visible)
                {
                    int idx;
                    if (int.TryParse(cboDatabase.SelectedValue, out idx))
                    {
                        HROneConfig    config   = HROneConfig.GetCurrentHROneConfig();
                        DatabaseConfig dbconfig = config.DatabaseConfigList[idx];
                        if (dbconfig.TestConnection())
                        {
                            mainDBConn = dbconfig.CreateDatabaseConnectionObject();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"Fail to connect database\");", true);
                            return;
                        }
                    }
                }
            }
        }
        if (mainDBConn != null)
        {
            WebUtils.SetSessionDatabaseConnection(Session, mainDBConn);
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense != null)
        {
            if (companyDB == null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROneSaaS)
            {
                productLicense.LoadProductKey(string.Empty);
            }
        }

        if (mainDBConn == null && companyDB != null)
        {
            hasError = true;
            message  = "Fail to connect to database. Please contact to customer service.";
        }
        if (!hasError)
        {
            try
            {
                WebUtils.ValidateUser(mainDBConn, Username.Text, HROne.CommonLib.Hash.PasswordHash(Password.Text), true, true, out user);
            }
            catch (Exception ex)
            {
                hasError = true;
                message  = ex.Message;
            }
            // Check the database status after login is verified
            if (companyDB != null && !hasError)
            {
                if (!companyDB.CompanyDBIsActive)
                {
                    hasError = true;
                    message  = "Subscribed service has been expired; please contact customer service hotline for assistant.";
                }
            }

            if (!hasError)
            {
                //  Create Login Audit for successfully login
                HROne.Lib.Entities.ELoginAudit.CreateLoginAudit(mainDBConn, user.UserID, Username.Text, Request, AppUtils.ServerDateTime(), false, string.Empty);
                Session["LoginID"]           = user.LoginID;
                Session["PasswordEncrypted"] = user.UserPassword;
                if (companyDB != null)
                {
                    Session["CompanyDBID"] = companyDB.CompanyDBID;
                }

                if (mainDBConn is HROne.DataAccess.DatabaseConnectionWithAudit)
                {
                    ((HROne.DataAccess.DatabaseConnectionWithAudit)mainDBConn).UserID = user.UserID;
                }
                WebUtils.SetSessionLanguage(Session, user);

                //WebUtils.RefreshPermission(Session);
                bool isForceChangePassword = false;

                if (user.UserChangePasswordUnit == "D")
                {
                    if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddDays(user.UserChangePasswordPeriod))
                    {
                        isForceChangePassword = false;
                    }
                    else
                    {
                        isForceChangePassword = true;
                    }
                }
                else if (user.UserChangePasswordUnit == "M")
                {
                    if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddMonths(user.UserChangePasswordPeriod))
                    {
                        isForceChangePassword = false;
                    }
                    else
                    {
                        isForceChangePassword = true;
                    }
                }
                else if (user.UserChangePasswordUnit == "Y")
                {
                    if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddYears(user.UserChangePasswordPeriod))
                    {
                        isForceChangePassword = false;
                    }
                    else
                    {
                        isForceChangePassword = true;
                    }
                }
                else
                {
                    isForceChangePassword = false;
                }
                if (user.UserChangePassword)
                {
                    isForceChangePassword = true;
                }

                //EInbox.GenerateInboxMessage(user.UserID);
                if (isForceChangePassword)
                {
                    Session["ForceChangePassword"] = true;
                }

                WebUtils.SetSessionLanguage(Session, WebUtils.GetCurUser(Session));
                //RegenerateSessionId();
                HROne.Lib.Entities.EInbox.DeleteAllDeletedUserID(mainDBConn);
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx?LastURL=" + DecryptedRequest["LastURL"]);
            }
        }
        //  Remove all item for release session
        Session.Clear();
        Request.Cookies.Remove(HROne.Common.WebUtility.getDefaultSessionCookieName());
        //if (companyDB != null)
        //{
        //    Session.Remove("DatabaseConnection");
        //}
        {
            //  Create Login Audit for fail login
            if (user != null)
            {
                HROne.Lib.Entities.ELoginAudit.CreateLoginAudit(mainDBConn, user.UserID, Username.Text, Request, AppUtils.ServerDateTime(), true, message);
            }
            else
            {
                HROne.Lib.Entities.ELoginAudit.CreateLoginAudit(mainDBConn, 0, Username.Text, Request, AppUtils.ServerDateTime(), true, message);
            }

            message = message.Replace("\\", "\\\\").Replace("\r", "\\r").Replace("\n", "\\n").Replace("\"", "\\\"");
            message = message.Replace(HROne.Common.WebUtility.GetLocalizedString("validate.prompt"), "");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"" + message + "\");", true);
            System.Threading.Thread.Sleep(1000);
        }
    }
Exemple #23
0
    protected void OK_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtProductKey.Text) && string.IsNullOrEmpty(txtTrialKey.Text))
        {
            return;
        }
        HROne.ProductLicense productKey = new HROne.ProductLicense();
        productKey.LoadProductLicense(dbConn);
        bool IsRedirect = true;

        if (!string.IsNullOrEmpty(txtProductKey.Text))
        {
            productKey.LoadProductKey(txtProductKey.Text);
            if (productKey.IsValidProductKey)
            {
                //if (!txtProductKey.Text.Equals(ESystemParameter.getParameter(ESystemParameter.PARAM_CODE_PRODUCTKEY), StringComparison.CurrentCultureIgnoreCase))
                //{
                //}
                //else
                //{
                //    if (AppUtils.ServerDateTime().Date > WebUtils.getLastTrialDate())
                //    {
                //        Prompt.Text = "Trial Period Expiry";
                //        return;
                //    }

                //}
                Session["TrialVersion"] = false;
            }
            else
            {
                Prompt.Text += "Invalid Product Key.<br/>";
                IsRedirect   = false;
            }
        }
        if (!string.IsNullOrEmpty(txtTrialKey.Text))
        {
            string trialKey = txtTrialKey.Text;
            productKey.LoadTrialKey(trialKey, dbConn);
            if (productKey.TrialKey == string.Empty)
            {
                Prompt.Text += "Invalid Trial Key.<br/>";
                IsRedirect   = false;
            }
            else
            {
                if (Session["TrialVersion"] == null)
                {
                    Session["TrialVersion"] = true;
                }
            }
        }
        if (!string.IsNullOrEmpty(txtAuthorizationCode.Text))
        {
            if (!productKey.IsValidAuthorizationCode(txtAuthorizationCode.Text))
            {
                Prompt.Text += "Invalid Authorization Code.<br/>";
                IsRedirect   = false;
            }
        }
        if (IsRedirect)
        {
            productKey.SaveProductLicense(dbConn);

            //  reset the connection for new key
            WebUtils.SetSessionDatabaseConnection(Session, dbConn);
            Response.Redirect(PreviousURL.Value);
        }
    }
Exemple #24
0
    private ArrayList GetRemoveMenuItemList(MenuItemCollection menuItemCollection)
    {
        HROne.ProductLicense productLicense         = WebUtils.productLicense(Session);
        EESSUser             essUser                = WebUtils.GetCurUser(Session);
        ArrayList            removeSubMenuItemArray = new ArrayList();

        foreach (MenuItem subMenuItem in menuItemCollection)
        {
            if (productLicense != null)
            {
                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Leave Application", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLeaveApplication.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Request Status", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpRequestStatus.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)
                        //Start 0000060, Miranda, 2014-07-22
                        && !(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)
                        //End 0000060, Miranda, 2014-07-22
                        && !(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)
                        )
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }


                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Application Approval", StringComparison.CurrentCultureIgnoreCase)
                //    || subMenuItem.NavigateUrl.EndsWith("/ESS_EmpSupervisorApproval.aspx", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpSupervisorApproval.aspx", StringComparison.CurrentCultureIgnoreCase))
                // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                {
                    ESSAuthorizationProcess authorizationProcess = new ESSAuthorizationProcess(dbConn);
                    int groupCount = authorizationProcess.GetAuthorizerAuthorizationGroupList(user.EmpID).Count;
                    if (groupCount <= 0)
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                    else if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)
                             //Start 0000060, Miranda, 2014-07-22
                             && !(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)
                             //End 0000060, Miranda, 2014-07-22
                             && !(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)
                             )
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Leave Balance Enquiry", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLeaveBalanceEnquiry.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_ENQUIRY).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }



                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Leave History Enquiry", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLeaveHistoryEnquiry.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_HISTORY).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }


                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Leave Balance Report", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLeaveBalanceReport.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_BALANCE_REPORT).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                    else
                    {
                        if (essUser != null)
                        {
                            ESSAuthorizationProcess authorization = new ESSAuthorizationProcess(dbConn);
                            int groupCount = authorization.GetAuthorizerAuthorizationGroupList(essUser.EmpID).Count;
                            if (groupCount <= 0)
                            {
                                removeSubMenuItemArray.Add(subMenuItem);
                            }
                        }
                    }
                }

                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLeaveApplicationList.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LEAVE_APPLICATION_LIST).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Payslip Printing", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpPayslipPrint.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_PRINT_PAYSLIP).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }


                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Tax Report Printing", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpTaxReport.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_PRINT_TAXREPORT).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Roster Table", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_RosterTable_View.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    if (!productLicense.IsAttendance || !(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ROSTER_TABLE).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpOverallPaymentSummary.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OVERALL_PAYMENT_SUMMARY).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                // Start 0000057, KuangWei, 2014-07-09
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_MonthlyAttendanceReport.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // Start 000118, Ricky So, 2014/12/24
                    //ESSAuthorizationProcess authorizationProcess = new ESSAuthorizationProcess(dbConn);
                    //int groupCount = authorizationProcess.GetAuthorizerAuthorizationGroupList(user.EmpID).Count;
                    //if (groupCount <= 0)
                    //    removeSubMenuItemArray.Add(subMenuItem);
                    //else
                    // End 000118, Ricky So, 2014/12/24
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_MONTHLY_ATTENDANCE_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                        (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_MONTHLY_ATTENDANCE_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                // End 0000057, KuangWei, 2014-07-09


                if (subMenuItem.NavigateUrl.EndsWith("/ESS_TimeCardRecord.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_TIMECARD_RECORD).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                        (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_TIMECARD_RECORD).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                if (subMenuItem.NavigateUrl.EndsWith("/ESS_Attendance_TimeEntry_List.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_ATTENDANCE_TIMEENTRY_LIST).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                        (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_LIST).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }

                // Start 0000076, Miranda, 2014-08-21
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_AttendanceTimeEntryReport.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_ATTENDANCE_TIMEENTRY_REPORT).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                // End 0000076, Miranda, 2014-08-21

                removeSubMenuItemArray.AddRange(GetRemoveMenuItemList(subMenuItem.ChildItems));

                // ***** Start 2013/11/15, Ricky So, revise the show/hide menu routine
                // if (subMenuItem.Text.Equals("Approval History", StringComparison.CurrentCultureIgnoreCase))
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpSupervisorApprovalHistory.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    // ***** End 2013/11/15, Ricky So, revise the show/hide menu routine
                    // ***** Start 0000208, Miranda, 2015-06-12
                    //{
                    //    DBFilter approvalHistoryFilter = new DBFilter();
                    //    approvalHistoryFilter.add(new Match("EmpRequestApprovalHistoryActionByEmpID", user.EmpID));
                    //    if (EEmpRequestApprovalHistory.db.count(dbConn,approvalHistoryFilter)<=0)
                    //        removeSubMenuItemArray.Add(subMenuItem);
                    //}
                    // ***** End 0000208, Miranda, 2015-06-12
                    // Start 0000060, Miranda, 2014-07-15
                    //if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpOTClaims.aspx", StringComparison.CurrentCultureIgnoreCase))
                    //    if (!(ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_ENABLE_OTCLAIM).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true))
                    //        removeSubMenuItemArray.Add(subMenuItem);
                    // End 0000060, Miranda, 2014-07-15
                    // Start 0000060, Miranda, 2014-07-22
                    if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpOTClaims.aspx", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                            (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                        {
                            removeSubMenuItemArray.Add(subMenuItem);
                        }
                    }
                }
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpOTClaimsHistory.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_OTCLAIM).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                        (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_OT_CLAIMS_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                // End 0000060, Miranda, 2014-07-22
                // Start 0000112, Miranda, 2014-12-10
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLateWaive.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                        (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LATE_WAIVE).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                if (subMenuItem.NavigateUrl.EndsWith("/ESS_EmpLateWaiveHistory.aspx", StringComparison.CurrentCultureIgnoreCase))
                {
                    if ((!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ENABLE_LATE_WAIVE).Equals("Y", StringComparison.CurrentCultureIgnoreCase)) ||
                        (!ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_LATE_WAIVE_HISTORY).Equals("Y", StringComparison.CurrentCultureIgnoreCase)))
                    {
                        removeSubMenuItemArray.Add(subMenuItem);
                    }
                }
                // End 0000112, Miranda, 2014-12-10
            }
            else
            {
                removeSubMenuItemArray.Add(subMenuItem);
            }
        }
        return(removeSubMenuItemArray);
    }
Exemple #25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;

        DBFilter LSPSPPaymentCodeFilter = new DBFilter();

        LSPSPPaymentCodeFilter.add(new Match("PaymentTypeID", EPaymentType.SystemPaymentType.LongServicePaymentSeverancePaymentType(dbConn).PaymentTypeID));

        binding = new Binding(dbConn, db);
        binding.add(PayGroupID);
        binding.add(PayGroupCode);
        binding.add(PayGroupDesc);
        //binding.add(new DropDownVLBinder(db, PayGroupFreq, Values.VLGender).setNotSelected(null));
        binding.add(new DropDownVLBinder(db, PayGroupFreq, EPayrollGroup.VLPayGroupFreq));

        binding.add(PayGroupDefaultStartDay);
        //binding.add(PayGroupDefaultEndDay);
        binding.add(PayGroupDefaultNextStartDay);
        binding.add(PayGroupLeaveDefaultCutOffDay);
        binding.add(PayGroupLeaveDefaultNextCutOffDay);

        binding.add(new TextBoxBinder(db, PayGroupNextStartDate.TextBox, PayGroupNextStartDate.ID));
        binding.add(new TextBoxBinder(db, PayGroupNextEndDate.TextBox, PayGroupNextEndDate.ID));

        DBFilter excludeDefaultPayrollProrataFormulaFilter = new DBFilter();

        excludeDefaultPayrollProrataFormulaFilter.add(new Match("PayFormCode", "<>", EPayrollProrataFormula.DEFAULT_FOEMULA_CODE));
        binding.add(new DropDownVLBinder(db, PayGroupDefaultProrataFormula, EPayrollProrataFormula.VLPayrollProrataFormula, excludeDefaultPayrollProrataFormulaFilter));
        binding.add(new CheckBoxBinder(db, PayGroupRestDayHasWage));
        binding.add(new CheckBoxBinder(db, PayGroupLunchTimeHasWage));
        binding.add(new DropDownVLBinder(db, PayGroupRestDayProrataFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new CheckBoxBinder(db, PayGroupIsCNDProrata));

        DBFilter paymentCodeIsWageFilter = new DBFilter();

        paymentCodeIsWageFilter.add(new Match("PaymentCodeIsWages", true));
        binding.add(new DropDownVLBinder(db, PayGroupAdditionalRemunerationPayCodeID, EPaymentCode.VLPaymentCode, paymentCodeIsWageFilter));
        //binding.add(new DropDownVLBinder(db, PayGroupLeaveAllowFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        //binding.add(new DropDownVLBinder(db, PayGroupLeaveDeductFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new CheckBoxBinder(db, PayGroupIsSkipStatHol));
        binding.add(new DropDownVLBinder(db, PayGroupStatHolAllowFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupStatHolDeductFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new CheckBoxBinder(db, PayGroupStatHolNextMonth));
        binding.add(new CheckBoxBinder(db, PayGroupIsStatHolUsePublicHoliday));

        binding.add(new DropDownVLBinder(db, PayGroupNewJoinFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupExistingFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedFormula, EPayrollProrataFormula.VLPayrollProrataFormula));

        binding.add(PayGroupTerminatedALCompensationProrataEligiblePeriod);
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedALCompensationProrataEligibleUnit, Values.VLEmpUnit));
        binding.add(new CheckBoxBinder(db, PayGroupTerminatedALCompensationProrataEligibleCheckEveryLeaveYear));
        binding.add(new CheckBoxBinder(db, PayGroupTerminatedALCompensationEligibleAfterProbation));

        binding.add(new DropDownVLBinder(db, PayGroupTerminatedALCompensationDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedALCompensationDailyFormulaAlternative, EPayrollProrataFormula.VLPayrollProrataFormula));

        binding.add(new CheckBoxBinder(db, PayGroupTerminatedALCompensationIsSkipRoundingRule));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedALCompensationPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedALCompensationByEEPaymentCodeID, EPaymentCode.VLPaymentCode));

        binding.add(new DropDownVLBinder(db, PayGroupTerminatedPaymentInLieuMonthlyBaseMethod, Values.VLPaymentBaseMethod));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedPaymentInLieuMonthlyBaseMethodAlternative, Values.VLPaymentBaseMethod));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedPaymentInLieuDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedPaymentInLieuDailyFormulaAlternative, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedPaymentInLieuERPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedPaymentInLieuEEPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedLSPSPMonthlyBaseMethod, Values.VLPaymentBaseMethod));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedLSPSPMonthlyBaseMethodAlternative, Values.VLPaymentBaseMethod));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedLSPPaymentCodeID, EPaymentCode.VLPaymentCode, LSPSPPaymentCodeFilter));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedSPPaymentCodeID, EPaymentCode.VLPaymentCode, LSPSPPaymentCodeFilter));

        binding.add(new DropDownVLBinder(db, PayGroupTerminatedRestDayCompensationDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedRestDayCompensationPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedStatutoryHolidayCompensationDailyFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new DropDownVLBinder(db, PayGroupTerminatedStatutoryHolidayCompensationPaymentCodeID, EPaymentCode.VLPaymentCode));

        binding.add(new CheckBoxBinder(db, PayGroupPayAdvance));
        binding.add(new CheckBoxBinder(db, PayGroupPayAdvanceCompareTotalPaymentOnly));
        binding.add(new CheckBoxBinder(db, PayGroupUseCNDForDailyHourlyPayment));
        binding.add(PayGroupStatHolEligiblePeriod);
        binding.add(new DropDownVLBinder(db, PayGroupStatHolEligibleUnit, Values.VLEmpUnit));
        binding.add(new DropDownVLBinder(db, PayGroupStatHolAllowPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new DropDownVLBinder(db, PayGroupStatHolDeductPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new CheckBoxBinder(db, PayGroupStatHolEligibleAfterProbation));
        binding.add(new CheckBoxBinder(db, PayGroupStatHolEligibleSkipDeduction));
        binding.add(new DropDownVLBinder(db, PayGroupYEBStartPayrollMonth, Values.VLMonth));
        binding.add(new DropDownVLBinder(db, PayGroupYEBMonthFrom, Values.VLMonth));
        binding.add(new DropDownVLBinder(db, PayGroupYEBMonthTo, Values.VLMonth));
        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["PayGroupID"], out CurID))
        {
            CurID = -1;
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            FinalPaymentHolidayPanel.Visible    = false;
            PayGroupIsCNDProrataRow.Visible     = false;
            PayGroupStatHolNextMonthRow.Visible = false;
            PayGroupPayAdvanceCompareTotalPaymentOnly.Visible  = false;
            PayGroupUseCNDForDailyHourlyPaymentSection.Visible = false;
        }
        else
        {
            FinalPaymentHolidayPanel.Visible    = true;
            PayGroupIsCNDProrataRow.Visible     = true;
            PayGroupStatHolNextMonthRow.Visible = true;
            PayGroupPayAdvanceCompareTotalPaymentOnly.Visible  = true;
            PayGroupUseCNDForDailyHourlyPaymentSection.Visible = true;
        }

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

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                DBFilter defaultPayrollProrataFormulaFilter = new DBFilter();
                defaultPayrollProrataFormulaFilter.add(new Match("PayFormCode", EPayrollProrataFormula.DEFAULT_FOEMULA_CODE));
                ArrayList defaultPayrollFormulaList = EPayrollProrataFormula.db.select(dbConn, defaultPayrollProrataFormulaFilter);
                if (defaultPayrollFormulaList.Count > 0)
                {
                    int defaultPayrollFormulaID = ((EPayrollProrataFormula)defaultPayrollFormulaList[0]).PayFormID;
                    PayGroupNewJoinFormula.SelectedValue       = defaultPayrollFormulaID.ToString();
                    PayGroupStatHolAllowFormula.SelectedValue  = defaultPayrollFormulaID.ToString();
                    PayGroupStatHolDeductFormula.SelectedValue = defaultPayrollFormulaID.ToString();
                    PayGroupTerminatedALCompensationDailyFormula.SelectedValue = defaultPayrollFormulaID.ToString();
                    PayGroupTerminatedFormula.SelectedValue = defaultPayrollFormulaID.ToString();
                    PayGroupTerminatedPaymentInLieuDailyFormula.SelectedValue                = defaultPayrollFormulaID.ToString();
                    PayGroupTerminatedRestDayCompensationDailyFormula.SelectedValue          = defaultPayrollFormulaID.ToString();
                    PayGroupTerminatedStatutoryHolidayCompensationDailyFormula.SelectedValue = defaultPayrollFormulaID.ToString();
                }
                toolBar.DeleteButton_Visible = false;
            }
            LoadLeaveCalculationOverrideList(LeaveCodeOverrideListFooter.ListInfo, LeaveCodeOverrideRepeater);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;



        binding = new Binding(dbConn, db);
        binding.add(MPFPlanID);
        binding.add(MPFPlanCode);
        binding.add(MPFPlanDesc);

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        DBFilter SchemeFilter = new DBFilter();

        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            HROne.ProductLicense license = WebUtils.productLicense(Session);
            if (!license.HasAutopayMPFFileOthers)
            {
                OR orTrusteeCodeTerms = new OR();
                orTrusteeCodeTerms.add(new Match("MPFSchemeTrusteeCode", "HSBC"));
                orTrusteeCodeTerms.add(new Match("MPFSchemeTrusteeCode", "HangSeng"));
                SchemeFilter.add(orTrusteeCodeTerms);
            }
        }

        {
            string selectedValue = MPFSchemeTrusteeCode.SelectedValue;
            if (selectedValue != null)
            {
                selectedValue = selectedValue.Trim();
            }
            System.Globalization.CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentUICulture;
            WebFormUtils.loadValues(dbConn, MPFSchemeTrusteeCode, EMPFScheme.VLMPFSchemeTrusteeCode, new DBFilter(SchemeFilter), ci, selectedValue, "All");
        }
        if (MPFSchemeTrusteeCode.SelectedIndex != 0)
        {
            SchemeFilter.add(new Match("MPFSchemeTrusteeCode", MPFSchemeTrusteeCode.SelectedValue));
        }
        binding.add(new DropDownVLBinder(db, MPFSchemeID, EMPFScheme.VLMPFScheme, SchemeFilter));
        binding.add(MPFPlanCompanyName);
        binding.add(MPFPlanCompanyAddress);
        binding.add(MPFPlanContactName);
        binding.add(MPFPlanContactNo);
        binding.add(MPFPlanParticipationNo);
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanPayCenter, "MPFPlanExtendData", MPFPlanPayCenter.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanDefaultClassName, "MPFPlanExtendData", MPFPlanDefaultClassName.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanEmployerID, "MPFPlanExtendData", MPFPlanEmployerID.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanSchemeNo, "MPFPlanExtendData", MPFPlanSchemeNo.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanPlanNo, "MPFPlanExtendData", MPFPlanPlanNo.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanBOCISequenceNo, "MPFPlanExtendData", MPFPlanBOCISequenceNo.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanAIAERPlanNo, "MPFPlanExtendData", MPFPlanAIAERPlanNo.ID));
        binding.add(new DropDownListXMLNodeVLBinder(db, MPFPlanAIAPayFrequency, EPayrollGroup.VLPayGroupFreq, null, "MPFPlanExtendData", MPFPlanAIAPayFrequency.ID));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanManulifeSubSchemeNo, "MPFPlanExtendData", HROne.MPFFile.ManulifeMPFFile.MPF_PLAN_XML_SUB_SCHEME_NO));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanManulifeGroupNo, "MPFPlanExtendData", HROne.MPFFile.ManulifeMPFFile.MPF_PLAN_XML_GROUP_NO));
        binding.add(new TextBoxXMLNodeBinder(db, MPFPlanManulifeSubGroupNo, "MPFPlanExtendData", HROne.MPFFile.ManulifeMPFFile.MPF_PLAN_XML_SUB_GROUP_NO));

        binding.add(new DropDownVLBinder(db, MPFPlanEmployerRoundingRule, Values.VLRoundingRule));
        binding.add(new DropDownVLBinder(db, MPFPlanEmployerDecimalPlace, Values.VLDecimalPlace));
        binding.add(new DropDownVLBinder(db, MPFPlanEmployeeRoundingRule, Values.VLRoundingRule));
        binding.add(new DropDownVLBinder(db, MPFPlanEmployeeDecimalPlace, Values.VLDecimalPlace));

        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["MPFPlanID"], out CurID))
        {
            CurID = -1;
        }

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

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
        }
    }
Exemple #27
0
    protected void Login_Click(object sender, EventArgs e)
    {
        EESSUser user = null;

        Session.Clear();

        HROne.DataAccess.DatabaseConnection  mainDBConn = null;
        HROne.SaaS.Entities.ECompanyDatabase companyDB  = null;
        bool   hasError = false;
        string message  = string.Empty;

        // always check whether companyDB exists after click
        if (Application["MasterDBConfig"] != null)
        {
            DatabaseConfig masterDBConfig = (DatabaseConfig)Application["MasterDBConfig"];
            HROne.DataAccess.DatabaseConnection masterDBConn = masterDBConfig.CreateDatabaseConnectionObject();
            DBFilter companyDatabaseFilter = new DBFilter();
            companyDatabaseFilter.add(new Match("CompanyDBClientCode", txtCustomerID.Text));
            ArrayList companyDatabaseList = HROne.SaaS.Entities.ECompanyDatabase.db.select(masterDBConn, companyDatabaseFilter);
            if (companyDatabaseList.Count > 0)
            {
                companyDB = (HROne.SaaS.Entities.ECompanyDatabase)companyDatabaseList[0];

                DatabaseConfig tempDBConfig = new DatabaseConfig();
                tempDBConfig.ConnectionString = companyDB.getConnectionString(masterDBConn);
                tempDBConfig.DBType           = WebUtils.DBTypeEmun.MSSQL;

                if (tempDBConfig.TestConnection())
                {
                    mainDBConn = tempDBConfig.CreateDatabaseConnectionObject();

                    HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTKEY, companyDB.CompanyDBProductKey);
                    HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTFEATURECODE, companyDB.getProductFeatureCode(masterDBConn));

                    string[] smtpParameterList = new string[]
                    {
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PORT,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_USERNAME,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL,
                        HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS
                    };
                    foreach (string smptParameter in smtpParameterList)
                    {
                        HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, smptParameter, ESystemParameter.getParameter(masterDBConn, smptParameter));
                    }
                    HROne.Lib.Entities.ESystemParameter.setParameterWithEncryption(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD
                                                                                   , HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD));
                }
                else
                {
                    if (HROne.DataAccess.DBAESEncryptStringFieldAttribute.InvalidRSAKey)
                    {
                        HttpRuntime.UnloadAppDomain();
                    }
                }
            }
        }
        else
        {
            mainDBConn = WebUtils.GetDatabaseConnection();
            if (mainDBConn == null)
            {
                if (multiDBRow.Visible)
                {
                    int idx;
                    if (int.TryParse(cboDatabase.SelectedValue, out idx))
                    {
                        HROneConfig    config   = HROneConfig.GetCurrentHROneConfig();
                        DatabaseConfig dbconfig = config.DatabaseConfigList[idx];
                        if (dbconfig.TestConnection())
                        {
                            mainDBConn = dbconfig.CreateDatabaseConnectionObject();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"Fail to connect database\");", true);
                            return;
                        }
                    }
                }
            }
        }
        if (mainDBConn != null)
        {
            WebUtils.SetSessionDatabaseConnection(Session, mainDBConn);
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense != null)
        {
            if (companyDB == null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROneSaaS)
            {
                productLicense.LoadProductKey(string.Empty);
            }
        }

        if (mainDBConn == null && companyDB != null)
        {
            hasError = true;
            message  = "Fail to connect to database. Please contact to customer service.";
        }
        if (!hasError)
        {
            bool ChangePassword = false;
            try
            {
                WebUtils.ValidateUser(mainDBConn, Username.Text, HROne.CommonLib.Hash.PasswordHash(Password.Text), true, out ChangePassword, out user);
            }
            catch (Exception ex)
            {
                hasError = true;
                message  = ex.Message;
            }
            // copy from GAP customization, checking Active Directory ID
            if (user != null)
            {
                DBFilter ADIDFilter = new DBFilter();
                ADIDFilter.add(new Match("EmpExtraFieldName", "AD ID"));
                DBFilter ADIDValueFilter = new DBFilter();
                ADIDValueFilter.add(new IN("EmpExtraFieldID", "Select EmpExtraFieldID from " + EEmpExtraField.db.dbclass.tableName, ADIDFilter));
                ADIDValueFilter.add(new Match("EmpID", user.EmpID));

                ArrayList ADIDList = EEmpExtraFieldValue.db.select(dbConn, ADIDValueFilter);
                if (ADIDList.Count > 0)
                {
                    string remoteUser = Request.ServerVariables["REMOTE_USER"].Trim();
                    string ADID       = ((EEmpExtraFieldValue)ADIDList[0]).EmpExtraFieldValue.Trim();

                    if (!remoteUser.Equals(ADID, StringComparison.CurrentCultureIgnoreCase) && !remoteUser.EndsWith("\\" + ADID, StringComparison.CurrentCultureIgnoreCase) && !remoteUser.EndsWith("/" + ADID, StringComparison.CurrentCultureIgnoreCase))
                    {
                        hasError = true;
                        message  = "This PC is not logged with your network ID!";
                    }
                }
            }
            if (companyDB != null && !hasError)
            {
                if (!companyDB.CompanyDBIsActive)
                {
                    hasError = true;
                    message  = "Subscribed service has been expired; please contact customer service hotline for assistant.";
                }
                if (!productLicense.IsESS)
                {
                    hasError = true;
                    message  = "You are NOT subscribed the service.";
                }
            }

            if (!hasError)
            {
                HROne.Lib.Entities.EESSLoginAudit.CreateLoginAudit(mainDBConn, user.EmpID, Username.Text, Request, AppUtils.ServerDateTime(), false, string.Empty);

                // ADD the Session "User" Value is user
                Session["User"] = user;

                if (ChangePassword)
                {
                    Session.Add("ForceChangePassword", true);
                }
                WebUtils.SetSessionLanguage(Session, user);
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx?LastURL=" + DecryptedRequest["LastURL"]);
            }
        }
        //  Remove all item for release session
        Session.Clear();
        Request.Cookies.Remove(HROne.Common.WebUtility.getDefaultSessionCookieName());
        //if (companyDB != null)
        //{
        //    Session.Remove("DatabaseConnection");
        //}
        {
            if (user != null)
            {
                HROne.Lib.Entities.EESSLoginAudit.CreateLoginAudit(mainDBConn, user.EmpID, Username.Text, Request, AppUtils.ServerDateTime(), true, message);
            }
            else
            {
                HROne.Lib.Entities.EESSLoginAudit.CreateLoginAudit(mainDBConn, 0, Username.Text, Request, AppUtils.ServerDateTime(), true, message);
            }

            //message = message.Replace("\\", "\\\\").Replace("\r", "\\r").Replace("\n", "\\n").Replace("\"", "\\\"");
            //message = message.Replace(HROne.Common.WebUtility.GetLocalizedString("validate.prompt"), "");
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"" + message + "\");", true);
            Prompt.Text = message;
            System.Threading.Thread.Sleep(1000);
        }
    }
Exemple #28
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;

        if (!int.TryParse(DecryptedRequest["PaymentCodeID"], out CurID))
        {
            CurID = -1;
        }

        DBFilter paymentTypeFilter       = new DBFilter();
        DBFilter uniquePaymentTypeFilter = new DBFilter();

        uniquePaymentTypeFilter.add(new IN("pc.PaymentTypeID",
                                           EPaymentType.SystemPaymentType.MPFEmployeeMandatoryContributionPaymentType(dbConn).PaymentTypeID.ToString() + ", "
                                           + EPaymentType.SystemPaymentType.MPFEmployerMandatoryContributionPaymentType(dbConn).PaymentTypeID.ToString() + ", "
                                           + EPaymentType.SystemPaymentType.MPFEmployeeVoluntaryContributionPaymentType(dbConn).PaymentTypeID.ToString() + ", "
                                           + EPaymentType.SystemPaymentType.MPFEmployerVoluntaryContributionPaymentType(dbConn).PaymentTypeID.ToString() + ", "
                                           + EPaymentType.SystemPaymentType.PFundEmployeeContributionPaymentType(dbConn).PaymentTypeID.ToString() + ", "
                                           + EPaymentType.SystemPaymentType.PFundEmployerContributionPaymentType(dbConn).PaymentTypeID.ToString()
                                           , new DBFilter()));
        uniquePaymentTypeFilter.add(new Match("pc.PaymentCodeID", "<>", CurID));
        paymentTypeFilter.add(new IN("not PaymentTypeID", "Select PaymentTypeID from PaymentCode pc", uniquePaymentTypeFilter));

        binding = new Binding(dbConn, db);
        binding.add(PaymentCodeID);
        binding.add(PaymentCode);
        binding.add(PaymentCodeDesc);
        binding.add(new CheckBoxBinder(db, PaymentCodeIsProrata));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsProrataLeave));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsProrataStatutoryHoliday));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsMPF));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsWages));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsTopUp));
        binding.add(new CheckBoxBinder(db, PaymentCodeIsORSO));
        binding.add(new DropDownVLBinder(db, PaymentTypeID, EPaymentType.VLPaymentType, paymentTypeFilter));
        binding.add(new DropDownVLBinder(db, PaymentCodeRoundingRule, Values.VLRoundingRule));
        binding.add(new DropDownVLBinder(db, PaymentCodeDecimalPlace, Values.VLDecimalPlace));
        binding.add(new CheckBoxBinder(db, PaymentCodeRoundingRuleIsAbsoluteValue));
        binding.add(new CheckBoxBinder(db, PaymentCodeHideInPaySlip));
        binding.add(PaymentCodeDisplaySeqNo);
        binding.add(new CheckBoxBinder(db, PaymentCodeNotRemoveContributionFromTopUp));
        // Start 000159, Ricky So, 2015-01-23
        binding.add(new CheckBoxBinder(db, PaymentCodeIsHitRateBased));
        binding.add(new TextBoxBinder(db, PaymentCodeDefaultRateAtMonth1));
        binding.add(new TextBoxBinder(db, PaymentCodeDefaultRateAtMonth2));
        binding.add(new TextBoxBinder(db, PaymentCodeDefaultRateAtMonth3));
        // End 000159, Ricky So, 2015-01-23
        binding.init(Request, Session);


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

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            PaymentCodeNotRemoveContributionFromTopUpRow.Visible = false;
        }
        else
        {
            PaymentCodeNotRemoveContributionFromTopUpRow.Visible = true;
        }

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
            loadTaxPayment();
        }
    }
Exemple #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;



        binding = new Binding(dbConn, db);
        binding.add(LeavePlanID);
        binding.add(LeavePlanCode);
        binding.add(LeavePlanDesc);
        binding.add(new LabelVLBinder(db, LeavePlanUseCommonLeaveYear, Values.VLTrueFalseYesNo));
        binding.add(LeavePlanCommonLeaveYearStartDay);
        binding.add(new BlankZeroLabelVLBinder(db, LeavePlanCommonLeaveYearStartMonth, Values.VLMonth));
        binding.add(new BlankZeroLabelVLBinder(db, ALProrataRoundingRuleID, EALProrataRoundingRule.VLALProrataRoundingRule));
        binding.add(new LabelVLBinder(db, LeavePlanProrataSkipFeb29, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeavePlanResetYearOfService, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeavePlanNoCountFirstIncompleteYearOfService, ELeavePlan.VLYearOfServiceReferenceMethod));
        binding.add(new LabelVLBinder(db, LeavePlanComparePreviousLeavePlan, Values.VLTrueFalseYesNo));
        binding.add(LeavePlanLeavePlanCompareRank);

        binding.add(new LabelVLBinder(db, LeavePlanUseStatutoryHolidayEntitle, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeavePlanUsePublicHolidayEntitle, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeavePlanUseRestDayEntitle, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeavePlanRestDayEntitlePeriod, ELeavePlan.VLRestDayEntitlementPeriod));
        binding.add(LeavePlanRestDayEntitleDays);
        binding.add(new LabelVLBinder(db, LeavePlanRestDayWeeklyEntitleStartDay, ELeavePlan.VLRestDayGainWeekDay));
        binding.add(LeavePlanRestDayMonthlyEntitleProrataBase);
        binding.add(new LabelVLBinder(db, LeavePlanRestDayMonthlyEntitleProrataRoundingRuleID, EALProrataRoundingRule.VLALProrataRoundingRule));

        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["LeavePlanID"], out CurID))
        {
            CurID = -1;
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);

        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            ALProrataRoundingRuleRow.Visible     = false;
            ResetYearOfServiceRow.Visible        = false;
            ComparePreviousLeavePlanRow.Visible  = false;
            RestDayStatutoryHolidayPanel.Visible = false;
        }
        else
        {
            ALProrataRoundingRuleRow.Visible     = true;
            ResetYearOfServiceRow.Visible        = true;
            ComparePreviousLeavePlanRow.Visible  = true;
            RestDayStatutoryHolidayPanel.Visible = true;
        }

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

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
                loadLeaveTypes();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }
        toolBar.FunctionCode = FUNCTION_CODE;



        binding = new Binding(dbConn, db);
        binding.add(LeaveCodeID);
        binding.add(new LabelVLBinder(db, LeaveTypeID, ELeaveType.VLLeaveType));
        binding.add(LeaveCode);
        binding.add(LeaveCodeDesc);
        binding.add(LeaveCodePayRatio);
        binding.add(new BlankZeroLabelVLBinder(db, LeaveCodeLeaveAllowPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new BlankZeroLabelVLBinder(db, LeaveCodeLeaveDeductPaymentCodeID, EPaymentCode.VLPaymentCode));
        binding.add(new LabelVLBinder(db, LeaveCodeLeaveDeductFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new LabelVLBinder(db, LeaveCodeLeaveAllowFormula, EPayrollProrataFormula.VLPayrollProrataFormula));
        binding.add(new LabelVLBinder(db, LeaveCodePayAdvance, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveCodeIsPayrollProcessNextMonth, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveCodeIsShowMedicalCertOption, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveCodeHideInESS, Values.VLTrueFalseYesNo));
        binding.add(new LabelVLBinder(db, LeaveCodeIsSkipPayrollProcess, Values.VLTrueFalseYesNo));
        binding.add(new CheckBoxBinder(db, LeaveCodeUseAllowancePaymentCodeIfSameAmount));
        binding.add(new LabelVLBinder(db, LeaveCodeIsCNDProrata, Values.VLTrueFalseYesNo));
        binding.add(LeaveAppUnit);
        binding.init(Request, Session);

        if (!int.TryParse(DecryptedRequest["LeaveCodeID"], out CurID))
        {
            CurID = -1;
        }

        HROne.ProductLicense productLicense = WebUtils.productLicense(Session);
        if (productLicense.IsESS)
        {
            ESSRow.Visible = true;
        }
        else
        {
            ESSRow.Visible = false;
        }
        if (productLicense.ProductType != HROne.ProductLicense.ProductLicenseType.HROne)
        {
            LeaveCodeIsCNDProrataRow.Visible = false;
        }
        else
        {
            LeaveCodeIsCNDProrataRow.Visible = true;
        }

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

        if (!Page.IsPostBack)
        {
            if (CurID > 0)
            {
                loadObject();
            }
            else
            {
                toolBar.DeleteButton_Visible = false;
            }
        }
    }