Пример #1
0
    protected void Save_Click(object sender, EventArgs e)
    {
        EEmpDocument c = new EEmpDocument();

        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 (CurID < 0)
        {
            if (!UploadDocumentFile.HasFile)
            {
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_INVALID_FILE);
                return;
            }
            string errorMessage = string.Empty;
            if (HROne.CommonLib.FileIOProcess.IsFolderAllowWritePermission(uploadFolder, out errorMessage))
            {
                //            Utils.MarkCreate(Session, c);
                string uploadFullName = UploadToDocumentFolder();
                c.EmpDocumentOriginalFileName = UploadDocumentFile.FileName;
                c.EmpDocumentStoredFileName   = uploadFullName;
                c.EmpDocumentIsCompressed     = true;
                WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID);
                db.insert(dbConn, c);
                WebUtils.EndFunction(dbConn);
                CurID = c.EmpDocumentID;
            }
            else
            {
                errors.addError(errorMessage);
                return;
            }
            //            url = Utils.BuildURL(-1, CurID);
        }
        else
        {
            //            Utils.Mark(Session, c);
            WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID);
            db.update(dbConn, c);
            WebUtils.EndFunction(dbConn);
        }

        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Emp_Document_View.aspx?EmpDocumentID=" + CurID + "&EmpID=" + c.EmpID);
    }
Пример #2
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EAttendancePreparationProcess o = new EAttendancePreparationProcess();

        o.AttendancePreparationProcessID = CurID;

        if (db.select(dbConn, o))
        {
            if (o.AttendancePreparationProcessStatus != EAttendancePreparationProcess.STATUS_NORMAL)
            {
                errors.addError("Status must be Normal");
            }
            else
            {
                o.AttendancePreparationProcessStatus = EAttendancePreparationProcess.STATUS_CANCELLED;
                if (EAttendancePreparationProcess.db.update(dbConn, o))
                {
                    errors.addError("Update Completed");
                }
                else
                {
                    errors.addError("Update failed");
                }
            }
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Customize_AttendancePreparationProcess_List.aspx");
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        HSBCMRICommandLineDirectory = ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_HSBC_MRI_DIRECTORY);
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE))
        {
            return;
        }

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

        errors.clear();
        if (string.IsNullOrEmpty(HSBCMRICommandLineDirectory))
        {
            errors.addError("MRI Command Line Folder has not been set");
            Save.Visible = false;
        }
        else
        {
            string commandLinePath = System.IO.Path.Combine(HSBCMRICommandLineDirectory, "MRI2.exe");
            if (!System.IO.File.Exists(commandLinePath))
            {
                errors.addError("MRI2.exe does not exists on Command Line Folder");
                Save.Visible = false;
            }
            else
            {
                HROne.HSBC.Utility.HSBCMRICommandLineDirectory = HSBCMRICommandLineDirectory;
            }
        }
    }
    protected void btnRollback_Click(object sender, EventArgs e)
    {
        PageErrors pageErrors = PageErrors.getErrors(db, Page.Master);

        if (!IsValidRollbackKey(txtPassCode.Text))
        {
            pageErrors.addError("Incorrect pass code!");
            return;
        }
        else
        {
            PayrollProcess payrollProcess = new PayrollProcess(dbConn);
            WebUtils.StartFunction(Session, FUNCTION_CODE, true);
            payrollProcess.RollBackPayroll(CurPayPeriodID, WebUtils.GetCurUser(Session).UserID);
            WebUtils.EndFunction(dbConn);
            pageErrors.addError("Rollback Complete");
            binding.init(Request, Session);

            if (CurID > 0)
            {
                panelPayPeriod.Visible = true;
                loadObject();
            }
            else
            {
                panelPayPeriod.Visible      = false;
                panelRollbackOption.Visible = false;
            }
        }
        loadState();

        //        Response.Redirect(Request.Url.LocalPath + "?" + Request.QueryString);
    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

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

        foreach (EAttendanceFormula o in list)
        {
            if (EAttendanceFormula.db.select(dbConn, o))
            {
                DBFilter attendancePlanFilter = new DBFilter();
                attendancePlanFilter.add(new Match("AttendancePlanOTFormula", o.AttendanceFormulaID));
                attendancePlanFilter.add(new Match("AttendancePlanLateFormula", o.AttendanceFormulaID));
                ArrayList attendancePlanList = EAttendancePlan.db.select(dbConn, attendancePlanFilter);
                if (attendancePlanList.Count > 0)
                {
                    errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("AttendanceFormula Code"), o.AttendanceFormulaCode }));
                    foreach (EAttendancePlan attendancePlan in attendancePlanList)
                    {
                        errors.addError("- " + attendancePlan.AttendancePlanCode + ", " + attendancePlan.AttendancePlanDesc);
                    }
                    errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
                }
                else
                {
                    WebUtils.StartFunction(Session, FUNCTION_CODE);
                    db.delete(dbConn, o);
                    WebUtils.EndFunction(dbConn);
                }
            }
        }
        //loadData(info, db, Repeater);
    }
Пример #6
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

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

        foreach (EPayrollGroup o in list)
        {
            if (EPayrollGroup.db.select(dbConn, o))
            {
                DBFilter payPeriodFilter = new DBFilter();
                payPeriodFilter.add(new Match("PayGroupID", o.PayGroupID));
                DBFilter empPayrollFilter = new DBFilter();

                empPayrollFilter.add(new IN("PayPeriodID", "Select PayPeriodID from PayrollPeriod", payPeriodFilter));

                ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);
                if (empPayrollList.Count == 0)
                {
                    DBFilter empPosFilter = new DBFilter();
                    empPosFilter.add(new Match("PayGroupID", o.PayGroupID));
                    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("Payroll Group"), o.PayGroupCode }));
                        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
                    {
                        EPayrollPeriod.db.delete(dbConn, payPeriodFilter);
                        WebUtils.StartFunction(Session, FUNCTION_CODE);
                        EPayrollGroup.db.delete(dbConn, o);
                        WebUtils.EndFunction(dbConn);
                    }
                }
                else
                {
                    EPayrollGroup.db.select(dbConn, o);
                    errors.addError("Payroll Code '" + o.PayGroupCode + "' is in use. Action abort!");
                }
            }
        }
        loadData(info, db, Repeater);
    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

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

        foreach (EALProrataRoundingRule o in list)
        {
            db.select(dbConn, o);
            DBFilter leavePlanFilter = new DBFilter();
            leavePlanFilter.add(new Match("ALProrataRoundingRuleID", o.ALProrataRoundingRuleID));
            ArrayList leavePlanList = ELeavePlan.db.select(dbConn, leavePlanFilter);
            if (leavePlanList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_IS_IN_USE, new string[] { o.ALProrataRoundingRuleCode }));
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            }
            else
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, o);
                DBFilter obj = new DBFilter();
                obj.add(new Match("ALProrataRoundingRuleID", o.ALProrataRoundingRuleID));
                ArrayList objList = EALProrataRoundingRuleDetail.db.select(dbConn, obj);
                foreach (EALProrataRoundingRuleDetail match in objList)
                {
                    EALProrataRoundingRuleDetail.db.delete(dbConn, match);
                }
                WebUtils.EndFunction(dbConn);
            }
        }
        loadData(info, db, Repeater);
    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EAttendanceFormula c = new EAttendanceFormula();

        c.AttendanceFormulaID = CurID;
        if (EAttendanceFormula.db.select(dbConn, c))
        {
            DBFilter attendancePlanFilter = new DBFilter();
            attendancePlanFilter.add(new Match("AttendancePlanOTFormula", c.AttendanceFormulaID));
            attendancePlanFilter.add(new Match("AttendancePlanLateFormula", c.AttendanceFormulaID));
            ArrayList attendancePlanList = EAttendancePlan.db.select(dbConn, attendancePlanFilter);
            if (attendancePlanList.Count > 0)
            {
                errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("AttendanceFormula Code"), c.AttendanceFormulaCode }));
                foreach (EAttendancePlan attendancePlan in attendancePlanList)
                {
                    errors.addError("- " + attendancePlan.AttendancePlanCode + ", " + attendancePlan.AttendancePlanDesc);
                }
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
                return;
            }
            else
            {
                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, c);
                WebUtils.EndFunction(dbConn);
            }
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Attendance_Formula_List.aspx");
    }
Пример #9
0
    protected void btnDisplay_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        if (!cbxClaimsAndDeduction.Checked && !cbxRecurringPayment.Checked && !cbxYearEndBonus.Checked && !cbxAdditionalRemuneration.Checked)
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_REC_CND_NOT_SELECT);
        }

        if (!cbxExistingEE.Checked && !cbxNewJoinEE.Checked && !cbxFinalPayment.Checked)
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_EMP_TYPE_NOT_SELECT);
        }

        if (errors.isEmpty())
        {
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_TrialRun_List.aspx?PayPeriodID=" + CurPayPeriodID
                                                                        + "&RecurringPayment=" + (this.cbxRecurringPayment.Checked ? "1" : "0")
                                                                        + "&ClaimsAndDeduction=" + (this.cbxClaimsAndDeduction.Checked ? "1" : "0")
                                                                        + "&AdditionalRemuneration=" + (this.cbxAdditionalRemuneration.Checked ? "1" : "0")
                                                                        + "&YearEndBonus=" + (this.cbxYearEndBonus.Checked ? "1" : "0")
                                                                        + "&ExistingEmployee=" + (this.cbxExistingEE.Checked ? "1" : "0")
                                                                        + "&NewJoin=" + (this.cbxNewJoinEE.Checked ? "1" : "0")
                                                                        + "&FinalPayment=" + (this.cbxFinalPayment.Checked ? "1" : "0")
                                                                        );
        }
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();



        int m_Year  = 0;
        int m_Month = 0;

        if (!int.TryParse(Year.Text, out m_Year) || !int.TryParse(Month.SelectedValue, out m_Month))
        {
            errors.addError("Invalid Year/Month");
        }

        if (m_Year < 1900)
        {
            errors.addError("Invalid Year");
        }

        if (errors.isEmpty())
        {
            ArrayList list = new ArrayList();
            list = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, empRepeater, "ItemSelect");

            if (list.Count > 0)
            {
                GenerateRosterTableData(list, m_Year, m_Month);
            }
        }
        emploadData(empInfo, db, empRepeater);
    }
Пример #11
0
    protected void btnPrint_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        int taxFormID;

        if (!int.TryParse(TaxFormID.SelectedValue, out taxFormID))
        {
            errors.addError("Year Return is not selected");
        }
        else if (taxFormID <= 0)
        {
            errors.addError("Year Return is not selected");
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Taxation.ControlListProcess rpt = new HROne.Reports.Taxation.ControlListProcess(dbConn, taxFormID, txtNameOfSignature.Text);
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Taxation_ControlList.rpt"));
            WebUtils.ReportExport(dbConn, user, errors, btnPrint.Text, Response, rpt, reportFileName, "PDF", "TaxControlList", false);


            //Session.Add("NameOfSignature", txtNameOfSignature.Text);
            //Response.Write("<Script language='Javascript'>");
            //Response.Write("window.open('"
            //    + "Report_Taxation_ControlList_View.aspx?"
            //    + "TaxFormID=" + CurrentTaxFormID
            //    + "','_blank','toolbar=no, location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no, resizable=yes')");
            //Response.Write("</Script>");
        }
    }
Пример #12
0
    protected void btnTestEmail_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();
        int    port;
        string password;

        if (!txtPARAM_CODE_SMTP_PASSWORD.Text.Equals(PASSWORD_NO_CHANGE_KEYWORD))
        {
            password = txtPARAM_CODE_SMTP_PASSWORD.Text;
            txtPARAM_CODE_SMTP_PASSWORD.Attributes.Add("value", password);//ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_SMTP_PASSWORD);
        }
        else
        {
            password = ESystemParameter.getParameterWithEncryption(dbConn, ESystemParameter.PARAM_CODE_SMTP_PASSWORD);
        }


        if (!int.TryParse(txtPARAM_CODE_SMTP_PORT.Text, out port))
        {
            port = 0;
        }

        try
        {
            AppUtils.TestSendEmail(this.txtPARAM_CODE_SMTP_SERVER_NAME.Text, port, txtPARAM_CODE_SMTP_USERNAME.Text, password, txtPARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS.Text, txtTestEmailAddress.Text, chkPARAM_CODE_SMTP_ENABLE_SSL.Checked);
        }
        catch (Exception ex)
        {
            errors.addError(ex.Message.Replace("\r\n", " "));
            return;
        }
        errors.addError(HROne.Common.WebUtility.GetLocalizedString("Test Email has been sent. Please check email box."));
    }
Пример #13
0
    private void ValidateData(ETaxEmpPlaceOfResidence obj, PageErrors errors)
    {
        DBFilter overlapCheckingFilter = new DBFilter();

        overlapCheckingFilter.add(new Match("TaxEmpID", obj.TaxEmpID));
        if (obj.TaxEmpPlaceID > 0)
        {
            overlapCheckingFilter.add(new Match("TaxEmpPlaceID", "<>", obj.TaxEmpPlaceID));
        }
        overlapCheckingFilter.add(new Match("TaxEmpPlacePeriodTo", ">=", obj.TaxEmpPlacePeriodFr));
        overlapCheckingFilter.add(new Match("TaxEmpPlacePeriodFr", "<=", obj.TaxEmpPlacePeriodTo));

        if (ETaxEmpPlaceOfResidence.db.count(dbConn, overlapCheckingFilter) > 0)
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE);
        }
        else
        {
            if (obj.TaxEmpPlacePeriodFr > obj.TaxEmpPlacePeriodTo)
            {
                errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE);
                return;
            }
            ETaxEmp taxEmp = new ETaxEmp();
            taxEmp.TaxEmpID = obj.TaxEmpID;
            if (ETaxEmp.db.select(dbConn, taxEmp))
            {
                if (taxEmp.TaxEmpStartDate > obj.TaxEmpPlacePeriodFr || taxEmp.TaxEmpEndDate < obj.TaxEmpPlacePeriodTo)
                {
                    errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE);
                }
            }
        }
    }
    protected void btnExport_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        DateTime m_paymentDate = new DateTime();

        if (PaymentDate.Value == "" || !(DateTime.TryParse(PaymentDate.Value, out m_paymentDate)))
        {
            errors.addError("Please provide a Payment Date");
            return;
        }

        int m_batchID = -1;

        if (!int.TryParse(BatchID.SelectedValue, out m_batchID))
        {
            errors.addError("Please select a Import Batch");
            return;
        }

        DataSet dataSet = GenerateCND(m_batchID, m_paymentDate);

        string exportFileName = System.IO.Path.GetTempFileName();

        System.IO.File.Delete(exportFileName);
        exportFileName += ".xls";
        HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName);
        export.Update(dataSet);
        WebUtils.TransmitFile(Response, exportFileName, "CND_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true);
    }
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        DateTime dtEmpDateOfJoinFrom = new DateTime(), dtEmpDateOfJoinTo = new DateTime();

        if (!DateTime.TryParse(EmpDateOfJoinFrom.Value, out dtEmpDateOfJoinFrom) || !DateTime.TryParse(EmpDateOfJoinTo.Value, out dtEmpDateOfJoinTo))
        {
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_FIELD_REQUIRED, new string[] { ProbationLastDateRangeHeader.Text }));
        }


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

        if (empList.Count <= 0)
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_NO_EMPLOYEE_SELECTED);
        }

        if (errors.isEmpty())
        {
            HROne.Reports.Employee.EmployeeNewJoinListProcess rpt = new HROne.Reports.Employee.EmployeeNewJoinListProcess(dbConn, empList, dtEmpDateOfJoinFrom, dtEmpDateOfJoinTo);
            string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_NewJoinList.rpt"));
            //WebUtils.RegisterReportExport(this, rpt, reportFileName, ((Button)sender).CommandArgument, "NewJoin", true);
            WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "NewJoin", true);
            //Server.Transfer("Report_Employee_TerminationList_View.aspx?"
            //+ "EmpTermID=" + strTermEmpList
            //);
        }
        //        emploadData(empInfo, EEmpPayroll.db, empRepeater);
    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ERosterClientSite o = new ERosterClientSite();

        o.RosterClientSiteID = CurID;
        db.select(dbConn, o);
        DBFilter rosterCodeFilter = new DBFilter();

        rosterCodeFilter.add(new Match("RosterClientSiteID", o.RosterClientSiteID));
        ArrayList RosterClientSiteSiteList = ERosterCode.db.select(dbConn, rosterCodeFilter);

        if (RosterClientSiteSiteList.Count > 0)
        {
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_IS_IN_USE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Roster Client Code"), o.RosterClientSiteCode }));
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return;
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, o);
            WebUtils.EndFunction(dbConn);
        }

        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Attendance_RosterClient_VIew.aspx?RosterClientID=" + RosterClientID.Value);
    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EBonusProcess o = new EBonusProcess();

        o.BonusProcessID = CurID;

        if (db.select(dbConn, o))
        {
            if (o.BonusProcessStatus != EBonusProcess.STATUS_NORMAL)
            {
                errors.addError("Bonus Process remove failed.  Status is not " + EBonusProcess.STATUS_NORMAL_DESC);
            }
            else
            {
                DBFilter m_filter = new DBFilter();
                m_filter.add(new Match("BonusProcessID", CurID));
                EEmpBonusProcess.db.delete(dbConn, m_filter);
                if (EBonusProcess.db.delete(dbConn, m_filter))
                {
                    errors.addError("Bonus Process removed");
                    HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_BonusProcess_List.aspx");
                }
                else
                {
                    errors.addError("Bonus Process remove failed.");
                }
            }
        }
    }
Пример #18
0
    protected void LeaveReject_Click(object sender, EventArgs e)
    {
        DBFilter   RequestFilter = new DBFilter();
        PageErrors errors        = PageErrors.getErrors(db, Page.Master);;

        errors.clear();

        RequestFilter.add(new Match("EmpRequestRecordID", CurRequestID));
        RequestFilter.add(new Match("EmpRequestType", EEmpRequest.TYPE_EELEAVEAPP));
        ArrayList RequestList = EEmpRequest.db.select(dbConn, RequestFilter);

        if (RequestList.Count > 0)
        {
            EEmpRequest empRequest = (EEmpRequest)RequestList[0];
            empRequest.EmpRequestRejectReason = RejectReason.Text;
            try
            {
                ESSAuthorizationProcess authorization = new ESSAuthorizationProcess(dbConn);
                authorization.RejectLeaveApplication(empRequest, UserID);
                HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/ESS_EmpSupervisorApproval.aspx");
            }
            catch (Exception ex)
            {
                errors.addError(ex.Message);
            }
        }
        else
        {
            errors.addError("Request Cancel due to no permission!");
        }
    }
Пример #19
0
    protected void Upload_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        if (bankFileCutOffDateTime < currentDateTime)
        {
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_SAAS_FILE_SUBMIT_AFTER_CUTOFF, new string[] { bankFileCutOffDateTime.ToString("HH:mm") }));
            return;
        }

        if (BankFileUpload.HasFile)
        {
            //DataTable dataTable = HROne.CSVProcess.CSVReader.parse(CNDImportFile.PostedFile.InputStream);
            string strTmpFolder = HROne.Common.Folder.GetOrCreateSessionTempFolder(Session.SessionID).FullName;;  //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
            string strTmpFile   = System.IO.Path.Combine(strTmpFolder, currentDateTime.ToString("~yyyyMMddHHmmss_") + BankFileUpload.FileName);
            BankFileUpload.SaveAs(strTmpFile);

            try
            {
                UploadToMasterDB(strTmpFile);
            }
            catch (Exception ex)
            {
                System.IO.File.Delete(strTmpFile);
                errors.addError(ex.Message);
            }
        }
        else
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_INVALID_FILE);
        }
    }
    protected void Upload_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(null, Page.Master);

        errors.clear();

        if (ImportFile.HasFile)
        {
            //DataTable dataTable = HROne.CSVProcess.CSVReader.parse(CNDImportFile.PostedFile.InputStream);
            string strTmpFolder = HROne.Common.Folder.GetOrCreateSessionTempFolder(Session.SessionID).FullName;;  //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
            string strTmpFile   = System.IO.Path.Combine(strTmpFolder, AppUtils.ServerDateTime().ToString("~yyyyMMddHHmmss_") + ImportFile.FileName);
            ImportFile.SaveAs(strTmpFile);

            ImportTimeCardRecordProcess timeCardRecordImport = new ImportTimeCardRecordProcess(dbConn, Session.SessionID);
            timeCardRecordImport.DateSequence  = this.Attendance_ImportFormatParameterControl1.DateSequence;
            timeCardRecordImport.DateSeparator = this.Attendance_ImportFormatParameterControl1.DateSeparator;
            timeCardRecordImport.YearFormat    = this.Attendance_ImportFormatParameterControl1.YearFormat;
            timeCardRecordImport.TimeSeparator = this.Attendance_ImportFormatParameterControl1.TimeSeparator;

            timeCardRecordImport.DateColumnIndex        = this.Attendance_ImportFormatParameterControl1.DateColumnIndex;
            timeCardRecordImport.TimeColumnIndex        = this.Attendance_ImportFormatParameterControl1.TimeColumnIndex;
            timeCardRecordImport.DateColumnIndex2       = this.Attendance_ImportFormatParameterControl1.DateColumnIndex2;
            timeCardRecordImport.TimeColumnIndex2       = this.Attendance_ImportFormatParameterControl1.TimeColumnIndex2;
            timeCardRecordImport.LocationColumnIndex    = this.Attendance_ImportFormatParameterControl1.LocationColumnIndex;
            timeCardRecordImport.TimeCardNumColumnIndex = this.Attendance_ImportFormatParameterControl1.TimeCardNumColumnIndex;

            timeCardRecordImport.ColumnDelimiter = this.Attendance_ImportFormatParameterControl1.ColumnDelimiter;

            timeCardRecordImport.UploadFileHasHeader = this.Attendance_ImportFormatParameterControl1.UploadFileHasHeader;
            //DataTable dataTable = HROne.Import.ExcelImport.parse(strTmpFile);
            //using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\csv\;Extended Properties='Text;'"))
            try
            {
                timeCardRecordImport.UploadToTempDatabase(strTmpFile, WebUtils.GetCurUser(Session).UserID, string.Empty);
                timeCardRecordImport.ImportToDatabase();
                errors.addError(HROne.Translation.PageMessage.IMPORT_SUCCESSFUL);
                Attendance_ImportFormatParameterControl1.SaveSettings();
            }
            catch (HRImportException ex)
            {
                if (timeCardRecordImport.errors.List.Count > 0)
                {
                    foreach (string errorString in timeCardRecordImport.errors.List)
                    {
                        errors.addError(errorString);
                    }
                }
                else
                {
                    errors.addError(ex.Message);
                }
            }
            System.IO.File.Delete(strTmpFile);
        }
        else
        {
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_INVALID_FILE);
        }
    }
Пример #21
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, AVCPlanDetaildb, Repeater);

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

    //}
    protected void Add_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(ALProrataRoundingRuleDetaildb, Page);

        errors.clear();

        Repeater.EditItemIndex = -1;
        EALProrataRoundingRuleDetail c = new EALProrataRoundingRuleDetail();

        Hashtable values = new Hashtable();

        ALProrataRoundingRuleDetailbinding.toValues(values);
        ALProrataRoundingRuleDetaildb.validate(errors, values);

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


        ALProrataRoundingRuleDetaildb.parse(values, c);

        //if (!AppUtils.checkDuplicate(dbConn, AVCPlanDetaildb, c, errors, "AVCPlanDetailYearOfService"))
        //    return;

        if (c.ALProrataRoundingRuleDetailRangeTo > 1 || c.ALProrataRoundingRuleDetailRangeTo < 0)
        {
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_NUMBR_RANGE, new string[] { "0", "1" }));
            ALProrataRoundingRuleDetailRangeTo.Focus();
            return;
        }

        if (c.ALProrataRoundingRuleDetailRoundTo > 1 || c.ALProrataRoundingRuleDetailRoundTo < 0)
        {
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_NUMBR_RANGE, new string[] { "0", "1" }));
            ALProrataRoundingRuleDetailRoundTo.Focus();
            return;
        }

        AND andALProrataRoundingRuleDetailTerm = new AND();

        andALProrataRoundingRuleDetailTerm.add(new Match("ALProrataRoundingRuleID", c.ALProrataRoundingRuleID));
        AppUtils.checkDuplicate(dbConn, ALProrataRoundingRuleDetaildb, c, errors, "ALProrataRoundingRuleDetailRangeTo", andALProrataRoundingRuleDetailTerm);

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

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

        ALProrataRoundingRuleDetailRangeTo.Text = string.Empty;
        ALProrataRoundingRuleDetailRoundTo.Text = string.Empty;

        view = loadData(info, ALProrataRoundingRuleDetaildb, Repeater);
    }
Пример #22
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);
    }
Пример #23
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();
            }
        }
    }
    protected void btnExport_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

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

        string       m_schemeCode    = "";
        string       m_paymentCode   = "";
        int          m_paymentCodeID = -1;
        DateTime     m_paymentDate   = new DateTime();
        EPaymentCode m_paymentCodeObj;

        if (SchemeCode.SelectedIndex > 0)
        {
            m_schemeCode = SchemeCode.SelectedValue;
        }

        if (BackpayDate.Value != "")
        {
            m_paymentDate = DateTime.Parse(BackpayDate.Value);
        }
        else
        {
            errors.addError("Please provide a Backpay Payment Date");
            return;
        }

        if (PaymentCode.SelectedIndex > 0)
        {
            m_paymentCode    = PaymentCode.SelectedValue;
            m_paymentCodeObj = EPaymentCode.GetObject(dbConn, m_paymentCode.Substring(0, m_paymentCode.IndexOf("-")).Trim());

            if (m_paymentCodeObj == null)
            {
                errors.addError("Cannot resolve Backpay Payment Code");
                return;
            }
        }
        else
        {
            errors.addError("Pelase select a Backpay Payment Code");
            return;
        }

        DataSet dataSet = GenerateBackpayTemplate(m_schemeCode, m_paymentCodeObj.PaymentCodeID, m_paymentDate);

        string exportFileName = System.IO.Path.GetTempFileName();

        System.IO.File.Delete(exportFileName);
        exportFileName += ".xls";
        HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName);
        export.Update(dataSet);
        WebUtils.TransmitFile(Response, exportFileName, "BackpayCND_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true);
    }
Пример #25
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ERosterCode o = new ERosterCode();

        o.RosterCodeID = CurID;
        db.select(dbConn, o);
        DBFilter rosterTableFilter = new DBFilter();

        rosterTableFilter.add(new Match("RosterCodeID", o.RosterCodeID));
        rosterTableFilter.add("empid", true);
        ArrayList empRosterTableList = ERosterTable.db.select(dbConn, rosterTableFilter);

        if (empRosterTableList.Count > 0)
        {
            int curEmpID = 0;
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("AVC Plan Code"), o.RosterCode }));
            foreach (ERosterTable empRosterTable in empRosterTableList)
            {
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = empRosterTable.EmpID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    if (curEmpID != empRosterTable.EmpID)
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        curEmpID = empRosterTable.EmpID;
                    }
                    else
                    {
                        ERosterTable.db.delete(dbConn, empRosterTable);
                    }
                }
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return;
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, o);
            WebUtils.EndFunction(dbConn);

            DBFilter obj = new DBFilter();
            obj.add(new Match("RosterCodeID", CurID));
            ArrayList objList = ERosterCodeDetail.db.select(dbConn, obj);
            foreach (ERosterCodeDetail match in objList)
            {
                ERosterCodeDetail.db.delete(dbConn, match);
            }
        }

        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "RosterCode_List.aspx");
    }
Пример #26
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

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

        foreach (EORSOPlan o in list)
        {
            if (db.select(dbConn, o))
            {
                DBFilter empORSOFilter = new DBFilter();
                empORSOFilter.add(new Match("ORSOPlanID", o.ORSOPlanID));
                empORSOFilter.add("empid", true);
                ArrayList empORSOList = EEmpORSOPlan.db.select(dbConn, empORSOFilter);
                if (empORSOList.Count > 0)
                {
                    int curEmpID = 0;
                    errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("P-Fund Plan Code"), o.ORSOPlanCode }));
                    foreach (EEmpORSOPlan empORSOPlan in empORSOList)
                    {
                        EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                        empInfo.EmpID = empORSOPlan.EmpID;
                        if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                        {
                            if (curEmpID != empORSOPlan.EmpID)
                            {
                                errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                                curEmpID = empORSOPlan.EmpID;
                            }
                            else
                            {
                                EEmpORSOPlan.db.delete(dbConn, empORSOPlan);
                            }
                        }
                    }
                    errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
                }
                else
                {
                    WebUtils.StartFunction(Session, FUNCTION_CODE);
                    db.delete(dbConn, o);
                    DBFilter obj = new DBFilter();
                    obj.add(new Match("ORSOPlanID", o.ORSOPlanID));
                    ArrayList objList = EORSOPlanDetail.db.select(dbConn, obj);
                    foreach (EORSOPlanDetail match in objList)
                    {
                        EORSOPlanDetail.db.delete(dbConn, match);
                    }
                    WebUtils.EndFunction(dbConn);
                }
            }
        }
        loadData(info, db, Repeater);
    }
Пример #27
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (DataListItem item in Repeater.Items)
        {
            CheckBox        c = (CheckBox)item.FindControl("DeleteItem");
            HtmlInputHidden h = (HtmlInputHidden)item.FindControl("RankID");
            if (c.Checked)
            {
                ERank obj = new ERank();
                obj.RankID = Int32.Parse(h.Value);
                list.Add(obj);
            }
        }
        foreach (ERank obj in list)
        {
            db.select(dbConn, obj);
            DBFilter empPosFilter = new DBFilter();
            empPosFilter.add(new Match("RankID", obj.RankID));
            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("Rank Code"), obj.RankCode }));
                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);
                view = loadData(info, db, Repeater);
                return;
            }
            else
            {
                EUserRank.DeleteRankForAllUsers(dbConn, obj.RankID);
                WebUtils.StartFunction(Session, FUNCTION_CODE);
                db.delete(dbConn, obj);
                WebUtils.EndFunction(dbConn);
            }
        }
        view = loadData(info, db, Repeater);
    }
Пример #28
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        ELeaveType obj = new ELeaveType();

        obj.LeaveTypeID = CurID;
        db.select(dbConn, obj);

        DBFilter leaveCodeFilter = new DBFilter();

        leaveCodeFilter.add(new Match("LeaveTypeID", obj.LeaveTypeID));

        DBFilter leaveApplicationFilter = new DBFilter();

        leaveApplicationFilter.add(new IN("LeaveCodeID", "Select LeaveCodeID from " + ELeaveCode.db.dbclass.tableName, leaveCodeFilter));
        leaveApplicationFilter.add("empid", true);
        ArrayList leaveApplicationList = ELeaveApplication.db.select(dbConn, leaveApplicationFilter);

        if (leaveApplicationList.Count > 0)
        {
            int curEmpID = 0;
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Leave Type"), obj.LeaveType }));
            foreach (ELeaveApplication leaveApplication in leaveApplicationList)
            {
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = leaveApplication.EmpID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    if (curEmpID != leaveApplication.EmpID)
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        curEmpID = leaveApplication.EmpID;
                    }
                }
                else
                {
                    ELeaveApplication.db.delete(dbConn, leaveApplication);
                }
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return;
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            ELeaveCode.db.delete(dbConn, leaveCodeFilter);
            ELeavePlanEntitle.db.delete(dbConn, leaveCodeFilter);
            db.delete(dbConn, obj);
            WebUtils.EndFunction(dbConn);
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "LeaveType_List.aspx");
    }
Пример #29
0
//    protected void Save_Click(object sender, EventArgs e)
//    {
//        EPaymentCode c = new EPaymentCode();

//        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, "PaymentCode"))
//            return;

//        WebUtils.StartFunction(Session, FUNCTION_CODE);

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

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

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


//    }
    protected void Delete_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EPaymentCode obj = new EPaymentCode();

        obj.PaymentCodeID = CurID;

        db.select(dbConn, obj);

        DBFilter paymentRecordFilter = new DBFilter();

        paymentRecordFilter.add(new Match("PaymentCodeID", obj.PaymentCodeID));

        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)
        {
            int lastEmpID = 0;
            errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Payment Code"), obj.PaymentCode }));
            foreach (EEmpPayroll empPayroll in empPayrollList)
            {
                if (lastEmpID != empPayroll.EmpID)
                {
                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = empPayroll.EmpID;
                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        lastEmpID = empPayroll.EmpID;
                    }
                    else
                    {
                        EEmpPayroll.db.delete(dbConn, empPayroll);
                    }
                }
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
        }
        else
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, obj);
            WebUtils.EndFunction(dbConn);
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "PaymentCode_List.aspx");
        }
    }
Пример #30
0
    protected void Undo_Click(object sender, EventArgs e)
    {
        DBFilter filter = sbinding.createFilter();

        filter.add("EmpID", true);
        filter.add(new IN("PayRecID", "Select PayRecID from " + EPaymentRecord.db.dbclass.tableName + " pr", new DBFilter()));

        ArrayList CNDList = EClaimsAndDeductions.db.select(dbConn, filter);

        if (CNDList.Count > 0)
        {
            PageErrors errors = PageErrors.getErrors(db, Page.Master);
            errors.clear();

            int curEmpID = 0;
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_CND_IMPORT_BATCH_PAYROLL_PROCESSING);
            foreach (EClaimsAndDeductions CND in CNDList)
            {
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = CND.EmpID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    if (curEmpID != CND.EmpID)
                    {
                        errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName);
                        curEmpID = CND.EmpID;
                    }
                }
            }
            errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT);
            return;
        }
        else
        {
            CNDList = EClaimsAndDeductions.db.select(dbConn, sbinding.createFilter());


            WebUtils.StartFunction(Session, FUNCTION_CODE);
            foreach (EClaimsAndDeductions CND in CNDList)
            {
                db.delete(dbConn, CND);
            }
            EClaimsAndDeductionsImportBatch batch = new EClaimsAndDeductionsImportBatch();
            batch.CNDImportBatchID = CurID;
            if (EClaimsAndDeductionsImportBatch.db.select(dbConn, batch))
            {
                EClaimsAndDeductionsImportBatch.db.delete(dbConn, batch);
            }
            WebUtils.EndFunction(dbConn);

            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_CND_Import_History.aspx");
        }
    }