private void lvTPNItems_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (null == lvTPNItems.SelectedItem) { return; } TPNItemModel item = (TPNItemModel)lvTPNItems.SelectedItem; if ("_EXPAND_".Equals(item.Code)) { this.tpnView.showTPN(true); } else if ("_COLLAPSED_".Equals(item.Code)) { this.tpnView.showTPN(false); } else if (!string.IsNullOrWhiteSpace(item.Code) && (0 < item.ID)) { if (null == grdOrders.SelectedItem) { return; } DataRowView drv = (DataRowView)grdOrders.SelectedItem; string rcpID = drv.Row["RecipeID"].ToString(); tpnmonitor.frmCalDetail frmDetail = new tpnmonitor.frmCalDetail(); frmDetail.init(this.db, rcpID, item.Code); frmDetail.ShowDialog(); } }
/// <summary> /// 显示TPN项目值 /// </summary> /// <param name="_isAll"></param> private void listTPNValue(bool _isAll) { this.isExpandTPN = _isAll; this.icViewer.Items.Clear(); TPNItemModel md = null; this.tblTPNItem.DefaultView.Sort = "SeqNo"; this.tblTPNItem.DefaultView.RowFilter = "SeqNo>=1000"; foreach (DataRow row in this.tblTPNItem.DefaultView.ToTable().Rows) { md = new TPNItemModel(Convert.ToInt32(row["TPNItemID"].ToString()), row["ItemCode"].ToString(), row["ItemName"].ToString(), row["ItemValue"].ToString(), row["Unit"].ToString()); md.NormalValue = row["NormalValue"].ToString(); md.ResultOK = row["ResultOK"].ToString(); md.ValueDiret = row["ValueDiret"].ToString(); md.ValueSubPer = row["ValueSubPer"].ToString(); this.icViewer.Items.Add(md); } if (0 < this.icViewer.Items.Count) { this.icViewer.Items.Add(new TPNItemModel(0, "", "", "", "")); } this.tblTPNItem.DefaultView.RowFilter = "0<=SeqNo AND SeqNo<1000"; foreach (DataRow row in this.tblTPNItem.DefaultView.ToTable().Rows) { md = new TPNItemModel(Convert.ToInt32(row["TPNItemID"].ToString()), row["ItemCode"].ToString(), row["ItemName"].ToString(), row["ItemValue"].ToString(), row["Unit"].ToString()); md.ResultOK = row["ResultOK"].ToString(); this.icViewer.Items.Add(md); } if (this.isExpandTPN) { this.tblTPNItem.DefaultView.RowFilter = "SeqNo<0"; foreach (DataRow row in this.tblTPNItem.DefaultView.ToTable().Rows) { md = new TPNItemModel(Convert.ToInt32(row["TPNItemID"].ToString()), row["ItemCode"].ToString(), row["ItemName"].ToString(), row["ItemValue"].ToString(), row["Unit"].ToString()); md.ResultOK = row["ResultOK"].ToString(); this.icViewer.Items.Add(md); } this.icViewer.Items.Add(new TPNItemModel(0, "_COLLAPSED_", " ↑[收缩]", "", "")); } else { this.icViewer.Items.Add(new TPNItemModel(0, "_EXPAND_", " ↓[展开]", "", "")); } }