/// <summary> /// 从缓存层获取指标 /// </summary> private void getIndicator() { indicatorList = IndicatorCache.getCache(); classList = CodeCache.getClass(); detectionList = CodeCache.getDetection(); subDetectionList = CodeCache.getSubDetection(); indicatorModels = (from indicator in indicatorList from classType in classList from detection in detectionList from subDetection in subDetectionList where indicator.classId == classType.id && indicator.detectionId == detection.id && indicator.subDetectionId == subDetection.id select new IndicatorModel() { indicatorId = indicator.id, classId = indicator.classId, className = classType.codeName, detectionId = indicator.detectionId, detectionName = detection.codeName, subDetectionId = indicator.subDetectionId, subDetectionName = subDetection.codeName, indicatorName = indicator.indicatorName, indicatorDesc = indicator.indicatorDesc, indicatorInstr = indicator.indicatorInstr, isObsolete = indicator.isObsolete == 1 ? "已废弃" : "生效中" }).ToList(); pagingPanel.setDetail(indicatorModels.Count); dgv_indicator.DataSource = indicatorModels.Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList(); }
private void getAllList() { indicatorList = IndicatorCache.getCache(); classList = CodeCache.getClass(); detectionList = CodeCache.getDetection(); subDetectionList = CodeCache.getSubDetection(); }
private void cbb_class_SelectedIndexChanged(object sender, EventArgs e) { cbb_detection.DataSource = null; if (cbb_class.DataSource != null) { List <Tb_code> detections = CodeCache.getDetection().Where(c => c.parentId == ((Tb_code)cbb_class.SelectedItem).id).ToList(); cbb_detection.DataSource = detections; cbb_detection.DisplayMember = "codeName"; cbb_detection.ValueMember = "id"; } }
private void buildTree() { var classList = CodeCache.getClass(); var detectionList = CodeCache.getDetection(); var subDetectionList = CodeCache.getSubDetection(); foreach (Tb_code classItem in classList) { var classNode = addNode(rootNode, classItem); foreach (Tb_code detectionItem in detectionList.Where(c => c.parentId == classItem.id)) { var detectionNode = addNode(classNode, detectionItem); foreach (Tb_code subDetectionItem in subDetectionList.Where(c => c.parentId == detectionItem.id)) { addNode(detectionNode, subDetectionItem); } } } }
private void traversalNode(Node pNode) { if (pNode.HasChildNodes) { foreach (Node node in pNode.Nodes) { if (node.Style != null) { if (node.Style.BackColor == Color.LawnGreen)//修改过的node { var tb_code = node.Tag as Tb_code; tb_code.codeName = node.Text; CodeCache.addCache(tb_code); node.Style = null; } if (node.Style.BackColor == Color.Red)//新增的node { Tb_code tb_code = new Tb_code(); tb_code.codeName = node.Text; if (node.Level == 2)//检测内容 { tb_code.codeType = 6; tb_code.id = CodeCache.getDetection().Count == 0 ? 6000 : CodeCache.getDetection().Max(c => c.id) + 1; //检测内容从6000开始 } if (node.Level == 3) //检测分项 { tb_code.codeType = 7; tb_code.id = CodeCache.getSubDetection().Count == 0 ? 7000 : CodeCache.getSubDetection().Max(c => c.id) + 1;//检测分项从7000开始 } tb_code.parentId = (node.Parent.Tag as Tb_code).id; CodeCache.addCache(tb_code); node.Style = null; node.Tag = tb_code;//将code赋给tag,以便在新增node的新增子node中,可以找到parentId } } traversalNode(node); } } }