protected void Repeater_ItemDataBound(object sender, DataListItemEventArgs e) { e.Item.FindControl("DeleteItem").Visible = IsAllowEdit; if (e.Item.ItemIndex == Repeater.EditItemIndex) { ebinding = new Binding(dbConn, db); ebinding.add((HtmlInputHidden)e.Item.FindControl("QualificationID")); ebinding.add((TextBox)e.Item.FindControl("QualificationCode")); ebinding.add((TextBox)e.Item.FindControl("QualificationDesc")); ebinding.init(Request, Session); EQualification obj = new EQualification(); db.toObject(((DataRowView)e.Item.DataItem).Row, obj); Hashtable values = new Hashtable(); db.populate(obj, values); ebinding.toControl(values); } else { e.Item.FindControl("Edit").Visible = IsAllowEdit; HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("QualificationID"); h.Value = ((DataRowView)e.Item.DataItem)["QualificationID"].ToString(); } HROne.Common.WebUtility.WebControlsLocalization(Session, e.Item.Controls); }
protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e) { Button b = (Button)e.CommandSource; if (b.ID.Equals("Edit")) { Repeater.EditItemIndex = e.Item.ItemIndex; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(AddPanel, false); } else if (b.ID.Equals("Cancel")) { Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(AddPanel, true); } else if (b.ID.Equals("Save")) { ebinding = new Binding(dbConn, db); ebinding.add((HtmlInputHidden)e.Item.FindControl("QualificationID")); ebinding.add((TextBox)e.Item.FindControl("QualificationCode")); ebinding.add((TextBox)e.Item.FindControl("QualificationDesc")); ebinding.init(Request, Session); EQualification obj = new EQualification(); Hashtable values = new Hashtable(); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ebinding.toValues(values); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, obj); if (!AppUtils.checkDuplicate(dbConn, db, obj, errors, "QualificationCode")) { return; } WebUtils.StartFunction(Session, FUNCTION_CODE); db.update(dbConn, obj); WebUtils.EndFunction(dbConn); Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(AddPanel, true); } }
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("QualificationID"); if (c.Checked) { EQualification obj = new EQualification(); obj.QualificationID = Int32.Parse(h.Value); list.Add(obj); } } foreach (EQualification obj in list) { db.select(dbConn, obj); DBFilter empQualificationFilter = new DBFilter(); empQualificationFilter.add(new Match("QualificationID", obj.QualificationID)); empQualificationFilter.add("empid", true); ArrayList empQualificationList = EEmpQualification.db.select(dbConn, empQualificationFilter); if (empQualificationList.Count > 0) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Qualification Code"), obj.QualificationCode })); foreach (EEmpQualification empQualification in empQualificationList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empQualification.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); } else { EEmpQualification.db.delete(dbConn, empQualification); } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); view = loadData(info, db, Repeater); return; } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); } } view = loadData(info, db, Repeater); }
private void stfBSalary_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { EQualification.Focus(); e.Handled = true; } else { e.Handled = false; } char ch = e.KeyChar; if (!Char.IsDigit(ch) && ch != 8 && ch != 46) { e.Handled = true; } }
protected void Add_Click(object sender, EventArgs e) { Repeater.EditItemIndex = -1; EQualification c = new EQualification(); 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, "QualificationCode")) { return; } WebUtils.StartFunction(Session, FUNCTION_CODE); db.insert(dbConn, c); WebUtils.EndFunction(dbConn); QualificationCode.Text = string.Empty; QualificationDesc.Text = string.Empty; view = loadData(info, db, Repeater); }
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); } } }
public override ReportDocument GenerateReport() { if (EmpList.Count > 0) { string HierarchyLevel1 = " "; string HierarchyLevel2 = " "; string HierarchyLevel3 = " "; ArrayList HierarchyLevelList = EHierarchyLevel.db.select(dbConn, new DBFilter()); foreach (EHierarchyLevel hLevel in HierarchyLevelList) { if (hLevel.HLevelSeqNo.Equals(1)) { HierarchyLevel1 = hLevel.HLevelDesc; } else if (hLevel.HLevelSeqNo.Equals(2)) { HierarchyLevel2 = hLevel.HLevelDesc; } else if (hLevel.HLevelSeqNo.Equals(3)) { HierarchyLevel3 = hLevel.HLevelDesc; } } DataSet.EmployeeDetail ds = new DataSet.EmployeeDetail(); ArrayList empExtraFieldList = EEmpExtraField.db.select(dbConn, new DBFilter()); DataSet.EmployeeDetail.EmpExtraFieldDataTable empExtraFieldTable = ds.EmpExtraField; foreach (EEmpExtraField empExtraField in empExtraFieldList) { DataSet.EmployeeDetail.EmpExtraFieldRow empExtraFieldRow = empExtraFieldTable.NewEmpExtraFieldRow(); empExtraFieldRow.EmpExtraFieldGroupName = empExtraField.EmpExtraFieldGroupName; empExtraFieldRow.EmpExtraFieldID = empExtraField.EmpExtraFieldID; empExtraFieldRow.EmpExtraFieldName = empExtraField.EmpExtraFieldName; if (empExtraFieldRow.IsEmpExtraFieldGroupNameNull()) { empExtraFieldRow.EmpExtraFieldGroupName = "Extra Information"; } empExtraFieldTable.Rows.Add(empExtraFieldRow); } foreach (int EmpID in EmpList) { DataSet.EmployeeDetail.employeedetailRow empRow = ImportEmployeeDetailRow(dbConn, ds.employeedetail, EmpID, AppUtils.ServerDateTime().Date); EEmpDocument empDocument = EEmpDocument.GetProfilePhotoEmpDocument(dbConn, EmpID); if (empDocument != null) { string documentFilePath = empDocument.GetDocumentPhysicalPath(dbConn); string transferFilePath = documentFilePath; string strTmpFolder = string.Empty; if (empDocument.EmpDocumentIsCompressed) { transferFilePath = empDocument.GetExtractedFilePath(dbConn); } empRow.PhotoByteArray = ThumbnailToByteArray(transferFilePath, 200, 200); empDocument.RemoveExtractedFile(); } DBFilter empFilter = new DBFilter(); empFilter.add(new Match("EmpID", EmpID)); DBFilter empPosFilter = new DBFilter(); empPosFilter.add(new Match("EmpID", EmpID)); empPosFilter.add("EmpPosEffFr", false); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter); DataSet.EmployeeDetail.EmpPositionInfoDataTable empPosTable = ds.EmpPositionInfo; foreach (EEmpPositionInfo empPos in empPosList) { DataSet.EmployeeDetail.EmpPositionInfoRow row = empPosTable.NewEmpPositionInfoRow(); row.CompanyID = empPos.CompanyID; row.EmpID = empPos.EmpID; row.EmpPosEffFr = empPos.EmpPosEffFr; if (!empPos.EmpPosEffTo.Ticks.Equals(0)) { row.EmpPosEffTo = empPos.EmpPosEffTo; } row.EmpPosID = empPos.EmpPosID; row.LeavePlanID = empPos.LeavePlanID; row.PayGroupID = empPos.PayGroupID; EPosition position = new EPosition(); position.PositionID = empPos.PositionID; if (EPosition.db.select(dbConn, position)) { row.PositionCode = position.PositionCode; row.PositionDesc = position.PositionDesc; row.PositionID = position.PositionID; } ERank rank = new ERank(); rank.RankID = empPos.RankID; if (ERank.db.select(dbConn, rank)) { row.RankCode = rank.RankCode; row.RankDesc = rank.RankDesc; row.RankID = rank.RankID; } row.StaffTypeID = empPos.StaffTypeID; foreach (EHierarchyLevel hLevel in HierarchyLevelList) { if (hLevel.HLevelSeqNo < 4 && hLevel.HLevelSeqNo > 0) { DBFilter empHierarchyFilter = new DBFilter(); empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID)); empHierarchyFilter.add(new Match("HLevelID", hLevel.HLevelID)); ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter); if (empHierarchyList.Count > 0) { EEmpHierarchy empHierarchy = (EEmpHierarchy)empHierarchyList[0]; EHierarchyElement hElement = new EHierarchyElement(); hElement.HElementID = empHierarchy.HElementID; EHierarchyElement.db.select(dbConn, hElement); row["HierarchyCode" + hLevel.HLevelSeqNo] = hElement.HElementCode; row["HierarchyDesc" + hLevel.HLevelSeqNo] = hElement.HElementDesc; } } } empPosTable.AddEmpPositionInfoRow(row); } DBFilter empRPFilter = new DBFilter(); empRPFilter.add(new Match("EmpID", EmpID)); empRPFilter.add("empRPEffFr", false); ArrayList empRPList = EEmpRecurringPayment.db.select(dbConn, empRPFilter); DataSet.EmployeeDetail.EmpRecurringPaymentDataTable empRPTable = ds.EmpRecurringPayment; foreach (EEmpRecurringPayment empRP in empRPList) { DataSet.EmployeeDetail.EmpRecurringPaymentRow row = empRPTable.NewEmpRecurringPaymentRow(); row.CurrencyID = empRP.CurrencyID; row.EmpAccID = empRP.EmpAccID; row.EmpID = empRP.EmpID; row.EmpRPAmount = Convert.ToDecimal(empRP.EmpRPAmount); row.EmpRPEffFr = empRP.EmpRPEffFr; if (!empRP.EmpRPEffTo.Ticks.Equals(0)) { row.EmpRPEffTo = empRP.EmpRPEffTo; } row.EmpRPID = empRP.EmpRPID; if (empRP.EmpRPMethod.Equals("A")) { row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Autopay"); } else if (empRP.EmpRPMethod.Equals("Q")) { row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Cheque"); } else if (empRP.EmpRPMethod.Equals("C")) { row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Cash"); } else if (empRP.EmpRPMethod.Equals("O")) { row.EmpRPMethod = HROne.Common.WebUtility.GetLocalizedString("Others"); } row.EmpRPRemark = empRP.EmpRPRemark; row.EmpRPUnit = empRP.EmpRPUnit; EPaymentCode paymentCode = new EPaymentCode(); paymentCode.PaymentCodeID = empRP.PayCodeID; if (EPaymentCode.db.select(dbConn, paymentCode)) { row.PayCodeID = paymentCode.PaymentCodeID; row.PaymentCode = paymentCode.PaymentCode; row.PaymentCodeDesc = paymentCode.PaymentCodeDesc; row.PaymentCodeID = paymentCode.PaymentCodeID; // row.p } empRPTable.AddEmpRecurringPaymentRow(row); } EmployeeBankAccountProcess.ImportEmpBankAccountRow(dbConn, ds.EmpBankAccount, EmpID); ArrayList empSpouseList = EEmpSpouse.db.select(dbConn, empFilter); DataSet.EmployeeDetail.EmpSpouseDataTable empSpouseTable = ds.EmpSpouse; foreach (EEmpSpouse empSpouse in empSpouseList) { DataSet.EmployeeDetail.EmpSpouseRow row = empSpouseTable.NewEmpSpouseRow(); row.EmpID = empSpouse.EmpID; row.EmpSpouseChineseName = empSpouse.EmpSpouseChineseName; //empSpouse.EmpSpouseDateOfBirth; row.EmpSpouseHKID = empSpouse.EmpSpouseHKID; row.EmpSpouseID = empSpouse.EmpSpouseID; row.EmpSpouseOtherName = empSpouse.EmpSpouseOtherName; row.EmpSpousePassportIssuedCountry = empSpouse.EmpSpousePassportIssuedCountry; row.EmpSpousePassportNo = empSpouse.EmpSpousePassportNo; row.EmpSpouseSurname = empSpouse.EmpSpouseSurname; // Start 0000142, KuangWei, 2014-12-21 row.EmpGender = empSpouse.EmpGender; if (empSpouse.EmpIsMedicalSchemaInsured) { row.EmpIsMedicalSchemaInsured = "Yes"; } else { row.EmpIsMedicalSchemaInsured = "No"; } row.EmpMedicalEffectiveDate = empSpouse.EmpMedicalEffectiveDate; row.EmpMedicalExpiryDate = empSpouse.EmpMedicalExpiryDate; // End 0000142, KuangWei, 2014-12-21 empSpouseTable.AddEmpSpouseRow(row); } ArrayList empDependantList = EEmpDependant.db.select(dbConn, empFilter); DataSet.EmployeeDetail.EmpDependantDataTable empDependantTable = ds.EmpDependant; foreach (EEmpDependant empDependant in empDependantList) { DataSet.EmployeeDetail.EmpDependantRow row = empDependantTable.NewEmpDependantRow(); row.EmpID = empDependant.EmpID; row.EmpDependantChineseName = empDependant.EmpDependantChineseName; //empDependant.EmpDependantDateOfBirth; row.EmpDependantGender = empDependant.EmpDependantGender; row.EmpDependantHKID = empDependant.EmpDependantHKID; row.EmpDependantID = empDependant.EmpDependantID; row.EmpDependantOtherName = empDependant.EmpDependantOtherName; row.EmpDependantPassportIssuedCountry = empDependant.EmpDependantPassportIssuedCountry; row.EmpDependantPassportNo = empDependant.EmpDependantPassportNo; row.EmpDependantRelationship = empDependant.EmpDependantRelationship; row.EmpDependantSurname = empDependant.EmpDependantSurname; empDependantTable.AddEmpDependantRow(row); } DBFilter empQualificationFilter = new DBFilter(); empQualificationFilter.add(new Match("EmpID", EmpID)); empQualificationFilter.add("EmpQualificationFrom", false); ArrayList empQualificationList = EEmpQualification.db.select(dbConn, empQualificationFilter); DataSet.EmployeeDetail.EmpQualificationDataTable empQualificationTable = ds.EmpQualification; foreach (EEmpQualification empQualification in empQualificationList) { DataSet.EmployeeDetail.EmpQualificationRow row = empQualificationTable.NewEmpQualificationRow(); row.EmpID = empQualification.EmpID; if (!empQualification.EmpQualificationFrom.Ticks.Equals(0)) { row.EmpQualificationFrom = empQualification.EmpQualificationFrom; } if (!empQualification.EmpQualificationTo.Ticks.Equals(0)) { row.EmpQualificationTo = empQualification.EmpQualificationTo; } row.EmpQualificationID = empQualification.EmpQualificationID; row.EmpQualificationInstitution = empQualification.EmpQualificationInstitution; row.EmpQualificationRemark = empQualification.EmpQualificationRemark; EQualification qualification = new EQualification(); qualification.QualificationID = empQualification.QualificationID; if (EQualification.db.select(dbConn, qualification)) { row.QualificationID = qualification.QualificationID; row.QualificationCode = qualification.QualificationCode; row.QualificationDesc = qualification.QualificationDesc; } empQualificationTable.AddEmpQualificationRow(row); } ArrayList empSkillList = EEmpSkill.db.select(dbConn, empFilter); DataSet.EmployeeDetail.EmpSkillDataTable empSkillTable = ds.EmpSkill; foreach (EEmpSkill empSkill in empSkillList) { DataSet.EmployeeDetail.EmpSkillRow row = empSkillTable.NewEmpSkillRow(); row.EmpID = empSkill.EmpID; row.EmpSkillID = empSkill.EmpSkillID; ESkill skill = new ESkill(); skill.SkillID = empSkill.SkillID; if (ESkill.db.select(dbConn, skill)) { row.SkillID = skill.SkillID; row.SkillCode = skill.SkillCode; row.SkillDesc = skill.SkillDesc; } ESkillLevel skillLevel = new ESkillLevel(); skillLevel.SkillLevelID = empSkill.SkillLevelID; if (ESkillLevel.db.select(dbConn, skillLevel)) { row.SkillLevelID = skillLevel.SkillLevelID; row.SkillLevelCode = skillLevel.SkillLevelCode; row.SkillLevelDesc = skillLevel.SkillLevelDesc; } empSkillTable.AddEmpSkillRow(row); } ArrayList empWorkExpList = EEmpWorkExp.db.select(dbConn, empFilter); DataSet.EmployeeDetail.EmpWorkExpDataTable empWorkExpTable = ds.EmpWorkExp; foreach (EEmpWorkExp empWorkExp in empWorkExpList) { DataSet.EmployeeDetail.EmpWorkExpRow row = empWorkExpTable.NewEmpWorkExpRow(); row.EmpID = empWorkExp.EmpID; row.EmpWorkExpID = empWorkExp.EmpWorkExpID; row.EmpWorkExpFromMonth = empWorkExp.EmpWorkExpFromMonth; row.EmpWorkExpFromYear = empWorkExp.EmpWorkExpFromYear; row.EmpWorkExpToYear = empWorkExp.EmpWorkExpToYear; row.EmpWorkExpToMonth = empWorkExp.EmpWorkExpToMonth; row.EmpWorkExpPosition = empWorkExp.EmpWorkExpPosition; row.EmpWorkExpCompanyName = empWorkExp.EmpWorkExpCompanyName; row.EmpWorkExpRemark = empWorkExp.EmpWorkExpRemark; empWorkExpTable.AddEmpWorkExpRow(row); } ArrayList empExtraFieldValueList = EEmpExtraFieldValue.db.select(dbConn, empFilter); DataSet.EmployeeDetail.EmpExtraFieldValueDataTable empExtraFieldValueTable = ds.EmpExtraFieldValue; foreach (EEmpExtraFieldValue empExtraFieldValue in empExtraFieldValueList) { DataSet.EmployeeDetail.EmpExtraFieldValueRow row = empExtraFieldValueTable.NewEmpExtraFieldValueRow(); row.EmpID = empExtraFieldValue.EmpID; row.EmpExtraFieldValueID = empExtraFieldValue.EmpExtraFieldValueID; row.EmpExtraFieldID = empExtraFieldValue.EmpExtraFieldID; row.EmpExtraFieldValue = empExtraFieldValue.EmpExtraFieldValue; empExtraFieldValueTable.AddEmpExtraFieldValueRow(row); } //DBFilter filter = new DBFilter(); //filter.add(new Match("P.EmpID", EmpID)); //select = "P.*,EmpPos.*,Pos.*"; //from = "from EmpPersonalInfo P LEFT JOIN EmpPositionInfo EmpPos ON P.EmpID=EmpPos.EmpID AND EmpPos.EmpPosEffTo IS NULL LEFT JOIN Position Pos ON EmpPos.PositionID=Pos.PositionID"; //filter.loadData(ds, "employeedetail", null, select, from, null); //select = "P.*,Pos.PositionCode,Pos.PositionDesc,R.RankCode, R.RankDesc"; //from = "from EmpPositionInfo P LEFT JOIN Position Pos ON P.PositionID=Pos.PositionID LEFT JOIN Rank R ON P.RankID=R.RankID"; //filter.loadData(ds, "EmpPositionInfo", null, select, from, null); //select = "P.*,C.*"; //from = "from EmpRecurringPayment P LEFT JOIN PaymentCode C ON P.PayCodeID=C.PaymentCodeID "; //filter.loadData(ds, "EmpRecurringPayment", null, select, from, null); //select = "P.*"; //from = "from EmpBankAccount P "; //filter.loadData(ds, "EmpBankAccount", null, select, from, null); //select = "P.*"; //from = "from EmpSpouse P "; //filter.loadData(ds, "EmpSpouse", null, select, from, null); //select = "P.*"; //from = "from EmpDependant P "; //filter.loadData(ds, "EmpDependant", null, select, from, null); //select = "P.*, Q.*"; //from = "from EmpQualification P LEFT JOIN Qualification Q on P.QualificationID=Q.QualificationID"; //filter.loadData(ds, "EmpQualification", null, select, from, null); //select = "P.*, S.*,L.*"; //from = "from EmpSkill P LEFT JOIN Skill S ON P.SkillID=S.SkillID LEFT JOIN SkillLevel L on P.SkillLevelID=L.SkillLevelID"; //filter.loadData(ds, "EmpSkill", null, select, from, null); } //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpHKID", true); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpPassportNo", false); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpResAddr", true); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["employeedetail"], "EmpCorAddr", true); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpSpouse"], "EmpSpouseHKID", false); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpSpouse"], "EmpSpousePassportNo", false); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpDependant"], "EmpDependantHKID", false); //DBAESEncryptStringFieldAttribute.decode(ds.Tables["EmpDependant"], "EmpDependantPassportNo", false); if (reportDocument == null) { reportDocument = new ReportTemplate.Report_Employee_Detail(); } else { } reportDocument.SetDataSource(ds); reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1); reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2); reportDocument.SetParameterValue("HierarchyLevel3", HierarchyLevel3); reportDocument.SetParameterValue("HierarchyLevel1", HierarchyLevel1, "PositionInfo"); reportDocument.SetParameterValue("HierarchyLevel2", HierarchyLevel2, "PositionInfo"); reportDocument.SetParameterValue("HierarchyLevel3", HierarchyLevel3, "PositionInfo"); return(reportDocument); } else { return(null); } }
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_QUALIFICATION, typeof(string)); tmpDataTable.Columns.Add(FIELD_INSTITUTION, typeof(string)); tmpDataTable.Columns.Add(FIELD_LEARNING_METHOD, typeof(string)); tmpDataTable.Columns.Add(FIELD_REMARK, 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 = EEmpQualification.db.select(dbConn, filter); foreach (EEmpQualification empQualification in list) { DataRow row = tmpDataTable.NewRow(); //if (IsIncludeInternalID) // row[FIELD_INTERNAL_ID] = ToHexDecWithCheckDigit(empQualification.EmpQualificationID); row[FIELD_EMP_NO] = empInfo.EmpNo; if (IsIncludeCurrentPositionInfo) { ImportEmpPersonalInfoProcess.AddEmployeeInfo(dbConn, row, empInfo.EmpID); ImportEmpPositionInfoProcess.AddEmployeePositionInfo(dbConn, row, empInfo.EmpID); } row[FIELD_FROM] = empQualification.EmpQualificationFrom; row[FIELD_TO] = empQualification.EmpQualificationTo; EQualification qualification = new EQualification(); qualification.QualificationID = empQualification.QualificationID; if (EQualification.db.select(dbConn, qualification)) { row[FIELD_QUALIFICATION] = IsShowDescription ? qualification.QualificationDesc : qualification.QualificationCode; } row[FIELD_INSTITUTION] = empQualification.EmpQualificationInstitution; if (!string.IsNullOrEmpty(empQualification.EmpQualificationLearningMethod)) { if (empQualification.EmpQualificationLearningMethod.Equals(EEmpQualification.LEARNING_METHOD_CODE_ONCAMPUS)) { row[FIELD_LEARNING_METHOD] = EEmpQualification.LEARNING_METHOD_DESC_ONCAMPUS; } else if (empQualification.EmpQualificationLearningMethod.Equals(EEmpQualification.LEARNING_METHOD_CODE_DISTANCE_LEARNING)) { row[FIELD_LEARNING_METHOD] = EEmpQualification.LEARNING_METHOD_DESC_DISTANCE_LEARNING; } } row[FIELD_REMARK] = empQualification.EmpQualificationRemark; if (IsIncludeSyncID) { row[FIELD_SYNC_ID] = empQualification.SynID; } tmpDataTable.Rows.Add(row); } } } if (IsIncludeCurrentPositionInfo) { ImportEmpPositionInfoProcess.RetriveHierarchyLevelHeader(dbConn, tmpDataTable); } return(tmpDataTable); }
// Constructor public CPGQualifiedDate( CPGDate date, EQualification qualification ) { m_date = date; m_eqQualification = qualification; }