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); }
protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView row = (DataRowView)e.Item.DataItem; CheckBox cb = (CheckBox)e.Item.FindControl("ItemSelect"); WebFormUtils.LoadKeys(db, row, cb); e.Item.FindControl("ItemSelect").Visible = toolBar.DeleteButton_Visible; //Start 0000068, Ricky So, 2014/08/06 if (ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_COMPANY) || ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H1) || ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H2) || ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H3)) { EEmpPersonalInfo obj = new EEmpPersonalInfo(); db.toObject(((DataRowView)e.Item.DataItem).Row, obj); Hashtable values = new Hashtable(); db.populate(obj, values); { HtmlInputHidden h = (HtmlInputHidden)e.Item.FindControl("EmpID"); h.Value = obj.EmpID.ToString(); Label m_EmpCompany = (Label)e.Item.FindControl("EmpCompany"); Label m_EmpHierarchy1 = (Label)e.Item.FindControl("EmpHierarchy1"); Label m_EmpHierarchy2 = (Label)e.Item.FindControl("EmpHierarchy2"); Label m_EmpHierarchy3 = (Label)e.Item.FindControl("EmpHierarchy3"); Binding ebinding = new Binding(dbConn, db); ebinding.init(Request, Session); ebinding.toControl(values); // find latest position DBFilter m_posFilter = new DBFilter(); m_posFilter.add(new Match("EmpID", obj.EmpID)); m_posFilter.add(new NullTerm("EmpPosEffTo")); foreach (EEmpPositionInfo m_pos in EEmpPositionInfo.db.select(dbConn, m_posFilter)) { if (ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_COMPANY)) { ECompany m_company = ECompany.GetObject(dbConn, m_pos.CompanyID); if (m_company != null) { m_EmpCompany.Text = m_company.CompanyCode; } } for (int i = 1; i <= 3; i++) // get first 3 hierarchy { DBFilter m_hierarchyLevelFilter = new DBFilter(); m_hierarchyLevelFilter.add(new Match("HLevelSeqNo", i)); foreach (EHierarchyLevel m_level in EHierarchyLevel.db.select(dbConn, m_hierarchyLevelFilter)) { DBFilter m_empHierarchyFilter = new DBFilter(); m_empHierarchyFilter.add(new Match("EmpPosID", m_pos.EmpPosID)); m_empHierarchyFilter.add(new Match("HLevelID", m_level.HLevelID)); foreach (EEmpHierarchy m_empHierarchy in EEmpHierarchy.db.select(dbConn, m_empHierarchyFilter)) { EHierarchyElement m_element = EHierarchyElement.GetObject(dbConn, m_empHierarchy.HElementID); if (m_element != null) { if (i == 1 && ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H1)) { m_EmpHierarchy1.Text = m_element.HElementCode; } else if (i == 2 && ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H2)) { m_EmpHierarchy2.Text = m_element.HElementCode; } else if (i == 3 && ESystemParameter.IsEnabled(dbConn, ESystemParameter.PARAM_CODE_EMP_LIST_SHOW_H3)) { m_EmpHierarchy3.Text = m_element.HElementCode; } } } } } } } } //End 0000068, Ricky So, 2014/08/06 }