Exemple #1
0
//    protected void Save_Click(object sender, EventArgs e)
//    {
//        EORSOPlan c = new EORSOPlan();

//        Hashtable values = new Hashtable();
//        binding.toValues(values);

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


//        db.validate(errors, values);

//        if (!errors.isEmpty())
//            return;


//        db.parse(values, c);
//        if (!AppUtils.checkDuplicate(dbConn, db, c, errors, "ORSOPlanCode"))
//            return;

//        WebUtils.StartFunction(Session, FUNCTION_CODE);
//        if (CurID < 0)
//        {
////            Utils.MarkCreate(Session, c);

//            db.insert(dbConn, c);
//            CurID = c.ORSOPlanID;
////            url = Utils.BuildURL(-1, CurID);
//        }
//        else
//        {
////            Utils.Mark(Session, c);
//            db.update(dbConn, c);
//        }
//        WebUtils.EndFunction(dbConn);


//        Response.Redirect(Request.Url.LocalPath+"?ORSOPlanID="+CurID);


//    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (DataListItem item in Repeater.Items)
        {
            CheckBox        c = (CheckBox)item.FindControl("DeleteItem");
            HtmlInputHidden h = (HtmlInputHidden)item.FindControl("ORSOPlanDetailID");
            if (c.Checked)
            {
                EORSOPlanDetail obj = new EORSOPlanDetail();
                obj.ORSOPlanDetailID = Int32.Parse(h.Value);
                list.Add(obj);
            }
        }
        WebUtils.StartFunction(Session, FUNCTION_CODE);
        foreach (EORSOPlanDetail obj in list)
        {
            if (ORSOPlanDetaildb.select(dbConn, obj))
            {
                ORSOPlanDetaildb.delete(dbConn, obj);
            }
        }
        WebUtils.EndFunction(dbConn);
        view = loadData(info, ORSOPlanDetaildb, Repeater);
    }
Exemple #2
0
    protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemIndex == Repeater.EditItemIndex)
        {
            ORSOPlanDetailebinding = new Binding(dbConn, ORSOPlanDetaildb);
            ORSOPlanDetailebinding.add((HtmlInputHidden)e.Item.FindControl("ORSOPlanDetailID"));
            // ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanID"));              // not defined by ben
            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailYearOfService"));
            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailER"));

            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailERFix"));
            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailEE"));

            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailEEFix"));
            ORSOPlanDetailebinding.init(Request, Session);


            EORSOPlanDetail obj = new EORSOPlanDetail();
            ORSOPlanDetaildb.toObject(((DataRowView)e.Item.DataItem).Row, obj);
            Hashtable values = new Hashtable();
            ORSOPlanDetaildb.populate(obj, values);
            ORSOPlanDetailebinding.toControl(values);
        }
        else
        {
            e.Item.FindControl("Edit").Visible       = toolBar.DeleteButton_Visible;
            e.Item.FindControl("DeleteItem").Visible = toolBar.DeleteButton_Visible;
            HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("ORSOPlanDetailID");
            h.Value = ((DataRowView)e.Item.DataItem)["ORSOPlanDetailID"].ToString();
        }
        HROne.Common.WebUtility.WebControlsLocalization(Session, e.Item.Controls);
    }
Exemple #3
0
        //private static double CalculateEEAmount(DatabaseConnection dbConn, EEmpPersonalInfo empInfo, int ORSOPlanID, double TotalVCRI, EPayrollPeriod payrollPeriod, DateTime ORSOJoinDate)
        //{
        //    double totalVC = 0;

        //    EORSOPlan orsoPlan = new EORSOPlan();
        //    orsoPlan.ORSOPlanID  = ORSOPlanID;
        //    if (EORSOPlan.db.select(dbConn, orsoPlan))
        //    {

        //        //  Use Service Year to Compare
        //        double YearOfService = HROne.Payroll.PayrollProcess.GetYearOfServer(dbConn, empInfo.EmpID, payrollPeriod.PayPeriodFr);
        //        EORSOPlanDetail orsoPlanDetailFrom = orsoPlan.GetORSOPlanDetail(dbConn, YearOfService);

        //        if (TotalVCRI <= 0)
        //            return 0;
        //        else
        //        {
        //            totalVC = TotalVCRI * orsoPlanDetailFrom.ORSOPlanDetailEE/ 100;
        //            totalVC += orsoPlanDetailFrom.ORSOPlanDetailEEFix;
        //            return totalVC < orsoPlan.ORSOPlanMaxEmployeeVC ? totalVC : orsoPlan.ORSOPlanMaxEmployeeVC;
        //        }
        //    }
        //    else
        //        return 0;
        //}
        // End 0000084, Ricky So, 2014-08-22

        // Start 0000084, Ricky So, 2014-08-22
        private static double CalculateERAmount(DatabaseConnection dbConn, EEmpPersonalInfo empInfo, int ORSOPlanID, double TotalVCRI, EPayrollPeriod payrollPeriod, EMPFRecord mpfRecord)
        {
            double totalVC = 0;

            EORSOPlan orsoPlan = new EORSOPlan();

            orsoPlan.ORSOPlanID = ORSOPlanID;
            if (EORSOPlan.db.select(dbConn, orsoPlan))
            {
                //  Use Service Year to Compare
                double          YearOfService      = HROne.Payroll.PayrollProcess.GetYearOfServer(dbConn, empInfo.EmpID, payrollPeriod.PayPeriodFr);
                EORSOPlanDetail orsoPlanDetailFrom = orsoPlan.GetORSOPlanDetail(dbConn, YearOfService);

                if (orsoPlanDetailFrom == null || TotalVCRI <= 0)
                {
                    return(0);
                }
                else
                {
                    totalVC = TotalVCRI * orsoPlanDetailFrom.ORSOPlanDetailER / 100;

                    // Cap before residual
                    if (orsoPlan.ORSOPlanEmployerResidual)
                    {
                        // Start 0000084, Ricky So, 2014-08-22
                        totalVC = (totalVC > orsoPlan.ORSOPlanEmployerResidualCap) ? orsoPlan.ORSOPlanEmployerResidualCap : totalVC;
                        // End 0000084, Ricky So, 2014-08-22

                        // Deduct MPF contribution (use residual)
                        if (mpfRecord != null)
                        {
                            totalVC = (totalVC > mpfRecord.MPFRecActMCER) ? (totalVC - mpfRecord.MPFRecActMCER) : 0;
                        }
                    }

                    totalVC += orsoPlanDetailFrom.ORSOPlanDetailERFix;
                    return(totalVC < orsoPlan.ORSOPlanMaxEmployerVC ? totalVC : orsoPlan.ORSOPlanMaxEmployerVC);
                }
            }
            else
            {
                return(0);
            }
        }
Exemple #4
0
    //protected void ChangeOrder_Click(object sender, EventArgs e)
    //{
    //    LinkButton l = (LinkButton)sender;
    //    String id = l.ID.Substring(1);
    //    if (info.orderby == null)
    //        info.order = true;
    //    else if (info.orderby.Equals(id))
    //        info.order = !info.order;
    //    else
    //        info.order = true;
    //    info.orderby = id;

    //    Repeater.EditItemIndex = -1;
    //    view = loadData(info, ORSOPlanDetaildb, Repeater);

    //    Response.Redirect(Request.Url.LocalPath + "?ORSOPlanID=" + CurID);

    //}
    protected void Add_Click(object sender, EventArgs e)
    {
        Repeater.EditItemIndex = -1;
        EORSOPlanDetail c = new EORSOPlanDetail();

        Hashtable values = new Hashtable();

        ORSOPlanDetailbinding.toValues(values);

        PageErrors errors = PageErrors.getErrors(ORSOPlanDetaildb, Page);

        errors.clear();


        ORSOPlanDetaildb.validate(errors, values);

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


        ORSOPlanDetaildb.parse(values, c);

        //if (!AppUtils.checkDuplicate(dbConn, ORSOPlanDetaildb, c, errors, "ORSOPlanDetailYearOfService"))
        //    return;

        WebUtils.StartFunction(Session, FUNCTION_CODE);
        ORSOPlanDetaildb.insert(dbConn, c);
        WebUtils.EndFunction(dbConn);

        ORSOPlanDetailEE.Text            = string.Empty;
        ORSOPlanDetailEEFix.Text         = string.Empty;
        ORSOPlanDetailER.Text            = string.Empty;
        ORSOPlanDetailERFix.Text         = string.Empty;
        ORSOPlanDetailYearOfService.Text = string.Empty;

        view = loadData(info, ORSOPlanDetaildb, Repeater);
    }
Exemple #5
0
    protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e)
    {
        Button b = (Button)e.CommandSource;



        if (b.ID.Equals("Edit"))
        {
            Repeater.EditItemIndex = e.Item.ItemIndex;
            view = loadData(info, ORSOPlanDetaildb, Repeater);
            WebUtils.SetEnabledControlSection(AddPanel1, false);
            WebUtils.SetEnabledControlSection(AddPanel2, false);
        }
        else if (b.ID.Equals("Cancel"))
        {
            Repeater.EditItemIndex = -1;
            view = loadData(info, ORSOPlanDetaildb, Repeater);
            WebUtils.SetEnabledControlSection(AddPanel1, true);
            WebUtils.SetEnabledControlSection(AddPanel2, true);
        }
        else if (b.ID.Equals("Save"))
        {
            ORSOPlanDetailebinding = new Binding(dbConn, ORSOPlanDetaildb);
            ORSOPlanDetailebinding.add((HtmlInputHidden)e.Item.FindControl("ORSOPlanDetailID"));
            // ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanID"));              // not defined by ben
            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailYearOfService"));
            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailER"));

            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailERFix"));
            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailEE"));

            ORSOPlanDetailebinding.add((TextBox)e.Item.FindControl("ORSOPlanDetailEEFix"));
            ORSOPlanDetailebinding.init(Request, Session);


            EORSOPlanDetail obj    = new EORSOPlanDetail();
            Hashtable       values = new Hashtable();

            PageErrors errors = PageErrors.getErrors(ORSOPlanDetaildb, Page);
            errors.clear();


            ORSOPlanDetailebinding.toValues(values);
            ORSOPlanDetaildb.validate(errors, values);

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

            ORSOPlanDetaildb.parse(values, obj);
            //if (!AppUtils.checkDuplicate(dbConn, ORSOPlanDetaildb, obj, errors, "ORSOPlanID"))
            //return;

            WebUtils.StartFunction(Session, FUNCTION_CODE);
            ORSOPlanDetaildb.update(dbConn, obj);
            WebUtils.EndFunction(dbConn);

            Repeater.EditItemIndex = -1;
            view = loadData(info, ORSOPlanDetaildb, Repeater);
            WebUtils.SetEnabledControlSection(AddPanel1, true);
            WebUtils.SetEnabledControlSection(AddPanel2, true);
        }
    }