private void SaveSequenceNo(int NewSequenceNo) { EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = MPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { System.Xml.XmlDocument xmlDoc = HROne.CommonLib.Utility.GetXmlDocumentByDataString(mpfPlan.MPFPlanExtendData); System.Xml.XmlNodeList nodeList = xmlDoc.GetElementsByTagName(MPF_PLAN_XML_SEQUENCE_NODE_NAME); System.Xml.XmlNode node; if (nodeList.Count > 0) { node = nodeList[0]; } else { node = xmlDoc.CreateElement(MPF_PLAN_XML_SEQUENCE_NODE_NAME); xmlDoc.DocumentElement.AppendChild(node); } node.InnerText = NewSequenceNo.ToString(); mpfPlan.MPFPlanExtendData = xmlDoc.InnerXml; EMPFPlan.db.update(dbConn, mpfPlan); } }
public HSBCMPFGatewayFileEncryptedCoverProcess(DatabaseConnection dbConn, HSBCMPFGatewayFileEncrypted resultBankFileObject) : base(dbConn) { EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = resultBankFileObject.MPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { //System.Xml.XmlDocument extendPropertiesDocument = HROne.CommonLib.Utility.GetXmlDocumentByDataString(resultBankFileObject.MPFPlanExtendXMLString); dataSet = new HROne.MPFFile.DataSet.HSBCCoverDataSet(); DataSet.HSBCCoverDataSet.mpfcoverRow row = dataSet.mpfcover.NewmpfcoverRow(); row.ContributionPeriod = resultBankFileObject.PayPeriodFr.ToString("dd/MM/yyyy") + " - " + resultBankFileObject.PayPeriodTo.ToString("dd/MM/yyyy"); row.EmployerAddress = mpfPlan.MPFPlanCompanyAddress; row.ER_ID = resultBankFileObject.EmployerID; row.ER_NAME = mpfPlan.MPFPlanCompanyName; row.FILE_NAME = resultBankFileObject.ActualMPFFileName(); row.PayCenterCode = resultBankFileObject.PayCenterCode; row.BankKeyID = resultBankFileObject.KeyID; row.ContactName = mpfPlan.MPFPlanContactName; row.ContactPhoneNumber = mpfPlan.MPFPlanContactNo; row.ProductVersion = resultBankFileObject.ProductAndVersion; row.RemoteProfileID = resultBankFileObject.RemoteProfileID; dataSet.mpfcover.Rows.Add(row); } }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EMPFPlan o = new EMPFPlan(); o.MPFPlanID = CurID; db.select(dbConn, o); DBFilter empMPFFilter = new DBFilter(); empMPFFilter.add(new Match("MPFPlanID", o.MPFPlanID)); empMPFFilter.add("empid", true); ArrayList empMPFList = EEmpMPFPlan.db.select(dbConn, empMPFFilter); if (empMPFList.Count > 0) { int curEmpID = 0; errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("MPF Plan Code"), o.MPFPlanCode })); foreach (EEmpMPFPlan empMPFPlan in empMPFList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empMPFPlan.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { if (curEmpID != empMPFPlan.EmpID) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); curEmpID = empMPFPlan.EmpID; } else { EEmpMPFPlan.db.delete(dbConn, empMPFPlan); } } } 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, "MPFPlan_List.aspx"); }
protected void Page_PreRender(object sender, EventArgs e) { BOCIAVCPanel.Visible = false; DBFilter empMPFPlanFilter = new DBFilter(); empMPFPlanFilter.add(new Match("EmpID", CurEmpID)); empMPFPlanFilter.add("EmpMPFEffFr", false); DateTime dateFrom = new DateTime(); if (DateTime.TryParse(EmpAVCEffFr.Value, out dateFrom)) { empMPFPlanFilter.add(new Match("EmpMPFEffFr", "<=", dateFrom)); } ArrayList empMPFPlanList = EEmpMPFPlan.db.select(dbConn, empMPFPlanFilter); EMPFPlan mpfPlan = new EMPFPlan(); if (empMPFPlanList.Count > 0) { EEmpMPFPlan empMPFPlan = (EEmpMPFPlan)empMPFPlanList[0]; mpfPlan.MPFPlanID = empMPFPlan.MPFPlanID; } else if (!DefaultMPFPlanID.SelectedValue.Equals(string.Empty)) { mpfPlan.MPFPlanID = int.Parse(DefaultMPFPlanID.SelectedValue); } if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("BOCI")) { BOCIAVCPanel.Visible = true; } else { BOCIAVCPanel.Visible = false; } } } }
protected bool loadObject() { obj = new EMPFPlan(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); if (!db.select(dbConn, obj)) { return(false); } if (string.IsNullOrEmpty(obj.MPFPlanEmployerRoundingRule) && string.IsNullOrEmpty(obj.MPFPlanEmployeeRoundingRule)) { obj.MPFPlanEmployerRoundingRule = Values.ROUNDING_RULE_ROUND_TO; obj.MPFPlanEmployerDecimalPlace = 2; obj.MPFPlanEmployeeRoundingRule = Values.ROUNDING_RULE_ROUND_TO; obj.MPFPlanEmployeeDecimalPlace = 2; } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); return(true); }
protected bool loadObject() { obj = new EEmpMPFPlan(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); DBFilter filter = new DBFilter(); filter.add(new Match("EmpID", CurEmpID)); filter.add(WebUtils.AddRankFilter(Session, "EmpID", true)); if (EEmpPersonalInfo.db.count(dbConn, filter) == 0) { if (CurEmpID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } if (!db.select(dbConn, obj)) { if (CurID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } if (obj.EmpID != CurEmpID) { if (CurID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); HSBCMPFPanel.Visible = false; AIAMPFPanel.Visible = false; SCBMPFPanel.Visible = false; EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = obj.MPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("HSBC") || mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng") ) { HSBCMPFPanel.Visible = true; } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("AIA")) { AIAMPFPanel.Visible = true; } else if (mpfScheme.MPFSchemeCode.Equals("MT00415") || mpfScheme.MPFSchemeCode.Equals("MT00423")) { SCBMPFPanel.Visible = true; } } } return(true); }
public static string GetValueFromID(DatabaseConnection dbConn, string fieldName, string fieldValue) { try { string tmpfieldName = fieldName; if (tmpfieldName.Equals("PreviousEmpID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("NewEmpID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "EmpID"; } if (tmpfieldName.EndsWith("PaymentCodeID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.EndsWith("PayCodeID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PaymentCodeID"; } if (tmpfieldName.Equals("DefaultMPFPlanID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "MPFPlanID"; } if (tmpfieldName.Equals("AttendanceFormulaPayFormID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("ReferencePayFormID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayFormID"; } if (tmpfieldName.StartsWith("LeaveCode", StringComparison.CurrentCultureIgnoreCase) && tmpfieldName.EndsWith("Formula", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayFormID"; } if (tmpfieldName.StartsWith("PayGroup", StringComparison.CurrentCultureIgnoreCase) && tmpfieldName.EndsWith("Formula", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayFormID"; } if (tmpfieldName.Equals("CurrentPayPeriodID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayPeriodID"; } if (tmpfieldName.Equals("EmpPosDefaultRosterCodeID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "RosterCodeID"; } if (tmpfieldName.Equals("RosterClientMappingSiteCodeToHLevelID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "HLevelID"; } if (tmpfieldName.Equals("EmpFirstAuthorizationGp", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("EmpSecondAuthorizationGp", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "AuthorizationGroupID"; } if (tmpfieldName.StartsWith("A", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("ALProrataRoundingRuleID", StringComparison.CurrentCultureIgnoreCase)) { EALProrataRoundingRule obj = new EALProrataRoundingRule(); obj.ALProrataRoundingRuleID = int.Parse(fieldValue); if (EALProrataRoundingRule.db.select(dbConn, obj)) { return(obj.ALProrataRoundingRuleCode + " - " + obj.ALProrataRoundingRuleDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("AttendancePlanID", StringComparison.CurrentCultureIgnoreCase)) { EAttendancePlan obj = new EAttendancePlan(); obj.AttendancePlanID = int.Parse(fieldValue); if (EAttendancePlan.db.select(dbConn, obj)) { return(obj.AttendancePlanCode + " - " + obj.AttendancePlanDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("AuthorizationGroupID", StringComparison.CurrentCultureIgnoreCase)) { EAuthorizationGroup obj = new EAuthorizationGroup(); obj.AuthorizationGroupID = int.Parse(fieldValue); if (EAuthorizationGroup.db.select(dbConn, obj)) { return(obj.AuthorizationCode + " - " + obj.AuthorizationDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("AVCPlanID", StringComparison.CurrentCultureIgnoreCase)) { EAVCPlan obj = new EAVCPlan(); obj.AVCPlanID = int.Parse(fieldValue); if (EAVCPlan.db.select(dbConn, obj)) { return(obj.AVCPlanCode + " - " + obj.AVCPlanDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("C", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("CessationReasonID", StringComparison.CurrentCultureIgnoreCase)) { ECessationReason obj = new ECessationReason(); obj.CessationReasonID = int.Parse(fieldValue); if (ECessationReason.db.select(dbConn, obj)) { return(obj.CessationReasonCode + " - " + obj.CessationReasonDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("CompanyID", StringComparison.CurrentCultureIgnoreCase)) { ECompany obj = new ECompany(); obj.CompanyID = int.Parse(fieldValue); if (ECompany.db.select(dbConn, obj)) { return(obj.CompanyCode + " - " + obj.CompanyName); } else { return(string.Empty); } } if (tmpfieldName.Equals("CostAllocationDetailID", StringComparison.CurrentCultureIgnoreCase)) { ECostAllocationDetail obj = new ECostAllocationDetail(); obj.CostAllocationDetailID = int.Parse(fieldValue); if (ECostAllocationDetail.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "PayCodeID", obj.PaymentCodeID.ToString()) + ", " + GetValueFromID(dbConn, "CostCenterID", obj.CostCenterID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("CostAllocationID", StringComparison.CurrentCultureIgnoreCase)) { ECostAllocation obj = new ECostAllocation(); obj.CostAllocationID = int.Parse(fieldValue); if (ECostAllocation.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "EmpPayrollID", obj.EmpPayrollID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("CostCenterID", StringComparison.CurrentCultureIgnoreCase)) { ECostCenter obj = new ECostCenter(); obj.CostCenterID = int.Parse(fieldValue); if (ECostCenter.db.select(dbConn, obj)) { return(obj.CostCenterCode + " - " + obj.CostCenterDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("D", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("DocumentTypeID", StringComparison.CurrentCultureIgnoreCase)) { EDocumentType obj = new EDocumentType(); obj.DocumentTypeID = int.Parse(fieldValue); if (EDocumentType.db.select(dbConn, obj)) { return(obj.DocumentTypeCode + " - " + obj.DocumentTypeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("E", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("EmpAccID", StringComparison.CurrentCultureIgnoreCase)) { EEmpBankAccount obj = new EEmpBankAccount(); obj.EmpBankAccountID = int.Parse(fieldValue); if (EEmpBankAccount.db.select(dbConn, obj)) { return(obj.EmpBankCode + "-" + obj.EmpBranchCode + "-" + obj.EmpAccountNo); } //return obj.EmpBankCode + "-" + obj.EmpBranchCode + "-" + string.Empty.PadRight(obj.EmpAccountNo.Length, 'X'); else { return(string.Empty); } } if (tmpfieldName.Equals("EmpCostCenterID", StringComparison.CurrentCultureIgnoreCase)) { EEmpCostCenter obj = new EEmpCostCenter(); obj.EmpCostCenterID = int.Parse(fieldValue); if (EEmpCostCenter.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "EmpID", obj.EmpID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpExtraFieldID", StringComparison.CurrentCultureIgnoreCase)) { EEmpExtraField obj = new EEmpExtraField(); obj.EmpExtraFieldID = int.Parse(fieldValue); if (EEmpExtraField.db.select(dbConn, obj)) { return(obj.EmpExtraFieldName); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpID", StringComparison.CurrentCultureIgnoreCase)) { EEmpPersonalInfo obj = new EEmpPersonalInfo(); obj.EmpID = int.Parse(fieldValue); if (EEmpPersonalInfo.db.select(dbConn, obj)) { return(obj.EmpNo + " - " + obj.EmpEngFullName); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpPayrollID", StringComparison.CurrentCultureIgnoreCase)) { EEmpPayroll obj = new EEmpPayroll(); obj.EmpPayrollID = int.Parse(fieldValue); if (EEmpPayroll.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "EmpID", obj.EmpID.ToString()) + " : " + GetValueFromID(dbConn, "PayPeriodID", obj.PayPeriodID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpPosID", StringComparison.CurrentCultureIgnoreCase)) { EEmpPositionInfo obj = new EEmpPositionInfo(); obj.EmpPosID = int.Parse(fieldValue); if (EEmpPositionInfo.db.select(dbConn, obj)) { return(obj.EmpPosEffFr.ToString("yyyy-MM-dd") + " - " + (obj.EmpPosEffTo.Ticks.Equals(0) ? "Present" : obj.EmpPosEffTo.ToString("yyyy-MM-dd"))); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmploymentTypeID", StringComparison.CurrentCultureIgnoreCase)) { EEmploymentType obj = new EEmploymentType(); obj.EmploymentTypeID = int.Parse(fieldValue); if (EEmploymentType.db.select(dbConn, obj)) { return(obj.EmploymentTypeCode + " - " + obj.EmploymentTypeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("F", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("FunctionID", StringComparison.CurrentCultureIgnoreCase)) { ESystemFunction obj = new ESystemFunction(); obj.FunctionID = int.Parse(fieldValue); if (ESystemFunction.db.select(dbConn, obj)) { return(obj.FunctionCode + " - " + obj.Description); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("H", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("HElementID", StringComparison.CurrentCultureIgnoreCase)) { EHierarchyElement obj = new EHierarchyElement(); obj.HElementID = int.Parse(fieldValue); if (EHierarchyElement.db.select(dbConn, obj)) { return(obj.HElementCode + " - " + obj.HElementDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("HLevelID", StringComparison.CurrentCultureIgnoreCase)) { EHierarchyLevel obj = new EHierarchyLevel(); obj.HLevelID = int.Parse(fieldValue); if (EHierarchyLevel.db.select(dbConn, obj)) { return(obj.HLevelCode + " - " + obj.HLevelDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("L", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("LeaveTypeID", StringComparison.CurrentCultureIgnoreCase)) { ELeaveType obj = new ELeaveType(); obj.LeaveTypeID = int.Parse(fieldValue); if (ELeaveType.db.select(dbConn, obj)) { return(obj.LeaveType + " - " + obj.LeaveTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("LeaveCodeID", StringComparison.CurrentCultureIgnoreCase)) { ELeaveCode obj = new ELeaveCode(); obj.LeaveCodeID = int.Parse(fieldValue); if (ELeaveCode.db.select(dbConn, obj)) { return(obj.LeaveCode + " - " + obj.LeaveCodeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("LeavePlanID", StringComparison.CurrentCultureIgnoreCase)) { ELeavePlan obj = new ELeavePlan(); obj.LeavePlanID = int.Parse(fieldValue); if (ELeavePlan.db.select(dbConn, obj)) { return(obj.LeavePlanCode + " - " + obj.LeavePlanDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("M", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("MPFPlanID", StringComparison.CurrentCultureIgnoreCase)) { EMPFPlan obj = new EMPFPlan(); obj.MPFPlanID = int.Parse(fieldValue); if (EMPFPlan.db.select(dbConn, obj)) { return(obj.MPFPlanCode + " - " + obj.MPFPlanDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("MPFSchemeID", StringComparison.CurrentCultureIgnoreCase)) { EMPFScheme obj = new EMPFScheme(); obj.MPFSchemeID = int.Parse(fieldValue); if (EMPFScheme.db.select(dbConn, obj)) { return(obj.MPFSchemeCode + " - " + obj.MPFSchemeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("MPFSchemeCessationReasonID", StringComparison.CurrentCultureIgnoreCase)) { EMPFSchemeCessationReason obj = new EMPFSchemeCessationReason(); obj.MPFSchemeCessationReasonID = int.Parse(fieldValue); if (EMPFSchemeCessationReason.db.select(dbConn, obj)) { return(obj.MPFSchemeCessationReasonCode + " - " + obj.MPFSchemeCessationReasonDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("O", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("ORSOPlanID", StringComparison.CurrentCultureIgnoreCase)) { EORSOPlan obj = new EORSOPlan(); obj.ORSOPlanID = int.Parse(fieldValue); if (EORSOPlan.db.select(dbConn, obj)) { return(obj.ORSOPlanCode + " - " + obj.ORSOPlanDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("P", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("PayGroupID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("PayrollGroupID", StringComparison.CurrentCultureIgnoreCase)) { EPayrollGroup obj = new EPayrollGroup(); obj.PayGroupID = int.Parse(fieldValue); if (EPayrollGroup.db.select(dbConn, obj)) { return(obj.PayGroupCode + " - " + obj.PayGroupDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PayFormID", StringComparison.CurrentCultureIgnoreCase)) { EPayrollProrataFormula obj = new EPayrollProrataFormula(); obj.PayFormID = int.Parse(fieldValue); if (EPayrollProrataFormula.db.select(dbConn, obj)) { return(obj.PayFormCode + " - " + obj.PayFormDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PaymentCodeID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("PayCodeID", StringComparison.CurrentCultureIgnoreCase)) { EPaymentCode obj = new EPaymentCode(); obj.PaymentCodeID = int.Parse(fieldValue); if (EPaymentCode.db.select(dbConn, obj)) { return(obj.PaymentCode + " - " + obj.PaymentCodeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PaymentTypeID", StringComparison.CurrentCultureIgnoreCase)) { EPaymentType obj = new EPaymentType(); obj.PaymentTypeID = int.Parse(fieldValue); if (EPaymentType.db.select(dbConn, obj)) { return(obj.PaymentTypeCode + " - " + obj.PaymentTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PayPeriodID", StringComparison.CurrentCultureIgnoreCase)) { EPayrollPeriod obj = new EPayrollPeriod(); obj.PayPeriodID = int.Parse(fieldValue); if (EPayrollPeriod.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "PayrollGroupID", obj.PayGroupID.ToString()) + ": " + obj.PayPeriodFr.ToString("yyyy-MM-dd") + " to " + obj.PayPeriodTo.ToString("yyyy-MM-dd")); } else { return(string.Empty); } } if (tmpfieldName.Equals("PermitTypeID", StringComparison.CurrentCultureIgnoreCase)) { EPermitType obj = new EPermitType(); obj.PermitTypeID = int.Parse(fieldValue); if (EPermitType.db.select(dbConn, obj)) { return(obj.PermitTypeCode + " - " + obj.PermitTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PositionID", StringComparison.CurrentCultureIgnoreCase)) { EPosition obj = new EPosition(); obj.PositionID = int.Parse(fieldValue); if (EPosition.db.select(dbConn, obj)) { return(obj.PositionCode + " - " + obj.PositionDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("Q", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("QualificationID", StringComparison.CurrentCultureIgnoreCase)) { EQualification obj = new EQualification(); obj.QualificationID = int.Parse(fieldValue); if (EQualification.db.select(dbConn, obj)) { return(obj.QualificationCode + " - " + obj.QualificationDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("R", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("RankID", StringComparison.CurrentCultureIgnoreCase)) { ERank obj = new ERank(); obj.RankID = int.Parse(fieldValue); if (ERank.db.select(dbConn, obj)) { return(obj.RankCode + " - " + obj.RankDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("ReminderTypeID", StringComparison.CurrentCultureIgnoreCase)) { EReminderType obj = new EReminderType(); obj.ReminderTypeID = int.Parse(fieldValue); if (EReminderType.db.select(dbConn, obj)) { return(obj.ReminderTypeCode + " - " + obj.ReminderTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("RosterClientID", StringComparison.CurrentCultureIgnoreCase)) { ERosterClient obj = new ERosterClient(); obj.RosterClientID = int.Parse(fieldValue); if (ERosterClient.db.select(dbConn, obj)) { return(obj.RosterClientCode + " - " + obj.RosterClientName); } else { return(string.Empty); } } if (tmpfieldName.Equals("RosterClientSiteID", StringComparison.CurrentCultureIgnoreCase)) { ERosterClientSite obj = new ERosterClientSite(); obj.RosterClientSiteID = int.Parse(fieldValue); if (ERosterClientSite.db.select(dbConn, obj)) { return(obj.RosterClientSiteCode); } else { return(string.Empty); } } if (tmpfieldName.Equals("RosterCodeID", StringComparison.CurrentCultureIgnoreCase)) { ERosterCode obj = new ERosterCode(); obj.RosterCodeID = int.Parse(fieldValue); if (ERosterCode.db.select(dbConn, obj)) { return(obj.RosterCode + " - " + obj.RosterCodeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("S", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("SkillID", StringComparison.CurrentCultureIgnoreCase)) { ESkill obj = new ESkill(); obj.SkillID = int.Parse(fieldValue); if (ESkill.db.select(dbConn, obj)) { return(obj.SkillCode + " - " + obj.SkillDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("SkillLevelID", StringComparison.CurrentCultureIgnoreCase)) { ESkillLevel obj = new ESkillLevel(); obj.SkillLevelID = int.Parse(fieldValue); if (ESkillLevel.db.select(dbConn, obj)) { return(obj.SkillLevelCode + " - " + obj.SkillLevelDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("StaffTypeID", StringComparison.CurrentCultureIgnoreCase)) { EStaffType obj = new EStaffType(); obj.StaffTypeID = int.Parse(fieldValue); if (EStaffType.db.select(dbConn, obj)) { return(obj.StaffTypeCode + " - " + obj.StaffTypeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("T", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("TaxCompID", StringComparison.CurrentCultureIgnoreCase)) { ETaxCompany obj = new ETaxCompany(); obj.TaxCompID = int.Parse(fieldValue); if (ETaxCompany.db.select(dbConn, obj)) { return(obj.TaxCompEmployerName); } else { return(string.Empty); } } if (tmpfieldName.Equals("TaxEmpID", StringComparison.CurrentCultureIgnoreCase)) { ETaxEmp obj = new ETaxEmp(); obj.TaxEmpID = int.Parse(fieldValue); if (ETaxEmp.db.select(dbConn, obj)) { return(obj.TaxEmpSurname + ", " + obj.TaxEmpOtherName + ", " + GetValueFromID(dbConn, "TaxFormID", obj.TaxFormID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("TaxFormID", StringComparison.CurrentCultureIgnoreCase)) { ETaxForm obj = new ETaxForm(); obj.TaxFormID = int.Parse(fieldValue); if (ETaxForm.db.select(dbConn, obj)) { return("Tax Year :" + obj.TaxFormYear + ", Form: IR56" + obj.TaxFormType); } else { return(string.Empty); } } if (tmpfieldName.Equals("TaxPayID", StringComparison.CurrentCultureIgnoreCase)) { ETaxPayment obj = new ETaxPayment(); obj.TaxPayID = int.Parse(fieldValue); if (ETaxPayment.db.select(dbConn, obj)) { return(obj.TaxPayCode + " - " + obj.TaxPayDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("TrainingCourseID", StringComparison.CurrentCultureIgnoreCase)) { ETrainingCourse obj = new ETrainingCourse(); obj.TrainingCourseID = int.Parse(fieldValue); if (ETrainingCourse.db.select(dbConn, obj)) { return(obj.TrainingCourseCode + " - " + obj.TrainingCourseName); } else { return(string.Empty); } } if (tmpfieldName.Equals("TrainingSeminarID", StringComparison.CurrentCultureIgnoreCase)) { ETrainingSeminar obj = new ETrainingSeminar(); obj.TrainingSeminarID = int.Parse(fieldValue); if (ETrainingSeminar.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "TrainingCourseID", obj.TrainingCourseID.ToString()) + ": " + obj.TrainingSeminarDateFrom.ToString("yyyy-MM-dd") + " to " + obj.TrainingSeminarDateTo.ToString("yyyy-MM-dd")); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("U", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("UserID", StringComparison.CurrentCultureIgnoreCase)) { EUser obj = new EUser(); obj.UserID = int.Parse(fieldValue); if (EUser.db.select(dbConn, obj)) { return(obj.LoginID + " - " + obj.UserName); } else { return(string.Empty); } } if (tmpfieldName.Equals("UserGroupID", StringComparison.CurrentCultureIgnoreCase)) { EUserGroup obj = new EUserGroup(); obj.UserGroupID = int.Parse(fieldValue); if (EUserGroup.db.select(dbConn, obj)) { return(obj.UserGroupName + " - " + obj.UserGroupDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("Y", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("YebPlanID", StringComparison.CurrentCultureIgnoreCase)) { EYEBPlan obj = new EYEBPlan(); obj.YEBPlanID = int.Parse(fieldValue); if (EYEBPlan.db.select(dbConn, obj)) { return(obj.YEBPlanCode + " - " + obj.YEBPlanDesc); } else { return(string.Empty); } } } if (tmpfieldName.EndsWith("ID") && !tmpfieldName.EndsWith("HKID") && !tmpfieldName.EndsWith("LoginID") && !tmpfieldName.EndsWith("CurrencyID") && !tmpfieldName.EndsWith("LeaveAppID") && !tmpfieldName.EndsWith("EmpPaymentID") && !tmpfieldName.EndsWith("PayBatchID") && !tmpfieldName.EndsWith("PayRecID") && !tmpfieldName.EndsWith("RosterTableID") && !tmpfieldName.EndsWith("SynID") && !tmpfieldName.EndsWith("CNDImportBatchID")) { if (ESystemParameter.getParameter(dbConn, "DebugMode").Equals("Y")) { throw new Exception("ID field not define:" + fieldName); } } return(string.Empty); } catch (Exception ex) { if (ESystemParameter.getParameter(dbConn, "DebugMode").Equals("Y")) { throw ex; } else { return(string.Empty); } } }
private MPFFileControlInterface getMPFFileControl() { HROne.ProductLicense license = WebUtils.productLicense(Session); MPFFileControlInterface tmpMPFFileControl = null; //btnSubmit.Visible = false; string strMPDPlanID = MPFPlanID.SelectedValue; int intMPFPlanID = 0; if (int.TryParse(strMPDPlanID, out intMPFPlanID)) { EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = intMPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("HSBC") || mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng")) { Payroll_GenerateMPFFile_HSBCControl.Visible = true; Payroll_GenerateMPFFile_BOCIControl.Visible = false; Payroll_GenerateMPFFile_ManulifeControl.Visible = false; Payroll_GenerateMPFFile_AIAControl.Visible = false; Payroll_GenerateMPFFile_HSBCOISControl.Visible = false; tmpMPFFileControl = Payroll_GenerateMPFFile_HSBCControl; Payroll_GenerateMPFFile_HSBCControl.BankCode = mpfScheme.MPFSchemeTrusteeCode; //if (Payroll_GenerateMPFFile_HSBCControl.GetSelectedFileTypeValue().Equals("AMPFF") && Session["CompanyDBID"] != null) // btnSubmit.Visible = true; } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("BOCI") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers)) { Payroll_GenerateMPFFile_HSBCControl.Visible = false; Payroll_GenerateMPFFile_BOCIControl.Visible = true; Payroll_GenerateMPFFile_ManulifeControl.Visible = false; Payroll_GenerateMPFFile_AIAControl.Visible = false; Payroll_GenerateMPFFile_HSBCOISControl.Visible = false; tmpMPFFileControl = Payroll_GenerateMPFFile_BOCIControl; } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("Manulife") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers)) { Payroll_GenerateMPFFile_HSBCControl.Visible = false; Payroll_GenerateMPFFile_BOCIControl.Visible = false; Payroll_GenerateMPFFile_ManulifeControl.Visible = true; Payroll_GenerateMPFFile_AIAControl.Visible = false; Payroll_GenerateMPFFile_HSBCOISControl.Visible = false; tmpMPFFileControl = Payroll_GenerateMPFFile_ManulifeControl; } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("AIA") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers)) { Payroll_GenerateMPFFile_HSBCControl.Visible = false; Payroll_GenerateMPFFile_BOCIControl.Visible = false; Payroll_GenerateMPFFile_ManulifeControl.Visible = false; Payroll_GenerateMPFFile_AIAControl.Visible = true; Payroll_GenerateMPFFile_HSBCOISControl.Visible = false; tmpMPFFileControl = Payroll_GenerateMPFFile_AIAControl; } else if (mpfScheme.MPFSchemeCode.Equals("MT00288") && (Session["CompanyDBID"] == null || license.HasAutopayMPFFileOthers)) { // Fidelity is using HSBC's Open-Interface-System Payroll_GenerateMPFFile_HSBCControl.Visible = false; Payroll_GenerateMPFFile_BOCIControl.Visible = false; Payroll_GenerateMPFFile_ManulifeControl.Visible = false; Payroll_GenerateMPFFile_AIAControl.Visible = false; Payroll_GenerateMPFFile_HSBCOISControl.Visible = true; tmpMPFFileControl = Payroll_GenerateMPFFile_HSBCOISControl; } else { Payroll_GenerateMPFFile_HSBCControl.Visible = false; Payroll_GenerateMPFFile_BOCIControl.Visible = false; Payroll_GenerateMPFFile_ManulifeControl.Visible = false; Payroll_GenerateMPFFile_AIAControl.Visible = false; Payroll_GenerateMPFFile_HSBCOISControl.Visible = false; } return(tmpMPFFileControl); } } } Payroll_GenerateMPFFile_HSBCControl.Visible = false; Payroll_GenerateMPFFile_BOCIControl.Visible = false; Payroll_GenerateMPFFile_ManulifeControl.Visible = false; Payroll_GenerateMPFFile_AIAControl.Visible = false; return(null); }
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); }
public static DataTable Export(DatabaseConnection dbConn, ArrayList empList, bool IsIncludeCurrentPositionInfo, bool IsShowDescription, bool IsIncludeSyncID, DateTime ReferenceDateTime) { DataTable tmpDataTable = new DataTable(TABLE_NAME); //if (IsIncludeInternalID) // tmpDataTable.Columns.Add(FIELD_INTERNAL_ID, typeof(string)); tmpDataTable.Columns.Add(FIELD_EMP_NO, typeof(string)); if (IsIncludeCurrentPositionInfo) { ImportEmpPersonalInfoProcess.AddEmployeeInfoHeader(tmpDataTable); ImportEmpPositionInfoProcess.AddEmployeePositionInfoHeader(dbConn, tmpDataTable); } tmpDataTable.Columns.Add(FIELD_FROM, typeof(DateTime)); tmpDataTable.Columns.Add(FIELD_TO, typeof(DateTime)); tmpDataTable.Columns.Add(FIELD_MPFPLAN, typeof(string)); if (IsIncludeSyncID) { tmpDataTable.Columns.Add(FIELD_SYNC_ID, typeof(string)); } foreach (EEmpPersonalInfo empInfo in empList) { if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { DBFilter filter = new DBFilter(); filter.add(new Match("EmpID", empInfo.EmpID)); filter.add(getCreateModifiedRecordsAfterDBTerm(ReferenceDateTime)); ArrayList list = EEmpMPFPlan.db.select(dbConn, filter); foreach (EEmpMPFPlan empMPFPlan in list) { DataRow row = tmpDataTable.NewRow(); //if (IsIncludeInternalID) // row[FIELD_INTERNAL_ID] = ToHexDecWithCheckDigit(empMPFPlan.EmpMPFID); row[FIELD_EMP_NO] = empInfo.EmpNo; if (IsIncludeCurrentPositionInfo) { ImportEmpPersonalInfoProcess.AddEmployeeInfo(dbConn, row, empInfo.EmpID); ImportEmpPositionInfoProcess.AddEmployeePositionInfo(dbConn, row, empInfo.EmpID); } row[FIELD_FROM] = empMPFPlan.EmpMPFEffFr; row[FIELD_TO] = empMPFPlan.EmpMPFEffTo; EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = empMPFPlan.MPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { row[FIELD_MPFPLAN] = IsShowDescription ? mpfPlan.MPFPlanDesc : mpfPlan.MPFPlanCode; } if (IsIncludeSyncID) { row[FIELD_SYNC_ID] = empMPFPlan.SynID; } tmpDataTable.Rows.Add(row); } } } if (IsIncludeCurrentPositionInfo) { ImportEmpPositionInfoProcess.RetriveHierarchyLevelHeader(dbConn, tmpDataTable); } return(tmpDataTable); }
protected void Page_PreRender(object sender, EventArgs e) { if (!MPFPlanID.SelectedValue.Equals(string.Empty)) { int intMPFPlanID = int.Parse(MPFPlanID.SelectedValue); HSBCMPFPanel.Visible = false; AIAMPFPanel.Visible = false; SCBMPFPanel.Visible = false; EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = intMPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("HSBC") || mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng") ) { if (EmpMPFPlanClassName.Text.Equals(string.Empty)) { System.Xml.XmlNodeList payCenterNode = HROne.CommonLib.Utility.GetXmlDocumentByDataString(mpfPlan.MPFPlanExtendData).GetElementsByTagName("MPFPlanDefaultClassName"); if (payCenterNode.Count > 0) { EmpMPFPlanClassName.Text = payCenterNode[0].InnerText; } } HSBCMPFPanel.Visible = true; } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("AIA")) { if (EmpMPFPlanClassName.Text.Equals(string.Empty)) { EmpMPFPlanClassName.Text = "01"; } AIAMPFPanel.Visible = true; } else if (mpfScheme.MPFSchemeCode.Equals("MT00415") || mpfScheme.MPFSchemeCode.Equals("MT00423")) { SCBMPFPanel.Visible = true; } else { } } } } if (CurEmpID > 0 && CurID == -1 && EmpMPFEffFr.Value.ToString() == "") { EEmpPersonalInfo empOBJ = new EEmpPersonalInfo(); DBFilter filter = new DBFilter(); filter.add(new Match("EmpID", CurEmpID)); ArrayList empInfoList = EEmpPersonalInfo.db.select(dbConn, filter); if (empInfoList.Count > 0) { empOBJ = (EEmpPersonalInfo)empInfoList[0]; EmpMPFEffFr.Value = empOBJ.EmpDateOfJoin.ToString("yyyy-MM-dd"); } } }
protected bool loadObject() { obj = new EEmpAVCPlan(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); DBFilter filter = new DBFilter(); filter.add(new Match("EmpID", CurEmpID)); filter.add(WebUtils.AddRankFilter(Session, "EmpID", true)); if (EEmpPersonalInfo.db.count(dbConn, filter) == 0) { if (CurEmpID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } if (!db.select(dbConn, obj)) { if (CurID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } if (obj.EmpID != CurEmpID) { if (CurID <= 0) { return(false); } else { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx"); } } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); BOCIAVCPanel.Visible = false; DBFilter empMPFPlanFilter = new DBFilter(); empMPFPlanFilter.add(new Match("EmpID", CurEmpID)); empMPFPlanFilter.add("EmpMPFEffFr", false); if (!obj.EmpAVCEffFr.Ticks.Equals(0)) { empMPFPlanFilter.add(new Match("EmpMPFEffFr", "<=", obj.EmpAVCEffFr)); } ArrayList empMPFPlanList = EEmpMPFPlan.db.select(dbConn, empMPFPlanFilter); EMPFPlan mpfPlan = new EMPFPlan(); if (empMPFPlanList.Count > 0) { EEmpMPFPlan empMPFPlan = (EEmpMPFPlan)empMPFPlanList[0]; mpfPlan.MPFPlanID = empMPFPlan.MPFPlanID; } else { mpfPlan.MPFPlanID = obj.DefaultMPFPlanID; } if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("BOCI")) { BOCIAVCPanel.Visible = true; } else { BOCIAVCPanel.Visible = false; } } } return(true); }
public override FileInfo GenerateMPFFile() { EMPFPlan m_mpfPlanObj = new EMPFPlan(); m_mpfPlanObj.MPFPlanID = MPFPlanID; EMPFPlan.db.select(dbConn, m_mpfPlanObj); TransactionTime = AppUtils.ServerDateTime(); string mpfFileData = string.Empty; // get Scheme No System.Xml.XmlNodeList mpfPlanSchemeNoNode = HROne.CommonLib.Utility.GetXmlDocumentByDataString(MPFPlanExtendXMLString).GetElementsByTagName(MPF_PLAN_XML_SCHEMENO_NODE_NAME); if (mpfPlanSchemeNoNode.Count > 0) { MPFPlanSchemeNo = mpfPlanSchemeNoNode[0].InnerText.Trim(); } else { MPFPlanSchemeNo = string.Empty; } // get Sequence No System.Xml.XmlNodeList mpfPlanPlanNoNode = HROne.CommonLib.Utility.GetXmlDocumentByDataString(MPFPlanExtendXMLString).GetElementsByTagName(MPF_PLAN_XML_SEQUENCE_NODE_NAME); if (mpfPlanPlanNoNode.Count > 0) { if (!int.TryParse(mpfPlanPlanNoNode[0].InnerText.Trim(), out m_SequenceNo)) { m_SequenceNo = 1; } } else { m_SequenceNo = 1; } double m_allFigures = 0; // CA records ArrayList m_caList = new ArrayList(); double m_caFigures = 0; int m_caCount = 0; foreach (GenericNewJoinEmployeeMPFFileDetail mpfFileDetail in NewJoinEmployeeMPFFileDetails) { m_caFigures += GenerateMPFDataByPeriod(mpfFileDetail, m_caList, "CA"); } foreach (GenericExistingEmployeeMPFFileDetail bankFileDetail in ExistingEmployeeMPFFileDetails) { m_caFigures += GenerateMPFDataByPeriod(bankFileDetail, m_caList, "CA"); } foreach (GenericBackPaymentEmployeeMPFFileDetail bankFileDetail in BackPaymentEmployeeMPFFileDetails) { m_caFigures += GenerateMPFDataByPeriod(bankFileDetail, m_caList, "CA"); } string m_caBody = ""; foreach (MPFPeriod mpfPeriod in m_caList) { foreach (string mpfContributionString in mpfPeriod.DetailStringList) { m_caBody += mpfContributionString + RECORD_DELIMITER; m_caCount++; } } if (m_caCount > 0) { m_caCount += 2; // includes header and footer string[] m_caHeader = new string[2]; m_caHeader[0] = "CA"; m_caHeader[1] = this.MPFPlanParticipationNo.PadRight(4).Substring(0, 4); // writing Periodic Contribution details string[] m_caFooter = new string[4]; m_caFooter[0] = "CA"; m_caFooter[1] = this.MPFPlanParticipationNo.PadRight(4).Substring(0, 4); m_caFooter[2] = m_caFigures.ToString("0000000000000.00").Replace(".", ""); m_caFooter[3] = m_caCount.ToString("00000000"); mpfFileData += string.Join("", m_caHeader) + RECORD_DELIMITER + m_caBody + (string.Join("", m_caFooter) + RECORD_DELIMITER); } // Terminated staffs records int m_tdCount = 0; string m_tdBody = ""; foreach (GenericExistingEmployeeMPFFileDetail bankFileDetail in ExistingEmployeeMPFFileDetails) { if (bankFileDetail.LastEmploymentDate.Ticks != 0) { string[] m_tdRecord = new string[23]; m_tdRecord[0] = "TD"; m_tdRecord[1] = this.MPFPlanParticipationNo.PadRight(4).Substring(0, 4); m_tdRecord[2] = bankFileDetail.HKIDPassport.PadRight(15).Substring(0, 15); m_tdRecord[3] = this.MPFSchemeCode.PadRight(4).Substring(0, 4); m_tdRecord[4] = "M"; m_tdRecord[5] = bankFileDetail.TermCode.PadRight(2).Substring(0, 2); m_tdRecord[6] = "".PadRight(2); m_tdRecord[7] = bankFileDetail.LastEmploymentDate.ToString("yyyyMMdd"); m_tdRecord[8] = "".PadRight(8); m_tdRecord[9] = "".PadRight(8); m_tdRecord[10] = "".PadRight(8); m_tdRecord[11] = "".PadRight(8); m_tdRecord[12] = "".PadRight(1); m_tdRecord[13] = "".PadRight(15); m_tdRecord[14] = "".PadRight(15); m_tdRecord[15] = "".PadRight(1); m_tdRecord[16] = "".PadRight(15); m_tdRecord[17] = "".PadRight(15); m_tdRecord[18] = "".PadRight(15); m_tdRecord[19] = "".PadRight(15); m_tdRecord[20] = "".PadRight(1); m_tdRecord[21] = "".PadRight(15); m_tdRecord[22] = "".PadRight(8); m_tdBody += string.Join(FIELD_DELIMITER, m_tdRecord) + RECORD_DELIMITER; m_tdCount++; } } if (m_tdCount > 0) { m_tdCount += 2; // includes header and footer string[] m_tdHeader = new string[2]; m_tdHeader[0] = "TD"; m_tdHeader[1] = this.MPFPlanParticipationNo.PadRight(4).Substring(0, 4); string[] m_tdFooter = new string[4]; m_tdFooter[0] = "TD"; m_tdFooter[1] = this.MPFPlanParticipationNo.PadRight(4).Substring(0, 4); m_tdFooter[2] = "000000000000000"; m_tdFooter[3] = m_tdCount.ToString("00000000"); mpfFileData += string.Join("", m_tdHeader) + RECORD_DELIMITER + m_tdBody + string.Join("", m_tdFooter) + RECORD_DELIMITER; } // file level string[] mpfFileHeader = new string[3]; mpfFileHeader[0] = "FH"; mpfFileHeader[1] = m_mpfPlanObj.MPFPlanParticipationNo.PadRight(4).Substring(0, 4); mpfFileHeader[2] = m_mpfPlanObj.MPFPlanCompanyName.PadRight(40).Substring(0, 40); string[] mpfFileFooter = new string[4]; mpfFileFooter[0] = "FT"; mpfFileFooter[1] = MPFPlanParticipationNo.PadRight(4).Substring(0, 4); int m_dataTypeCount = ((m_caCount > 0) ? 1 : 0) + ((m_tdCount > 0) ? 1: 0); mpfFileFooter[2] = m_dataTypeCount.ToString("00"); mpfFileFooter[3] = ((int)(m_caCount + m_tdCount + 2)).ToString("00000000"); mpfFileData = string.Join(FIELD_DELIMITER, mpfFileHeader) + RECORD_DELIMITER + mpfFileData + string.Join(FIELD_DELIMITER, mpfFileFooter); FileInfo result = GenerateTempFileName(); StreamWriter writer = new StreamWriter(result.OpenWrite()); writer.Write(mpfFileData); writer.Close(); SaveSequenceNo(m_SequenceNo + 1); return(result); }
protected void Save_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); if (!HSBCMPFPanel.Visible) { MPFPlanDefaultClassName.Text = string.Empty; MPFPlanPayCenter.Text = string.Empty; MPFPlanEmployerID.Text = string.Empty; } else { if (string.IsNullOrEmpty(MPFPlanDefaultClassName.Text)) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_FIELD_REQUIRED, lblDefaultClassNameHeader.Text)); } if (string.IsNullOrEmpty(MPFPlanPayCenter.Text)) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_FIELD_REQUIRED, lblPayCenterHeader.Text)); } if (string.IsNullOrEmpty(MPFPlanEmployerID.Text)) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_FIELD_REQUIRED, lblEmployerIDHeader.Text)); } } if (!BOCIMPFPanel.Visible) { MPFPlanSchemeNo.Text = string.Empty; MPFPlanPlanNo.Text = string.Empty; } if (!AIAMPFPanel.Visible) { MPFPlanAIAERPlanNo.Text = string.Empty; } if (!errors.isEmpty()) { return; } EMPFPlan c = new EMPFPlan(); Hashtable values = new Hashtable(); binding.toValues(values); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, c); if (!AppUtils.checkDuplicate(dbConn, db, c, errors, "MPFPlanCode")) { return; } WebUtils.StartFunction(Session, FUNCTION_CODE); if (CurID < 0) { // Utils.MarkCreate(Session, c); db.insert(dbConn, c); CurID = c.MPFPlanID; // url = Utils.BuildURL(-1, CurID); } else { // Utils.Mark(Session, c); db.update(dbConn, c); } WebUtils.EndFunction(dbConn); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "MPFPlan_View.aspx?MPFPlanID=" + CurID); }
public void GenerateExcelReport(string _filename) { // F&V MPF Remittance Statement is composed of MPF and PFund data. So the current MPF Remittance Statement can only achieve 1/2 of their needs. if (PayPeriodFr.Ticks != 0 && PayPeriodTo.Ticks != 0 && EmpList != null) { // get MPF part of the remmittance statement MPFFile.GenericMPFFile mpfFile = new MPFFile.GenericMPFFile(dbConn); mpfFile.LoadMPFFileDetail(EmpList, MPFPlanID, PayPeriodFr, PayPeriodTo); System.Data.DataSet dataSet = mpfFile.CreateRemittanceStatementDataSet(); string _schemeNo = ""; string _companyName = ""; DataTable m_table = null; NPOI.HSSF.UserModel.HSSFSheet m_worksheet = null; NPOI.HSSF.UserModel.HSSFWorkbook workbook = new NPOI.HSSF.UserModel.HSSFWorkbook(); if (this.MPFPlanID > 0) { EMPFPlan _mpfPlan = EMPFPlan.GetObject(dbConn, this.MPFPlanID); if (_mpfPlan != null) { EMPFScheme _mpfScheme = EMPFScheme.GetObject(dbConn, _mpfPlan.MPFSchemeID); if (_mpfScheme != null) { _schemeNo = _mpfScheme.MPFSchemeCode; } _companyName = _mpfPlan.MPFPlanCompanyName; } m_table = ConvertData(dataSet.Tables["NewJoinMember"], "", 1); m_worksheet = (NPOI.HSSF.UserModel.HSSFSheet)workbook.CreateSheet("1-NewJoinMember"); WriteToSpreadsheet(m_table, m_worksheet, _schemeNo, _companyName, 1); m_table = ConvertData(dataSet.Tables["ExistingMember"], "IsBackPayRecord = false", 1); m_worksheet = (NPOI.HSSF.UserModel.HSSFSheet)workbook.CreateSheet("1-ExistingEmployee"); WriteToSpreadsheet(m_table, m_worksheet, _schemeNo, _companyName, 1); m_table = ConvertData(dataSet.Tables["ExistingMember"], "IsBackPayRecord = true", 1); m_worksheet = (NPOI.HSSF.UserModel.HSSFSheet)workbook.CreateSheet("1-TerminatedEmployee"); WriteToSpreadsheet(m_table, m_worksheet, _schemeNo, _companyName, 1); } if (this.ORSOPlanID > 0) { EORSOPlan _orsoPlan = EORSOPlan.GetObject(dbConn, ORSOPlanID); if (_orsoPlan != null) { _schemeNo = _orsoPlan.ORSOPlanSchemeNo; _companyName = _orsoPlan.ORSOPlanCompanyName; } DataTable _orsoStaffTable = LoadORSODetail(); m_table = ConvertData(_orsoStaffTable, "IsBackPayRecord = false", 2); m_worksheet = (NPOI.HSSF.UserModel.HSSFSheet)workbook.CreateSheet("2-ExistingEmployee"); WriteToSpreadsheet(m_table, m_worksheet, _schemeNo, _companyName, 2); m_table = ConvertData(_orsoStaffTable, "IsBackPayRecord = true", 2); m_worksheet = (NPOI.HSSF.UserModel.HSSFSheet)workbook.CreateSheet("2-TerminatedEmployee"); WriteToSpreadsheet(m_table, m_worksheet, _schemeNo, _companyName, 2); } // get ORSO part of remittance statement System.IO.FileStream file = new System.IO.FileStream(_filename, System.IO.FileMode.Create); workbook.Write(file); file.Close(); } }