public long m_lngGetCheckItemTree(out clsLISUserGroupNode root) { root = null; long lngRes = 0; try { lngRes = m_objSvc.m_lngGetCheckItemTree(m_objPrincipal, out root); } catch { lngRes = 0; } return(lngRes); }
private void m_mthLoadData() { clsLISUserGroupNode root = null; clsSchBaseInfoSmp.s_object.m_lngGetCheckItemTree(out root); if (root != null) { TreeNode rootNode = new TreeNode(); m_mthMakeGroupNode(root, rootNode); foreach (TreeNode node in rootNode.Nodes) { this.Nodes.Add(node); } } }
private void m_mthMakeGroupNode(clsLISUserGroupNode parent, TreeNode parentNode) { if (parent == null || parentNode == null) { return; } if (parent.objChildNodes != null) { foreach (clsLISUserGroupNode groupnode in parent.objChildNodes) { TreeNode node = new TreeNode(); node.Text = groupnode.strName; node.Tag = groupnode; node.ImageIndex = 0; node.SelectedImageIndex = 0; parentNode.Nodes.Add(node); m_mthMakeGroupNode(groupnode, node); } } if (parent.objUnitNodes != null) { foreach (clsLISApplyUnitNode unitNode in parent.objUnitNodes) { TreeNode node = new TreeNode(); node.Text = unitNode.Name; node.ImageIndex = 1; node.SelectedImageIndex = 1; node.Tag = unitNode; if (unitNode.objItems != null) { foreach (clsLISCheckItemNode itemNode in unitNode.objItems) { TreeNode itemTreeNode = new TreeNode(); itemTreeNode.Text = itemNode.strName; itemTreeNode.ImageIndex = 2; itemTreeNode.SelectedImageIndex = 2; itemTreeNode.Tag = itemNode; node.Nodes.Add(itemTreeNode); } } parentNode.Nodes.Add(node); } } }
public long m_lngGetCheckItemTree(System.Security.Principal.IPrincipal p_objPrincipal, out clsLISUserGroupNode root) { long lngRes = 0; root = null; clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege (p_objPrincipal, "com.digitalwave.iCare.middletier.clsSchBaseInfoSvc", "m_lngGetCheckItemTree"); if (lngRes <= 0) { return(-1); } com.digitalwave.iCare.middletier.HRPService.clsHRPTableService objHRPSvc = new clsHRPTableService(); #region SQL string strSQL1 = @"SELECT t1.check_item_id_chr, t1.check_item_name_vchr FROM t_bse_lis_check_item t1"; string strSQL2 = @"SELECT t1.apply_unit_id_chr, t1.apply_unit_name_vchr FROM t_aid_lis_apply_unit t1"; string strSQL3 = @"SELECT t1.user_group_id_chr, t1.user_group_name_vchr FROM t_aid_lis_appuser_group t1"; string strSQL4 = @"select check_item_id_chr, apply_unit_id_chr, print_seq_int from t_aid_lis_apply_unit_detail"; string strSQL5 = @"SELECT user_group_id_chr, apply_unit_id_chr FROM t_aid_lis_appuser_group_detail"; string strSQL6 = @"SELECT user_group_id_chr, child_user_group_id_chr FROM t_aid_lis_appuser_group_relate"; #endregion DataTable dtbResultItem = null; DataTable dtbResultUnit = null; DataTable dtbResultUnitDetail = null; DataTable dtbResultGroup = null; DataTable dtbResultGroupDetail = null; DataTable dtbResultGroupRelate = null; try { lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL1, ref dtbResultItem); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL2, ref dtbResultUnit); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL3, ref dtbResultGroup); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL4, ref dtbResultUnitDetail); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL5, ref dtbResultGroupDetail); lngRes = objHRPSvc.lngGetDataTableWithoutParameters(strSQL6, ref dtbResultGroupRelate); System.Collections.Hashtable hasItem = new Hashtable(); System.Collections.Hashtable hasUnit = new Hashtable(); System.Collections.Hashtable hasGroup = new Hashtable(); System.Collections.Hashtable hasTopGroup = new Hashtable(); if (dtbResultItem != null) { foreach (DataRow dtrItem in dtbResultItem.Rows) { clsLISCheckItemNode node = new clsLISCheckItemNode(); node.strID = dtrItem["check_item_id_chr"].ToString(); node.strName = dtrItem["check_item_name_vchr"].ToString(); hasItem.Add(node.strID, node); } } if (dtbResultUnit != null) { foreach (DataRow dtrUnit in dtbResultUnit.Rows) { clsLISApplyUnitNode node = new clsLISApplyUnitNode(); node.strID = dtrUnit["APPLY_UNIT_ID_CHR"].ToString(); node.Name = dtrUnit["APPLY_UNIT_NAME_VCHR"].ToString(); hasUnit.Add(node.strID, node); } } if (dtbResultGroup != null) { foreach (DataRow dtrGroup in dtbResultGroup.Rows) { clsLISUserGroupNode node = new clsLISUserGroupNode(); node.strID = dtrGroup["USER_GROUP_ID_CHR"].ToString(); node.strName = dtrGroup["USER_GROUP_NAME_VCHR"].ToString(); hasGroup.Add(node.strID, node); hasTopGroup.Add(node.strID, node); } } if (dtbResultUnitDetail != null) { foreach (DataRow dtrUnitDetail in dtbResultUnitDetail.Rows) { string strUnitID = dtrUnitDetail["APPLY_UNIT_ID_CHR"].ToString(); string strItemID = dtrUnitDetail["CHECK_ITEM_ID_CHR"].ToString(); if (hasUnit.ContainsKey(strUnitID) && hasItem.ContainsKey(strItemID)) { if (((clsLISApplyUnitNode)hasUnit[strUnitID]).objItems == null) { ((clsLISApplyUnitNode)hasUnit[strUnitID]).objItems = new System.Collections.Generic.List <clsLISCheckItemNode>(); } ((clsLISApplyUnitNode)hasUnit[strUnitID]).objItems.Add((clsLISCheckItemNode)hasItem[strItemID]); } } } hasItem = null; if (dtbResultGroupDetail != null) { foreach (DataRow dtrGroupDetail in dtbResultGroupDetail.Rows) { string strGroupID = dtrGroupDetail["USER_GROUP_ID_CHR"].ToString(); string strUnitID = dtrGroupDetail["APPLY_UNIT_ID_CHR"].ToString(); if (hasGroup.ContainsKey(strGroupID) && hasUnit.ContainsKey(strUnitID)) { if (((clsLISUserGroupNode)hasGroup[strGroupID]).objUnitNodes == null) { ((clsLISUserGroupNode)hasGroup[strGroupID]).objUnitNodes = new System.Collections.Generic.List <clsLISApplyUnitNode>(); } ((clsLISUserGroupNode)hasGroup[strGroupID]).objUnitNodes.Add((clsLISApplyUnitNode)hasUnit[strUnitID]); } } } hasUnit = null; if (dtbResultGroupRelate != null) { foreach (DataRow dtrGroupRelate in dtbResultGroupRelate.Rows) { string strGroupID1 = dtrGroupRelate["USER_GROUP_ID_CHR"].ToString(); string strGroupID2 = dtrGroupRelate["CHILD_USER_GROUP_ID_CHR"].ToString(); if (hasGroup.ContainsKey(strGroupID1) && hasGroup.ContainsKey(strGroupID2)) { if (((clsLISUserGroupNode)hasGroup[strGroupID1]).objChildNodes == null) { ((clsLISUserGroupNode)hasGroup[strGroupID1]).objChildNodes = new System.Collections.Generic.List <clsLISUserGroupNode>(); } ((clsLISUserGroupNode)hasGroup[strGroupID1]).objChildNodes.Add((clsLISUserGroupNode)hasGroup[strGroupID2]); hasTopGroup.Remove(strGroupID2); } } } hasGroup = null; root = new clsLISUserGroupNode(); root.objChildNodes = new System.Collections.Generic.List <clsLISUserGroupNode>(); foreach (clsLISUserGroupNode groupNode in hasTopGroup.Values) { root.objChildNodes.Add(groupNode); } hasTopGroup = null; } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); objLogger.LogError(objEx); lngRes = 0; root = null; } return(lngRes); }