protected DataTable loadExtraData(DataTable sourceTable) { DataTable destTable = sourceTable.Copy(); destTable.Columns.Add("CompanyCode", typeof(string)); destTable.Columns.Add("BusinessHierarchy", typeof(string)); destTable.Columns.Add("PositionCode", typeof(string)); destTable.Columns.Add("RankCode", typeof(string)); destTable.Columns.Add("StaffTypeCode", typeof(string)); destTable.Columns.Add("LeavePlanCode", typeof(string)); destTable.Columns.Add("PayGroupCode", typeof(string)); foreach (DataRow row in destTable.Rows) { EEmpPositionInfo empPos = EEmpPositionInfo.GetObject(dbConn, row["EmpPosID"]); if (empPos != null) { ECompany company = ECompany.GetObject(dbConn, row["CompanyID"]); if (company != null) { row["CompanyCode"] = company.CompanyCode; } row["BusinessHierarchy"] = empPos.GetBusinessHierarchyString(dbConn); EPosition position = EPosition.GetObject(dbConn, row["PositionID"]); if (position != null) { row["PositionCode"] = position.PositionCode; } ERank rank = ERank.GetObject(dbConn, row["RankID"]); if (rank != null) { row["RankCode"] = rank.RankCode; } EStaffType staffType = EStaffType.GetObject(dbConn, row["StaffTypeID"]); if (staffType != null) { row["StaffTypeCode"] = staffType.StaffTypeCode; } ELeavePlan leavePlan = ELeavePlan.GetObject(dbConn, row["LeavePlanID"]); if (leavePlan != null) { row["LeavePlanCode"] = leavePlan.LeavePlanCode; } EPayrollGroup payGroup = EPayrollGroup.GetObject(dbConn, (int)row["PayGroupID"]); if (payGroup != null) { row["PayGroupCode"] = payGroup.PayGroupCode; } } } return(destTable); }