private bool m_mthDoOK() { if (this.m_trvCheckItem.SelectedNode != null) { clsLISCheckItemNode node = (this.m_trvCheckItem.SelectedNode.Tag as clsLISCheckItemNode); if (node != null) { this.item = node; this.DialogResult = DialogResult.OK; this.Close(); return(true); } } return(false); }
public long m_lngGetDeviceQCCheckItemByID(System.Security.Principal.IPrincipal p_objPrincipal, string p_strDeviceID, out clsLISCheckItemNode[] p_objResultArr) { p_objResultArr = null; long lngRes = 0; if (string.IsNullOrEmpty(p_strDeviceID)) { return(lngRes); } com.digitalwave.security.clsPrivilegeHandleService objPrivilege = new clsPrivilegeHandleService(); lngRes = objPrivilege.m_lngCheckCallPrivilege(p_objPrincipal, "com.digitalwave.iCare.middletier.LIS.clsTmdQCLisServ", "m_lngGetDeviceQCCheckItemByID"); objPrivilege = null; if (lngRes <= 0) { return(lngRes); } try { string strSQL = @"select a.check_item_id_chr, a.rptno_chr from t_bse_lis_check_item a inner join t_bse_lis_check_item_dev_item b on b.check_item_id_chr = a.check_item_id_chr inner join t_bse_lis_device_check_item c on c.device_check_item_id_chr = b.device_check_item_id_chr and c.device_model_id_chr = b.device_model_id_chr and c.is_qc_item_int = 1 inner join t_bse_lis_device d on d.device_model_id_chr = c.device_model_id_chr and d.deviceid_chr = ?"; clsHRPTableService objHRPServ = new clsHRPTableService(); IDataParameter[] objDPArr = null; objHRPServ.CreateDatabaseParameter(1, out objDPArr); objDPArr[0].Value = p_strDeviceID; DataTable dtResult = null; lngRes = objHRPServ.lngGetDataTableWithParameters(strSQL, ref dtResult, objDPArr); objHRPServ = null; objDPArr = null; if (lngRes > 0 && dtResult != null && dtResult.Rows.Count > 0) { DataRow drTemp = null; clsLISCheckItemNode objTemp = null; int iRowCount = dtResult.Rows.Count; p_objResultArr = new clsLISCheckItemNode[iRowCount]; for (int iRow = 0; iRow < iRowCount; iRow++) { drTemp = dtResult.Rows[iRow]; objTemp = new clsLISCheckItemNode(); objTemp.strID = drTemp["check_item_id_chr"].ToString().Trim(); objTemp.strName = drTemp["rptno_chr"].ToString().Trim(); p_objResultArr[iRow] = objTemp; } } } catch (Exception objEx) { com.digitalwave.Utility.clsLogText objLogger = new clsLogText(); objLogger.LogDetailError(objEx, true); objLogger = null; } finally { p_strDeviceID = null; } return(lngRes); }
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); }