コード例 #1
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EEmpPersonalInfo p      = new EEmpPersonalInfo();
        ArrayList        values = new ArrayList();

        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            if (cb.Checked)
            {
                WebFormUtils.GetKeys(db, p, cb);
                values.Add(p.EmpID);
            }
        }
        if (values.Count <= 0)
        {
            errors.addError("Employee not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Employee.EmpContactProcess rpt = new HROne.Reports.Employee.EmpContactProcess(dbConn, values);
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_Contact.rpt"));
            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "EmployeeContact", true);
        }

        //Session["Report_EmployeeList"] = values;
        //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Report_EmployeeContact_View.aspx");
    }
コード例 #2
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpAVCPlan o = new EEmpAVCPlan();
                WebFormUtils.GetKeys(sdb, o, cb);
                list.Add(o);
            }
        }
        if (list.Count > 0)
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, CurID);
            foreach (BaseObject o in list)
            {
                if (sdb.select(dbConn, o))
                {
                    sdb.delete(dbConn, o);
                }
            }
            WebUtils.EndFunction(dbConn);
        }
        loadData(info, sdb, Repeater);
    }
コード例 #3
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                ECompanyBankAccount o = new ECompanyBankAccount();
                WebFormUtils.GetKeys(db, o, cb);
                list.Add(o);
            }
        }
        foreach (ECompanyBankAccount o in list)
        {
            if (db.select(dbConn, o))
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, o);
                DBFilter companyBankAccountMapFilter = new DBFilter();
                companyBankAccountMapFilter.add(new Match("CompanyBankAccountID", o.CompanyBankAccountID));
                ECompanyBankAccountMap.db.delete(dbConn, companyBankAccountMapFilter);
                WebUtils.EndFunction(dbConn);
            }
        }
        view = loadData(info, db, Repeater);
    }
コード例 #4
0
    protected void Reject_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);;

        errors.clear();
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                DBObject o = db.createObject();
                WebFormUtils.GetKeys(db, o, cb);
                list.Add(o);
            }
        }
        foreach (EEmpRequest o in list)
        {
            if (db.select(dbConn, o))
            {
                o.EmpRequestRejectReason = RejectReason.Text;
                try
                {
                    ESSAuthorizationProcess authorization = new ESSAuthorizationProcess(dbConn);
                    authorization.RejectedAction(o, CurID);
                }
                catch (Exception ex)
                {
                    errors.addError(ex.Message);
                }
            }
        }
        view = loadData(info, db, Repeater);
    }
コード例 #5
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPositionInfo o = new EEmpPositionInfo();
                WebFormUtils.GetKeys(sdb, o, cb);
                list.Add(o);
            }
        }
        if (list.Count > 0)
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE, CurID);
            foreach (EEmpPositionInfo o in list)
            {
                if (sdb.select(dbConn, o))
                {
                    sdb.delete(dbConn, o);
                    DBFilter filter = new DBFilter();
                    filter.add(new Match("EmpPosID", o.EmpPosID));
                    ArrayList existingHierarchyList = EEmpHierarchy.db.select(dbConn, filter);
                    foreach (EEmpHierarchy h in existingHierarchyList)
                    {
                        EEmpHierarchy.db.delete(dbConn, h);
                    }
                }
            }
            WebUtils.EndFunction(dbConn);
        }
        loadData(info, sdb, Repeater);
    }
コード例 #6
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                ECompany o = new ECompany();
                WebFormUtils.GetKeys(db, o, cb);
                list.Add(o);
            }
        }
        foreach (ECompany o in list)
        {
            if (ECompany.db.select(dbConn, o))
            {
                DBFilter empPosFilter = new DBFilter();
                empPosFilter.add(new Match("CompanyID", o.CompanyID));
                empPosFilter.add("empid", true);
                ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter);
                if (empPosList.Count > 0)
                {
                    errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Company Code"), o.CompanyCode }));
                    foreach (EEmpPositionInfo empPos in empPosList)
                    {
                        EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                        empInfo.EmpID = empPos.EmpID;
                        if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                        {
                            errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        }
                        else
                        {
                            EEmpPositionInfo.db.delete(dbConn, empPos);
                        }
                    }
                    errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
                }
                else
                {
                    WebUtils.StartFunction(Session, FUNCTION_CODE);
                    db.delete(dbConn, o);
                    EUserCompany.DeleteCompanyForAllUsers(dbConn, o.CompanyID);
                    DBFilter companyBankAccountMapFilter = new DBFilter();
                    companyBankAccountMapFilter.add(new Match("CompanyID", o.CompanyID));
                    ECompanyBankAccountMap.db.delete(dbConn, companyBankAccountMapFilter);
                    WebUtils.EndFunction(dbConn);
                }
            }
        }
        loadData(info, db, Repeater);
    }
コード例 #7
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors  = PageErrors.getErrors(db, Page.Master);
        ArrayList  empList = new ArrayList();

        foreach (RepeaterItem i in empRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPersonalInfo o = (EEmpPersonalInfo)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                empList.Add(o);
            }
        }
        DateTime dtPayPeriodFr = new DateTime();
        DateTime dtPayPeriodTo = new DateTime();

        if (empList.Count > 0)
        {
            if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo))
            {
            }
            else
            {
                errors.addError("Invalid Date Format");
            }
        }
        else
        {
            errors.addError("Employee or Payroll Batch not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Payroll.KTPFundStatementProcess rpt = new HROne.Reports.Payroll.KTPFundStatementProcess(dbConn, empList, int.Parse(ORSOPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo);

            string ExportFormat = ((Button)sender).CommandArgument;
            if (!ExportFormat.Equals("EXCEL"))
            {
                string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_KTPFundStatement.rpt"));
                WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "KTPFundStatement", true);
            }
            else
            {
                string exportFileName = System.IO.Path.GetTempFileName();
                System.IO.File.Delete(exportFileName);
                exportFileName += ".xls";
                HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName);

                rpt.GenerateExcelReport(exportFileName);

                WebUtils.TransmitFile(Response, exportFileName, "KTPFundStatement_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true);
                Response.End();
            }
        }
    }
コード例 #8
0
    protected void btnConfirm_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)
        {
            int UserID = WebUtils.GetCurUser(Session).UserID;


            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID          = CurPayPeriodID;
            payPeriod.PayPeriodStatus      = "C";
            payPeriod.PayPeriodConfirmDate = processDateTime;
            payPeriod.PayPeriodConfirmBy   = UserID;
            EPayrollPeriod.db.update(dbConn, payPeriod);

            EPayrollBatch payBatch = new EPayrollBatch();
            payBatch.PayBatchConfirmDate = processDateTime;
            payBatch.PayBatchRemark      = txtRemark.Text;
            EPayrollBatch.db.insert(dbConn, payBatch);

            PayrollProcess payrollProcess = new PayrollProcess(dbConn);
            WebUtils.StartFunction(Session, FUNCTION_CODE, 0, true);
            foreach (EEmpPayroll o in list)
            {
                if (EEmpPayroll.db.select(dbConn, o))
                {
                    AppUtils.StartChildFunction(dbConn, o.EmpID);
                    payrollProcess.PayrollConfirm(o, payBatch.PayBatchID, UserID);
                    AppUtils.EndChildFunction(dbConn);
                }
            }
            WebUtils.EndFunction(dbConn);
            PageErrors.getErrors(db, Page).addError("Complete");
            txtRemark.Text = string.Empty;
            //Response.Write("<script>alert('Completed'); </script>");
        }
        loadObject();
        loadData(info, EEmpPayroll.db, Repeater);
    }
コード例 #9
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        HROne.DataAccess.PageErrors errors = HROne.DataAccess.PageErrors.getErrors(null, Page.Master);
        errors.clear();

        ArrayList list = new ArrayList();

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

        DateTime processDateTime = AppUtils.ServerDateTime();


        if (list.Count > 0)
        {
            ESystemParameter.setParameter(dbConn, TAXATION_NAME_OF_SIGNATURE, txtNameOfSignature.Text);

            HROne.Reports.Taxation.TaxationFormProcess.ReportLanguage lang = HROne.Reports.Taxation.TaxationFormProcess.ReportLanguage.English;
            if (ReportLanguage.SelectedValue.Equals("big5"))
            {
                lang = HROne.Reports.Taxation.TaxationFormProcess.ReportLanguage.TraditionalChinese;
            }
            HROne.Reports.Taxation.TaxationFormProcess rpt = new HROne.Reports.Taxation.TaxationFormProcess(dbConn, list, CurrentTaxFormID, CurTaxFormType, txtNameOfSignature.Text, lang);

            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Taxation_IR56" + CurTaxFormType + ".rpt"));

            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text + " ( " + TaxFormID.SelectedItem.Text + " IR56" + CurTaxFormType + " )", Response, rpt, reportFileName, string.Empty, "IR56" + CurTaxFormType, false);


            //string strTaxEmpIDList = string.Empty;
            //foreach (ETaxEmp o in list)
            //{
            //    if (strTaxEmpIDList == string.Empty)
            //        strTaxEmpIDList = ((ETaxEmp)o).TaxEmpID.ToString();
            //    else
            //        strTaxEmpIDList += "_" + ((ETaxEmp)o).TaxEmpID.ToString();

            //}
            //Server.Transfer("Report_Taxation_Report_View.aspx?"
            //    + "TaxFormID=" + CurrentTaxFormID
            //    + "&TaxFormType=" + CurTaxFormType
            //    + "&TaxEmpID=" + strTaxEmpIDList);
        }
    }
コード例 #10
0
    protected void Authorize_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                DBObject o = db.createObject();
                WebFormUtils.GetKeys(db, o, cb);
                list.Add(o);
            }
        }
        foreach (EEmpRequest o in list)
        {
            db.select(dbConn, o);
            // Start 0000063, KuangWei, 2014-08-25
            o.EmpRequestRejectReason = RejectReason.Text;
            // End 0000063, KuangWei, 2014-08-25
            try
            {
                ESSAuthorizationProcess authorization = new ESSAuthorizationProcess(dbConn);


                ERequestOTClaim empOTRequest = new ERequestOTClaim();
                empOTRequest.RequestOTClaimID = o.EmpRequestRecordID;

                if (ERequestOTClaim.db.select(dbConn, empOTRequest))
                {
                    // handle the case where CL Requisition requests are approved through Application Approval screen
                    if (empOTRequest.RequestOTClaimEffectiveDate.Ticks.Equals(0))
                    {
                        empOTRequest.RequestOTClaimEffectiveDate = AppUtils.ServerDateTime();
                        empOTRequest.RequestOTClaimDateExpiry    = calExpiryDate(empOTRequest.RequestOTClaimPeriodFrom);
                        ERequestOTClaim.db.update(dbConn, empOTRequest);
                    }
                }

                authorization.AuthorizeAction(o, CurID);
            }
            catch (Exception ex)
            {
                errors.addError(ex.Message);
            }
        }
        view = loadData(info, db, Repeater);
    }
コード例 #11
0
    protected void Repeater_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        EDatabaseServer dbServer = new EDatabaseServer();
        CheckBox        cb       = (CheckBox)e.Item.FindControl("ItemSelect");

        WebFormUtils.GetKeys(db, dbServer, cb);
        if (EDatabaseServer.db.select(dbConn, dbServer))
        {
            if (e.CommandArgument.Equals("TestSA"))
            {
                System.Data.SqlClient.SqlConnectionStringBuilder saConnStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder();
                saConnStringBuilder.DataSource = dbServer.DBServerLocation;
                saConnStringBuilder.UserID     = dbServer.DBServerSAUserID;
                saConnStringBuilder.Password   = dbServer.DBServerSAPassword;

                DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.DBType           = WebUtils.DBTypeEmun.MSSQL;
                dbConfig.ConnectionString = saConnStringBuilder.ConnectionString;
                if (dbConfig.TestServerConnectionWithoutDatabase())
                {
                    errors.addError("Connection Pass");
                }
                else
                {
                    errors.addError("Connection Fail");
                }
            }
            else if (e.CommandArgument.Equals("TestUser"))
            {
                System.Data.SqlClient.SqlConnectionStringBuilder saConnStringBuilder = new System.Data.SqlClient.SqlConnectionStringBuilder();
                saConnStringBuilder.DataSource = dbServer.DBServerLocation;
                saConnStringBuilder.UserID     = dbServer.DBServerUserID;
                saConnStringBuilder.Password   = dbServer.DBServerPassword;

                DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.DBType           = WebUtils.DBTypeEmun.MSSQL;
                dbConfig.ConnectionString = saConnStringBuilder.ConnectionString;
                if (dbConfig.TestServerConnectionWithoutDatabase())
                {
                    errors.addError("Connection Pass");
                }
                else
                {
                    errors.addError("Connection Fail");
                }
            }
        }
    }
コード例 #12
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        DateTime dtAsOfDate = new DateTime();

        if (!DateTime.TryParse(AsOfDate.Value, out dtAsOfDate))
        {
            if (string.IsNullOrEmpty(AsOfDate.Value))
            {
                dtAsOfDate = AppUtils.ServerDateTime().Date;
            }
            else
            {
                return;
            }
        }
        EEmpPersonalInfo p      = new EEmpPersonalInfo();
        ArrayList        values = new ArrayList();

        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            if (cb.Checked)
            {
                WebFormUtils.GetKeys(db, p, cb);
                values.Add(p.EmpID);
            }
        }
        if (values.Count <= 0)
        {
            errors.addError("Employee not selected");
        }

        ArrayList leaveTypeList = WebUtils.SelectedRepeaterItemToBaseObjectList(ELeaveType.db, LeaveTypeRepeater, "ItemSelect");

        if (errors.isEmpty())
        {
            HROne.Reports.Employee.LeaveBalanceProcess rpt = new HROne.Reports.Employee.LeaveBalanceProcess(dbConn, values, dtAsOfDate, leaveTypeList);
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_LeaveBalance.rpt"));
            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "LeaveBalance", true);
        }

        //Session["AsOfDate"] = AsOfDate.Text;
        //Session["Report_EmployeeList"] = values;
        //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Report_LeaveSummary_View.aspx");
    }
コード例 #13
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList empTermList = new ArrayList();

        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpTermination et = new EEmpTermination();
                WebFormUtils.GetKeys(EEmpTermination.db, et, cb);
                empTermList.Add(et);
            }
        }
        string strTermEmpList = string.Empty;

        if (empTermList.Count > 0)
        {
            //foreach (EEmpTermination o in empTermList)
            //{
            //    if (strTermEmpList == string.Empty)
            //        strTermEmpList = o.EmpTermID.ToString();
            //    else
            //        strTermEmpList += "_" + o.EmpTermID.ToString();

            //}
        }
        else
        {
            errors.addError("Employee not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Employee.TerminationListProcess rpt = new HROne.Reports.Employee.TerminationListProcess(dbConn, empTermList);
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_TerminationList.rpt"));
            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "TerminationList", true);

            //Server.Transfer("Report_Employee_TerminationList_View.aspx?"
            //+ "EmpTermID=" + strTermEmpList
            //);
        }
        //        emploadData(empInfo, EEmpPayroll.db, empRepeater);
    }
コード例 #14
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        WebUtils.StartFunction(Session, FUNCTION_CODE);
        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            CheckBox AuthorizerIsReadOnly     = (CheckBox)item.FindControl("AuthorizerIsReadOnly");
            CheckBox AuthorizerSkipEmailAlert = (CheckBox)item.FindControl("AuthorizerSkipEmailAlert");
            if (cb.Checked)
            {
                EEmpPersonalInfo o = new EEmpPersonalInfo();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);

                DBFilter empAuthorizerFilter = new DBFilter();
                empAuthorizerFilter.add(new Match("empid", o.EmpID));
                empAuthorizerFilter.add(new Match("AuthorizationGroupID", CurID));
                if (EAuthorizer.db.count(dbConn, empAuthorizerFilter) <= 0)
                {
                    EAuthorizer authorizer = new EAuthorizer();
                    authorizer.EmpID = o.EmpID;
                    authorizer.AuthorizationGroupID     = CurID;
                    authorizer.AuthorizerIsReadOnly     = AuthorizerIsReadOnly.Checked;
                    authorizer.AuthorizerSkipEmailAlert = AuthorizerSkipEmailAlert.Checked;
                    EAuthorizer.db.insert(dbConn, authorizer);
                }
            }
        }
        WebUtils.EndFunction(dbConn);

        ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect");

        foreach (EEmpPersonalInfo o in list)
        {
            DBFilter empAuthorizerFilter = new DBFilter();
            empAuthorizerFilter.add(new Match("empid", o.EmpID));
            empAuthorizerFilter.add(new Match("AuthorizationGroupID", CurID));
            if (EAuthorizer.db.count(dbConn, empAuthorizerFilter) <= 0)
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID);
                EAuthorizer authorizer = new EAuthorizer();
                authorizer.EmpID = o.EmpID;
                authorizer.AuthorizationGroupID = CurID;
                EAuthorizer.db.insert(dbConn, authorizer);
                WebUtils.EndFunction(dbConn);
            }
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "ESS_AuthorizationGroup_View.aspx?AuthorizationGroupID=" + CurID);
    }
コード例 #15
0
    public static ArrayList SelectedRepeaterItemToBaseObjectList(DBManager db, Repeater RepeaterControl, string CheckBoxName)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in RepeaterControl.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl(CheckBoxName);
            if (cb.Checked)
            {
                DBObject o = (DBObject)db.createObject();
                WebFormUtils.GetKeys(db, o, cb);
                list.Add(o);
            }
        }
        return(list);
    }
コード例 #16
0
    protected void btnUndo_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(EEmpPayroll.db, Page.Master);

        errors.clear();

        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);
            }
        }
        if (list.Count > 0)
        {
            DateTime paidDate = new DateTime();

            if (!string.IsNullOrEmpty(SetPaidDate.Value))
            {
                paidDate = DateTime.Parse(SetPaidDate.Value);
            }
            foreach (EEmpPayroll o in list)
            {
                if (EEmpPayroll.db.select(dbConn, o))
                {
                    if (!o.EmpPayValueDate.Equals(paidDate))
                    {
                        WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID, true);
                        o.EmpPayValueDate = paidDate;
                        EEmpPayroll.db.update(dbConn, o);
                        WebUtils.EndFunction(dbConn);
                    }
                }
            }


            errors.addError("Paid Date is updated");
            SetPaidDate.Value = string.Empty;
        }
        loadData(info, EEmpPayroll.db, Repeater);
    }
コード例 #17
0
 public void SaveAsReleaseESSPaySlip()
 {
     foreach (RepeaterItem i in payBatchRepeater.Items)
     {
         CheckBox      cb = (CheckBox)i.FindControl("ItemSelect");
         EPayrollBatch o  = new EPayrollBatch();
         WebFormUtils.GetKeys(EPayrollBatch.db, o, cb);
         if (EPayrollBatch.db.select(dbConn, o))
         {
             if (o.PayBatchIsESSPaySlipRelease != cb.Checked)
             {
                 o.PayBatchIsESSPaySlipRelease = cb.Checked;
                 EPayrollBatch.db.update(dbConn, o);
             }
         }
     }
 }
コード例 #18
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList empJoinList = new ArrayList();

        foreach (RepeaterItem item in Repeater.Items)
        {
            CheckBox cb = (CheckBox)item.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPersonalInfo empJoin = new EEmpPersonalInfo();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, empJoin, cb);
                empJoinList.Add(empJoin);
            }
        }

        if (empJoinList.Count < 1)
        {
            errors.addError("Employee not selected");
        }

        if (errors.isEmpty())
        {
            ESystemParameter.setParameter(dbConn, SYSTEMPARAMETER_PREPAREDBY, txtPreparedBy.Text);
            ESystemParameter.setParameter(dbConn, SYSTEMPARAMETER_REVIEWEDBY, txtReviewedBy.Text);

            HROne.Reports.Payroll.NewJoinPaymentSummaryProcess rpt = null;
            if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("C"))
            {
                ArrayList payBatchList = this.Payroll_PeriodSelectionList1.GetPayBatchList();
                rpt = new HROne.Reports.Payroll.NewJoinPaymentSummaryProcess(dbConn, empJoinList, null, payBatchList, HROne.Reports.Payroll.NewJoinPaymentSummaryProcess.ReportType.History, txtPreparedBy.Text, txtReviewedBy.Text);
            }
            else if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("T"))
            {
                ArrayList payPeriodList = this.Payroll_PeriodSelectionList1.GetTrialRunPayPeriodList();
                rpt = new HROne.Reports.Payroll.NewJoinPaymentSummaryProcess(dbConn, empJoinList, payPeriodList, null, HROne.Reports.Payroll.NewJoinPaymentSummaryProcess.ReportType.TrialRun, txtPreparedBy.Text, txtReviewedBy.Text);
            }

            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_NewJoinPaymentSummary.rpt"));

            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "NewJoinPaymentSummary", true);
        }
    }
コード例 #19
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(sdb, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpBankAccount o = new EEmpBankAccount();
                WebFormUtils.GetKeys(sdb, o, cb);
                list.Add(o);
            }
        }
        foreach (EEmpBankAccount obj in list)
        {
            sdb.select(dbConn, obj);
            DBFilter paymentRecordFilter = new DBFilter();
            paymentRecordFilter.add(new Match("EmpAccID", obj.EmpBankAccountID));

            IN inTerms = new IN("EmpPayrollID", "Select EmpPayrollID From " + EPaymentRecord.db.dbclass.tableName, paymentRecordFilter);

            DBFilter empPayrollFilter = new DBFilter();
            empPayrollFilter.add(inTerms);
            empPayrollFilter.add("empid", true);
            ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);
            if (empPayrollList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_IS_IN_USE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Bank Account") }));
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            }
            else
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID);
                sdb.delete(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
        }
        loadData(info, sdb, Repeater);
    }
コード例 #20
0
    protected void btnPostToESS_Click(object sender, EventArgs e)
    {
        HROne.DataAccess.PageErrors errors = HROne.DataAccess.PageErrors.getErrors(null, Page.Master);
        errors.clear();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            ETaxEmp  o  = (ETaxEmp)ETaxEmp.db.createObject();
            WebFormUtils.GetKeys(db, o, cb);
            if (cb.Checked)
            {
                o.TaxEmpIsReleasePrintoutToESS = true;
            }
            else
            {
                o.TaxEmpIsReleasePrintoutToESS = false;
            }
            ETaxEmp.db.update(dbConn, o);
        }

        errors.addError("Taxation Report is released to ESS.");
    }
コード例 #21
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpDocument o = new EEmpDocument();
                WebFormUtils.GetKeys(sdb, o, cb);
                list.Add(o);
            }
        }
        foreach (EEmpDocument o in list)
        {
            if (sdb.select(dbConn, o))
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID);
                sdb.delete(dbConn, o);
                WebUtils.EndFunction(dbConn);
                try
                {
                    string UploadFile = System.IO.Path.Combine(uploadFolder, o.EmpDocumentStoredFileName);
                    if (System.IO.File.Exists(UploadFile))
                    {
                        System.IO.File.Delete(UploadFile);
                    }
                }
                catch
                {
                }
            }
        }
        loadData(info, sdb, Repeater);
    }
コード例 #22
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors  = PageErrors.getErrors(db, Page.Master);
        ArrayList  empList = new ArrayList();

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


        //string strEmpList = string.Empty;
        //string strPayBatchList = string.Empty;
        //string strPayPeriodRequest = string.Empty;
        DateTime dtPayPeriodFr = new DateTime();
        DateTime dtPayPeriodTo = new DateTime();

        if (empList.Count > 0)
        {
            //foreach (EEmpPersonalInfo o in empList)
            //{
            //    if (strEmpList == string.Empty)
            //        strEmpList = ((EEmpPersonalInfo)o).EmpID.ToString();
            //    else
            //        strEmpList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString();

            //}
            if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo))
            {
                //strPayPeriodRequest = "&PayPeriodFr=" + dtPayPeriodFr.Ticks + "&PayPeriodTo=" + dtPayPeriodTo.Ticks;
            }
            else
            {
                errors.addError("Invalid Date Format");
            }


            //            error.getErrors().addError("Complete");
            //Response.Write("<script>alert('Completed'); </script>");
        }
        else
        {
            errors.addError("Employee or Payroll Batch not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Payroll.PFundStatementProcess rpt = new HROne.Reports.Payroll.PFundStatementProcess(dbConn, empList, int.Parse(ORSOPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo);

            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_PFundStatement.rpt"));

            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "PFundStatement", true);

            //Server.Transfer("Report_Payroll_PFundStatement_View.aspx?"
            //    + "ORSOPlanID=" + ORSOPlanID.SelectedValue
            //    + strPayPeriodRequest
            //    + "&EmpID=" + strEmpList);
        }
//        emploadData(empInfo, EEmpPayroll.db, empRepeater);
    }
コード例 #23
0
    protected void btnProcess_Click(object sender, EventArgs e)
    {
        string    strEmpIDList = string.Empty;
        ArrayList list         = new ArrayList();

        foreach (RepeaterItem i in ExistingEmployeeRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                BaseObject o = (BaseObject)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                list.Add(o);
            }
        }
        foreach (RepeaterItem i in NewJoinRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                BaseObject o = (BaseObject)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                list.Add(o);
            }
        }
        foreach (RepeaterItem i in FinalPaymentRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                BaseObject o = (BaseObject)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                list.Add(o);
            }
        }
        if (list.Count > 0)
        {
            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID           = CurID;
            payPeriod.PayPeriodStatus       = "T";
            payPeriod.PayPeriodTrialRunDate = AppUtils.ServerDateTime();
            payPeriod.PayPeriodTrialRunBy   = WebUtils.GetCurUser(Session).UserID;
            EPayrollPeriod.db.update(dbConn, payPeriod);

            Session["PayrollTrialRun_EmpList"] = list;


            //foreach (BaseObject o in list)
            //{
            //    if (strEmpIDList == string.Empty)
            //        strEmpIDList = ((EEmpPersonalInfo)o).EmpID.ToString();
            //    else
            //        strEmpIDList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString();

            //}
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_TrialRunProcess.aspx?"
                                                                        + "PayPeriodID=" + DecryptedRequest["PayPeriodID"]
                                                                        + "&RecurringPayment=" + DecryptedRequest["RecurringPayment"]
                                                                        + "&ClaimsAndDeduction=" + DecryptedRequest["ClaimsAndDeduction"]
                                                                        + "&AdditionalRemuneration=" + DecryptedRequest["AdditionalRemuneration"]
                                                                        + "&YearEndBonus=" + DecryptedRequest["YearEndBonus"]
                                                                        // Start 0000178, Miranda, 2015-03-14
                                                                        //+ "&SkipMPFCal=" + (chkSkipMPFCal.Checked ? "1" : "0")
                                                                        + "&SkipMPFCal=" + (chkSkipMPFCal.Visible ? (chkSkipMPFCal.Checked ? "1" : "0") : "0")
                                                                        // End 0000178, Miranda, 2015-03-14
                                                                        + "&Total=" + list.Count
                                                                        //                + "&EmpID=" + strEmpIDList
                                                                        );
        }
    }
コード例 #24
0
    protected void Save_Click(object sender, EventArgs e)
    {
        EAVCPlan c = new EAVCPlan();

        if (AVCPlanMaxEmployeeVC.Text.EndsWith(".00"))
        {
            AVCPlanMaxEmployeeVC.Text = AVCPlanMaxEmployeeVC.Text.Substring(0, AVCPlanMaxEmployeeVC.Text.Length - 3);
        }
        if (AVCPlanMaxEmployerVC.Text.EndsWith(".00"))
        {
            AVCPlanMaxEmployerVC.Text = AVCPlanMaxEmployerVC.Text.Substring(0, AVCPlanMaxEmployerVC.Text.Length - 3);
        }
        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, "AVCPlanCode"))
        {
            return;
        }

        ArrayList selectedCeilingList   = new ArrayList();
        ArrayList unselectedCeilingList = new ArrayList();

        ArrayList selectedConsiderList   = new ArrayList();
        ArrayList unselectedConsiderList = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox     cb       = (CheckBox)i.FindControl("ItemSelect");
            TextBox      textBox  = (TextBox)i.FindControl("AVCPlanPaymentCeilingAmount");
            CheckBox     checkbox = (CheckBox)i.FindControl("AVCPlanPaymentConsiderAfterMPF");
            EPaymentCode o        = new EPaymentCode();
            WebFormUtils.GetKeys(EPaymentCode.db, o, cb);
            if (EPaymentCode.db.select(dbConn, o))
            {
                if (!string.IsNullOrEmpty(textBox.Text.Trim()))
                {
                    double amount = 0;
                    if (double.TryParse(textBox.Text, out amount))
                    {
                        EAVCPlanPaymentCeiling avcPlanCeiling = new EAVCPlanPaymentCeiling();
                        avcPlanCeiling.PaymentCodeID = o.PaymentCodeID;
                        avcPlanCeiling.AVCPlanPaymentCeilingAmount = amount;
                        selectedCeilingList.Add(avcPlanCeiling);
                    }
                    else
                    {
                        errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_AVCPLAN_CEILING_NOT_NUMERIC, new string[] { o.PaymentCode }));
                    }
                }
                else
                {
                    unselectedCeilingList.Add(o);
                }

                if (checkbox.Checked)
                {
                    EAVCPlanPaymentConsider avcPlanConsider = new EAVCPlanPaymentConsider();
                    avcPlanConsider.PaymentCodeID = o.PaymentCodeID;
                    avcPlanConsider.AVCPlanPaymentConsiderAfterMPF = checkbox.Checked;
                    selectedConsiderList.Add(avcPlanConsider);
                }
                else
                {
                    unselectedConsiderList.Add(o);
                }
            }
        }

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

            db.insert(dbConn, c);
            CurID = c.AVCPlanID;
//            url = Utils.BuildURL(-1, CurID);
        }
        else
        {
//            Utils.Mark(Session, c);
            db.update(dbConn, c);
        }
        foreach (EAVCPlanPaymentCeiling o in selectedCeilingList)
        {
            DBFilter avcPlanCeilingFilter = new DBFilter();
            avcPlanCeilingFilter.add(new Match("AVCPlanID", c.AVCPlanID));
            avcPlanCeilingFilter.add(new Match("PaymentCodeID", o.PaymentCodeID));
            ArrayList avcPlanCeilingList = EAVCPlanPaymentCeiling.db.select(dbConn, avcPlanCeilingFilter);
            if (avcPlanCeilingList.Count == 0)
            {
                o.AVCPlanID = c.AVCPlanID;
                EAVCPlanPaymentCeiling.db.insert(dbConn, o);
            }
            else
            {
                //  Check if more than 1 record exists in Database.
                int count = 0;
                foreach (EAVCPlanPaymentCeiling avcPlanCeiling in avcPlanCeilingList)
                {
                    if (count == 0)
                    {
                        avcPlanCeiling.AVCPlanPaymentCeilingAmount = o.AVCPlanPaymentCeilingAmount;
                        EAVCPlanPaymentCeiling.db.update(dbConn, avcPlanCeiling);
                    }
                    else
                    {
                        EAVCPlanPaymentCeiling.db.delete(dbConn, avcPlanCeiling);
                    }
                    count++;
                }
            }
        }

        foreach (EPaymentCode o in unselectedCeilingList)
        {
            DBFilter avcPlanCeilingFilter = new DBFilter();
            avcPlanCeilingFilter.add(new Match("AVCPlanID", c.AVCPlanID));
            avcPlanCeilingFilter.add(new Match("PaymentCodeID", o.PaymentCodeID));
            ArrayList avcPlanCeilingList = EAVCPlanPaymentCeiling.db.select(dbConn, avcPlanCeilingFilter);
            if (avcPlanCeilingList.Count != 0)
            {
                foreach (EAVCPlanPaymentCeiling avcPlanCeiling in avcPlanCeilingList)
                {
                    EAVCPlanPaymentCeiling.db.delete(dbConn, avcPlanCeiling);
                }
            }
        }

        foreach (EAVCPlanPaymentConsider o in selectedConsiderList)
        {
            DBFilter avcPlanCeilingFilter = new DBFilter();
            avcPlanCeilingFilter.add(new Match("AVCPlanID", c.AVCPlanID));
            avcPlanCeilingFilter.add(new Match("PaymentCodeID", o.PaymentCodeID));
            ArrayList avcPlanConsiderList = EAVCPlanPaymentConsider.db.select(dbConn, avcPlanCeilingFilter);
            if (avcPlanConsiderList.Count == 0)
            {
                o.AVCPlanID = c.AVCPlanID;
                EAVCPlanPaymentConsider.db.insert(dbConn, o);
            }
            else
            {
                //  Check if more than 1 record exists in Database.
                int count = 0;
                foreach (EAVCPlanPaymentConsider avcPlanConsider in avcPlanConsiderList)
                {
                    if (count == 0)
                    {
                        avcPlanConsider.AVCPlanPaymentConsiderAfterMPF = o.AVCPlanPaymentConsiderAfterMPF;
                        EAVCPlanPaymentConsider.db.update(dbConn, avcPlanConsider);
                    }
                    else
                    {
                        EAVCPlanPaymentConsider.db.delete(dbConn, avcPlanConsider);
                    }
                    count++;
                }
            }
        }

        foreach (EPaymentCode o in unselectedConsiderList)
        {
            DBFilter avcPlanCeilingFilter = new DBFilter();
            avcPlanCeilingFilter.add(new Match("AVCPlanID", c.AVCPlanID));
            avcPlanCeilingFilter.add(new Match("PaymentCodeID", o.PaymentCodeID));
            ArrayList avcPlanConsiderList = EAVCPlanPaymentConsider.db.select(dbConn, avcPlanCeilingFilter);
            if (avcPlanConsiderList.Count != 0)
            {
                foreach (EAVCPlanPaymentConsider avcPlanConsider in avcPlanConsiderList)
                {
                    EAVCPlanPaymentConsider.db.delete(dbConn, avcPlanConsider);
                }
            }
        }

        WebUtils.EndFunction(dbConn);


        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "AVCPlan_View.aspx?AVCPlanID=" + CurID);
    }
コード例 #25
0
    // End 0000112, Miranda, 2015-01-11

    protected void Save_Click(object sender, EventArgs e)
    {
        ERequestLateWaive c = new ERequestLateWaive();

        Hashtable values = new Hashtable();

        binding.toValues(values);

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

        errors.clear();


        db.validate(errors, values);

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


        db.parse(values, c);

        //if (c.RequestLateWaiveHourTo < c.RequestLateWaiveHourFrom)
        //    errors.addError("RequestLateWaiveTimeFrom", "Invald hours");
        //if (c.RequestLateWaivePeriodTo < c.RequestLateWaivePeriodFrom)
        //        errors.addError("RequestLateWaivePeriodFrom", "Date To cannot be earlier than Date From");

        //if (c.RequestOTHours <= 0)
        //    errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_FIELD_REQUIRED, new string[] { lblOTHours.Text }));

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

        // Start Ricky So, 2014-09-05, Avoid checking time overlap for CL Requisition
        //ArrayList overlapLateWaiveList = new ArrayList();
        //if (c.IsOverlapLateWaive(dbConn, out overlapLateWaiveList))
        //{
        //    string strHourlyOverlapMessage = string.Empty;

        //    foreach (BaseObject overlapLateWaive in overlapLateWaiveList)
        //    {
        //        if (overlapLateWaive is ELateWaive)
        //        {
        //            ELateWaive previousLateWaive = (ELateWaive)overlapLateWaive;
        //            if (string.IsNullOrEmpty(strHourlyOverlapMessage))
        //                strHourlyOverlapMessage = "Leave time cannot overlap with previous CL Requisition";
        //        }
        //        else if (overlapLateWaive is ERequestLateWaive)
        //        {
        //            ERequestLateWaive previousRequestLateWaive = (ERequestLateWaive)overlapLateWaive;
        //            if (string.IsNullOrEmpty(strHourlyOverlapMessage))
        //                strHourlyOverlapMessage = "Leave time cannot overlap with previous CL Requisition";

        //        }
        //    }

        //    if (!string.IsNullOrEmpty(strHourlyOverlapMessage))
        //        errors.addError(strHourlyOverlapMessage);
        //}
        // End Ricky So, 2014-09-05

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

        try
        {
            ESSAuthorizationProcess authorization = new ESSAuthorizationProcess(dbConn);
            // loap each attendance record which is ticked
            ArrayList list = new ArrayList();
            foreach (RepeaterItem i in Repeater.Items)
            {
                CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
                if (cb.Checked)
                {
                    DBObject o = sdb.createObject();
                    WebFormUtils.GetKeys(sdb, o, cb);
                    list.Add(o);
                }
            }
            foreach (EAttendanceRecord o in list)
            {
                c.AttendanceRecordID = o.AttendanceRecordID;
                authorization.SubmitLateWaive(c);
            }
        }
        catch (Exception ex)
        {
            errors.addError(ex.Message);
        }

        if (!errors.isEmpty())
        {
            return;
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/ESS_EmpRequestStatus.aspx");
    }
    protected void Save_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(ESystemParameter.db, Page.Master);
        int        testInteger;

        if (!txtPARAM_CODE_ECHANNEL_NUM_SIGNATURE_REQUIRED.Text.Equals(string.Empty) && !int.TryParse(txtPARAM_CODE_ECHANNEL_NUM_SIGNATURE_REQUIRED.Text, out testInteger))
        {
            errors.addError(WebUtility.GetLocalizedStringByCode("validate.int.prompt", "").Replace("{0}", lblPARAM_CODE_ECHANNEL_NUM_SIGNATURE_REQUIRED.Text));
        }

        if (errors.isEmpty())
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);

            ESystemParameter.setParameter(dbConn, ESystemParameter.PARAM_CODE_ECHANNEL_SIGNATURE_REQUIRED_FOR_AUTOPAY_FILE, chkPARAM_CODE_ECHANNEL_SIGNATURE_REQUIRED_FOR_AUTOPAY_FILE.Checked ? "Y" : "N");
            ESystemParameter.setParameter(dbConn, ESystemParameter.PARAM_CODE_ECHANNEL_SIGNATURE_REQUIRED_FOR_MPF_FILE, chkPARAM_CODE_ECHANNEL_SIGNATURE_REQUIRED_FOR_MPF_FILE.Checked ? "Y" : "N");
            ESystemParameter.setParameter(dbConn, ESystemParameter.PARAM_CODE_ECHANNEL_NUM_SIGNATURE_REQUIRED, txtPARAM_CODE_ECHANNEL_NUM_SIGNATURE_REQUIRED.Text);

            ArrayList selectedList   = new ArrayList();
            ArrayList unselectedList = new ArrayList();
            foreach (RepeaterItem i in Repeater.Items)
            {
                CheckBox   cb = (CheckBox)i.FindControl("ItemSelect");
                BaseObject o  = new EUser();
                WebFormUtils.GetKeys(EUser.db, o, cb);
                if (cb.Checked)
                {
                    selectedList.Add(o);
                }
                else
                {
                    unselectedList.Add(o);
                }
            }
            foreach (EUser o in selectedList)
            {
                DBFilter authorizedSignatureFilter = new DBFilter();
                authorizedSignatureFilter.add(new Match("UserID", o.UserID));
                ArrayList authorizedSignatureList = EeChannelAuthorizedSignature.db.select(dbConn, authorizedSignatureFilter);
                if (authorizedSignatureList.Count == 0)
                {
                    EeChannelAuthorizedSignature authorizedSignature = new EeChannelAuthorizedSignature();
                    authorizedSignature.UserID = o.UserID;
                    EeChannelAuthorizedSignature.db.insert(dbConn, authorizedSignature);
                }
            }

            foreach (EUser o in unselectedList)
            {
                DBFilter authorizedSignatureFilter = new DBFilter();
                authorizedSignatureFilter.add(new Match("UserID", o.UserID));
                ArrayList authorizedSignatureList = EeChannelAuthorizedSignature.db.select(dbConn, authorizedSignatureFilter);
                if (authorizedSignatureList.Count != 0)
                {
                    foreach (EeChannelAuthorizedSignature authorizedSignature in authorizedSignatureList)
                    {
                        EeChannelAuthorizedSignature.db.delete(dbConn, authorizedSignature);
                    }
                }
            }

            WebUtils.EndFunction(dbConn);
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/eChannel_AuthorizedSignatureSetup_View.aspx");
        }
    }
コード例 #27
0
    protected void Save_Click(object sender, EventArgs e)
    {
        ETaxPayment c = new ETaxPayment();

        Hashtable values = new Hashtable();

        binding.toValues(values);

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

        errors.clear();


        db.validate(errors, values);

        if (!errors.isEmpty())
        {
            if (CurID > 0)
            {
                loadObject();
                view = loadData(info, db, Repeater);
            }
            return;
        }

        db.parse(values, c);


        if (!errors.isEmpty())
        {
            if (CurID > 0)
            {
                loadObject();
                view = loadData(info, db, Repeater);
            }
            return;
        }

        WebUtils.StartFunction(Session, FUNCTION_CODE);
        db.update(dbConn, c);

        ArrayList selectedList   = new ArrayList();
        ArrayList unselectedList = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox   cb = (CheckBox)i.FindControl("ItemSelect");
            BaseObject o  = new EPaymentCode();
            WebFormUtils.GetKeys(EPaymentCode.db, o, cb);
            if (cb.Checked)
            {
                selectedList.Add(o);
            }
            else
            {
                unselectedList.Add(o);
            }
        }
        foreach (EPaymentCode o in selectedList)
        {
            DBFilter taxPaymentMapFilter = new DBFilter();
            taxPaymentMapFilter.add(new Match("TaxPayID", c.TaxPayID));
            taxPaymentMapFilter.add(new Match("PaymentCodeID", o.PaymentCodeID));
            ArrayList taxPaymentMaps = ETaxPaymentMap.db.select(dbConn, taxPaymentMapFilter);
            if (taxPaymentMaps.Count == 0)
            {
                ETaxPaymentMap taxPaymentMap = new ETaxPaymentMap();
                taxPaymentMap.TaxPayID      = c.TaxPayID;
                taxPaymentMap.PaymentCodeID = o.PaymentCodeID;
                ETaxPaymentMap.db.insert(dbConn, taxPaymentMap);
            }
        }

        foreach (EPaymentCode o in unselectedList)
        {
            DBFilter taxPaymentMapFilter = new DBFilter();
            taxPaymentMapFilter.add(new Match("TaxPayID", c.TaxPayID));
            taxPaymentMapFilter.add(new Match("PaymentCodeID", o.PaymentCodeID));
            ArrayList taxPaymentMaps = ETaxPaymentMap.db.select(dbConn, taxPaymentMapFilter);
            if (taxPaymentMaps.Count != 0)
            {
                foreach (ETaxPaymentMap taxPaymentMap in taxPaymentMaps)
                {
                    ETaxPaymentMap.db.delete(dbConn, taxPaymentMap);
                }
            }
        }
        WebUtils.EndFunction(dbConn);

        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Taxation_PaymentMapping_View.aspx?TaxFormType=" + TaxFormType.Text + "&TaxPayID=" + c.TaxPayID);
    }
コード例 #28
0
    protected void btnUndo_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(EEmpPayroll.db, Page.Master);

        errors.clear();

        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);
            }
        }
        if (list.Count > 0)
        {
            System.Collections.Generic.List <int> payPeriodIDList = new System.Collections.Generic.List <int>();
            PayrollProcess payrollProcess = new PayrollProcess(dbConn);
            foreach (EEmpPayroll o in list)
            {
                if (EEmpPayroll.db.select(dbConn, o))
                {
                    if (!payPeriodIDList.Contains(o.PayPeriodID))
                    {
                        payPeriodIDList.Add(o.PayPeriodID);
                    }
                    WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID, true);
                    payrollProcess.UndoPayroll(o);
                    WebUtils.EndFunction(dbConn);
                }
            }

            foreach (int CurPayPeriodID in payPeriodIDList)
            {
                DBFilter trialrunStatusEmpPayrollFilter = new DBFilter();
                trialrunStatusEmpPayrollFilter.add(new Match("EmpPayStatus", "T"));
                trialrunStatusEmpPayrollFilter.add(new Match("PayPeriodID", CurPayPeriodID));

                DBFilter confirmStatusEmpPayrollFilter = new DBFilter();
                confirmStatusEmpPayrollFilter.add(new Match("EmpPayStatus", "C"));
                confirmStatusEmpPayrollFilter.add(new Match("PayPeriodID", CurPayPeriodID));

                EPayrollPeriod payPeriod = new EPayrollPeriod();
                payPeriod.PayPeriodID = CurPayPeriodID;
                ArrayList trialrunStatusEmpPayrollList = EEmpPayroll.db.select(dbConn, trialrunStatusEmpPayrollFilter);
                ArrayList confirmStatusEmpPayrollList  = EEmpPayroll.db.select(dbConn, confirmStatusEmpPayrollFilter);
                if (trialrunStatusEmpPayrollList.Count == 0 && confirmStatusEmpPayrollList.Count == 0)
                {
                    payPeriod.PayPeriodStatus = EPayrollPeriod.PAYPERIOD_STATUS_NORMAL_FLAG;
                }
                else if (trialrunStatusEmpPayrollList.Count != 0)
                {
                    payPeriod.PayPeriodStatus = EPayrollPeriod.PAYPERIOD_STATUS_TRIALRUN_FLAG;
                }
                else if (confirmStatusEmpPayrollList.Count != 0)
                {
                    payPeriod.PayPeriodStatus = EPayrollPeriod.PAYPERIOD_STATUS_CONFIRM_FLAG;
                }

                payPeriod.PayPeriodRollbackDate = AppUtils.ServerDateTime();
                payPeriod.PayPeriodRollbackBy   = WebUtils.GetCurUser(Session).UserID;
                EPayrollPeriod.db.update(dbConn, payPeriod);
            }
            errors.addError("Stop Payment Successful");
        }
        loadData(info, EEmpPayroll.db, Repeater);
    }
コード例 #29
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList empList = new ArrayList();

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


        string   strEmpList          = string.Empty;
        string   strPayBatchList     = string.Empty;
        string   strPayPeriodRequest = string.Empty;
        DateTime dtPayPeriodFr       = new DateTime();
        DateTime dtPayPeriodTo       = new DateTime();

        if (empList.Count > 0)
        {
            foreach (EEmpPersonalInfo o in empList)
            {
                if (strEmpList == string.Empty)
                {
                    strEmpList = ((EEmpPersonalInfo)o).EmpID.ToString();
                }
                else
                {
                    strEmpList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString();
                }
            }
            if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo))
            {
                strPayPeriodRequest = "&PayPeriodFr=" + dtPayPeriodFr.Ticks + "&PayPeriodTo=" + dtPayPeriodTo.Ticks;
            }
            else
            {
                errors.addError("Invalid Date Format");
            }


            //            errors.addError("Complete");
            //Response.Write("<script>alert('Completed'); </script>");
        }
        else
        {
            errors.addError("Employee or Payroll Batch not selected");
        }

        if (errors.isEmpty())
        {
            GenericMPFFile mpfFileProcess = getMPFFileObject();
            if (mpfFileProcess == null)
            {
                errors.addError("Generate MPF File is not available for that MPF Scheme");
                return;
            }
            if (mpfFileProcess is HSBCMPFGatewayFileEncrypted)
            {
                string keyFolderPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BankKey");

                string keyPath             = string.Empty;
                string HSBCKeyFileName     = "HSBC.pub";
                string HangSengKeyFileName = "HASE.pub";
                string password            = "******";

                int intMPFPlanID = 0;

                if (int.TryParse(MPFPlanID.SelectedValue, 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"))
                            {
                                keyPath = System.IO.Path.Combine(keyFolderPath, HSBCKeyFileName);
                                if (Application["MasterDBConfig"] != null)
                                {
                                    DatabaseConnection masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject();
                                    string             HSBCKeyPath  = HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PATH);
                                    string             HSBCPassword = HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PASSWORD);
                                    if (!string.IsNullOrEmpty(HSBCKeyPath) && !string.IsNullOrEmpty(HSBCPassword))
                                    {
                                        keyPath  = HSBCKeyPath;
                                        password = HSBCPassword;
                                    }
                                }
                            }
                            else if (mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng"))
                            {
                                keyPath = System.IO.Path.Combine(keyFolderPath, HangSengKeyFileName);
                                if (Application["MasterDBConfig"] != null)
                                {
                                    DatabaseConnection masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject();
                                    string             HASEKeyPath  = HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HASE_PATH);
                                    string             HASEPassword = HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HASE_PASSWORD);
                                    if (!string.IsNullOrEmpty(HASEKeyPath) && !string.IsNullOrEmpty(HASEPassword))
                                    {
                                        keyPath  = HASEKeyPath;
                                        password = HASEPassword;
                                    }
                                }
                            }
                        }
                    }
                }

                HSBCMPFGatewayFileEncrypted mpfFileEncrypted = (HSBCMPFGatewayFileEncrypted)mpfFileProcess;

                mpfFileEncrypted.publicKeyFile     = keyPath;
                mpfFileEncrypted.publicKeyPassword = password;
            }

            HROneConfig config = HROneConfig.GetCurrentHROneConfig();
            if (config.GenerateReportAsInbox)
            {
                if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000)
                {
                    HROne.TaskService.GenerateMPFContributionFileTaskFactory reportTask = new HROne.TaskService.GenerateMPFContributionFileTaskFactory(dbConn, user, lblReportHeader.Text, mpfFileProcess, empList, int.Parse(MPFPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo, ci);
                    AppUtils.reportTaskQueueService.AddTask(reportTask);
                    errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX);
                }
                else
                {
                    errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED);
                }
            }
            else
            {
                try
                {
                    mpfFileProcess.LoadMPFFileDetail(empList, int.Parse(MPFPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo);
                    FileInfo mpfFileInfo = mpfFileProcess.GenerateMPFFile();

                    string mpfFilename = mpfFileProcess.ActualMPFFileName();
                    WebUtils.TransmitFile(Response, mpfFileInfo.FullName, mpfFilename, true);
                }
                catch (Exception ex)
                {
                    errors.addError(ex.Message);
                }
            }
        }
//        emploadData(empInfo, EEmpPayroll.db, empRepeater);
    }
コード例 #30
0
    protected void Save_Click(object sender, EventArgs e)
    {
        ECompanyBankAccount c = new ECompanyBankAccount();

        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 (c.CompanyBankAccountAccountNo.Length > 0)
        {
            if (!c.CompanyBankAccountBankCode.Equals("152") && !c.CompanyBankAccountBankCode.Equals("055"))
            {
                if (c.CompanyBankAccountAccountNo.Length > 9)
                {
                    errors.addError("CompanyBankAccountAccountNo", "validate.maxlength", 9);
                }
                long dummyValue;
                if (!long.TryParse(c.CompanyBankAccountAccountNo, out dummyValue))
                {
                    errors.addError("CompanyBankAccountAccountNo", "validate.int");
                }
            }
        }

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

        WebUtils.StartFunction(Session, FUNCTION_CODE);

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

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

        ArrayList selectedList   = new ArrayList();
        ArrayList unselectedList = new ArrayList();

        foreach (RepeaterItem i in companyRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            ECompany o  = new ECompany();
            WebFormUtils.GetKeys(ECompany.db, o, cb);
            if (cb.Checked)
            {
                selectedList.Add(o);
            }
            else
            {
                unselectedList.Add(o);
            }
        }
        foreach (ECompany o in selectedList)
        {
            DBFilter companyBankAccountMapFilter = new DBFilter();
            companyBankAccountMapFilter.add(new Match("CompanyID", o.CompanyID));
            companyBankAccountMapFilter.add(new Match("CompanyBankAccountID", CurID));
            ArrayList companyBankAccountMapList = ECompanyBankAccountMap.db.select(dbConn, companyBankAccountMapFilter);
            if (companyBankAccountMapList.Count == 0)
            {
                ECompanyBankAccountMap companyBankAccountMap = new ECompanyBankAccountMap();
                companyBankAccountMap.CompanyID            = o.CompanyID;
                companyBankAccountMap.CompanyBankAccountID = CurID;
                ECompanyBankAccountMap.db.insert(dbConn, companyBankAccountMap);
            }
        }

        foreach (ECompany o in unselectedList)
        {
            DBFilter companyBankAccountMapFilter = new DBFilter();
            companyBankAccountMapFilter.add(new Match("CompanyID", o.CompanyID));
            companyBankAccountMapFilter.add(new Match("CompanyBankAccountID", CurID));
            ArrayList companyBankAccountMapList = ECompanyBankAccountMap.db.select(dbConn, companyBankAccountMapFilter);
            if (companyBankAccountMapList.Count != 0)
            {
                foreach (ECompanyBankAccountMap companyBankAccountMap in companyBankAccountMapList)
                {
                    ECompanyBankAccountMap.db.delete(dbConn, companyBankAccountMap);
                }
            }
        }
        WebUtils.EndFunction(dbConn);
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "CompanyBankAccount_View.aspx?CompanyBankAccountID=" + CurID);
    }