/// <summary> /// 刷新节点 /// </summary> /// <param name="tnParent"></param> /// <param name="strValue"></param> private void refreshNode(TreeNode tnParent, string strValue) { if (tnParent == null) { return; } T_JB_Place tempType = (T_JB_Place)messages[tnParent]; if (tempType.C_id == strValue) { messages.Remove(tnParent); T_JB_Place newType = bll.GetById(strValue); tnParent.Text = newType.C_name; messages.Add(tnParent, newType); return; } TreeNode tnRet = null; foreach (TreeNode tn in tnParent.Nodes) { refreshNode(tn, strValue); //if (tnRet != null) break; } }
private void Init() { try { T_JB_Place mo = bll.GetById(id); if (mo == null) { MessageBox.Show("获取信息失败!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } else { this.lblId.Text = mo.C_id; this.txtName.Text = mo.C_name; this.lblPid.Text = mo.C_pre_id; this.txtMemo.Text = mo.C_memo; cbEnd.Checked = mo.I_end == 0 ? false : true; cbInuse.Checked = mo.I_inuse == 0 ? false : true; txtLength.Text = mo.I_length.ToString(); txtWidth.Text = mo.I_width.ToString(); txtMemo.Text = mo.C_memo; lblChildren.Text = mo.I_children.ToString(); } } catch (Exception) { MessageBox.Show("与数据库连接失败,请查看网络连接是否正常。如不能解决请与网络管理员联系!", "严重错误:", MessageBoxButtons.OK, MessageBoxIcon.Error); } }