Beispiel #1
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(ECostAllocation.db, Repeater, "ItemSelect");

        CostAllocationProcess costAllocationProcess = new CostAllocationProcess(dbConn);

        foreach (ECostAllocation obj in list)
        {
            ECostAllocation.db.select(dbConn, obj);
            WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID, true);

            costAllocationProcess.Confirm(obj.CostAllocationID, WebUtils.GetCurUser(Session));
            WebUtils.EndFunction(dbConn);
        }
        PageErrors.getErrors(db, Page).addError("Complete");

        view = loadData(info, EEmpPayroll.db, Repeater);
    }
Beispiel #2
0
    protected void btnTrialRun_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPayroll o = (EEmpPayroll)EEmpPayroll.db.createObject();
                WebFormUtils.GetKeys(EEmpPayroll.db, o, cb);
                list.Add(o);
            }
        }

        DateTime processDateTime = AppUtils.ServerDateTime();


        if (list.Count > 0)
        {
            //EPayrollPeriod payPeriod = new EPayrollPeriod();
            //payPeriod.PayPeriodID = CurPayPeriodID;
            //payPeriod.PayPeriodStatus = "C";
            //payPeriod.PayPeriodConfirmDate = processDateTime;
            //payPeriod.PayPeriodConfirmBy = WebUtils.GetCurUser(Session).UserID;
            //EPayrollPeriod.db.update(dbConn, payPeriod);

            //EPayrollBatch payBatch = new EPayrollBatch();
            //payBatch.PayBatchConfirmDate = processDateTime;
            //EPayrollBatch.db.insert(dbConn, payBatch);
            CostAllocationProcess costAllocationProcess = new CostAllocationProcess(dbConn);

            foreach (EEmpPayroll o in list)
            {
                if (EEmpPayroll.db.select(dbConn, o))
                {
                    WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID, true);
                    costAllocationProcess.TrialRun(o.EmpPayrollID, WebUtils.GetCurUser(Session));
                    WebUtils.EndFunction(dbConn);

                    //EEmpPayroll empPayroll = new EEmpPayroll();
                    //empPayroll.EmpPayrollID = o.EmpPayrollID;
                    //EEmpPayroll.db.select(dbConn, empPayroll);
                    //if (empPayroll.EmpPayStatus.Equals("T", StringComparison.CurrentCultureIgnoreCase))
                    //{
                    //    empPayroll.EmpPayStatus = "C";
                    //    empPayroll.EmpPayConfirmDate = processDateTime;
                    //    empPayroll.PayBatchID = payBatch.PayBatchID;
                    //    EEmpPayroll.db.update(dbConn, empPayroll);
                    //}
                }
            }
            if (costAllocationProcess.hasError)
            {
                PageErrors.getErrors(db, Page).addGlobalError("Complete with error");
                PageErrors.getErrors(db, Page).addGlobalError(costAllocationProcess.ErrorLog.Replace("\r", "\\r"));
            }
            else
            {
                PageErrors.getErrors(db, Page).addError("Complete");
            }
            //Response.Write("<script>alert('Completed'); </script>");
        }
        loadObject();
        loadData(info, EEmpPayroll.db, Repeater);
    }