/// <summary> /// 显示项目编辑列表 /// </summary> private void DisProjList(TreeNodeCollection nodes) { foreach (TreeNode Pnode in nodes) { if (Pnode.Tag != null) { if (Pnode.Checked == true) { Inout_amount_dist dist = (Inout_amount_dist)Pnode.Tag; //UcInout_Amount.UcInout_Amount amount = new Inhospital_Info.Nurse_Record_Manager.UcInout_Amount.UcInout_Amount(Pnode.Text,dist.Id.ToString()); // UcInout_Amount amount = new UcInout_Amount(Pnode.Text,dist.Id.ToString()); //if (x < panel1.Width) //{ // amount.Location = new System.Drawing.Point(x, y); // x = x + amount.Width + 6; // panel1.Controls.Add(amount); //} //else //{ //x = 0; //y = y + amount.Height; //amount.Location = new System.Drawing.Point(x, y); //panel1.Controls.Add(amount); //} } } //else //{ // DisProjList(Pnode.Nodes); //} if (Pnode.Nodes.Count > 0) { DisProjList(Pnode.Nodes); } } }
/// <summary> /// 初始化树 /// </summary> private void InitTree() { DataSet ds_type = App.GetDataSet(Sql_Codetype); DataSet ds_amount_dist = App.GetDataSet(Sql_amount_dict); //TreeNode parentNode = new TreeNode(); //parentNode.Text = "出入液量"; if (ds_type != null) { DataTable dt = ds_type.Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow rowTemp in dt.Rows) { //父节点 TreeNode tempNode = new TreeNode(); //子节点 入液量方式 TreeNode childNode = new TreeNode(); childNode.Text = "入液量方式"; TreeNode Yinliunode = new TreeNode(); Yinliunode.Text = "引流"; tempNode.Name = rowTemp[0].ToString(); tempNode.Text = rowTemp[1].ToString(); if (rowTemp[1].ToString().Equals("入液量")) { DataSet ds = App.GetDataSet(Sql_Code_Way); DataTable dt1 = ds.Tables[0]; foreach (DataRow row1 in dt1.Rows) { TreeNode node = new TreeNode(); node.Text = row1[1].ToString(); node.Name = row1[0].ToString(); if (ds_amount_dist != null) { DataTable dt_amount_dist = ds_amount_dist.Tables[0]; if (dt_amount_dist.Rows.Count > 0) { foreach (DataRow row in dt_amount_dist.Rows) { Inout_amount_dist dist = new Inout_amount_dist(); dist.Id = Convert.ToInt32(row["id"]); dist.Item_code = row["item_code"].ToString(); dist.Item_name = row["item_name"].ToString(); dist.Item_value_type = row["item_value_type"].ToString(); dist.Item_unit = row["item_unit"].ToString(); if (row["display_seq"].ToString() != "") { dist.Display_seq = Convert.ToInt32(row["display_seq"].ToString()); } dist.Amount_flag = row["amount_flag"].ToString(); dist.Item_type = Convert.ToInt32(row["item_type"]); dist.Item_mode = Convert.ToInt32(row["item_mode"]); dist.Drainage_attribute = Convert.ToInt32(row["drainage_attribute"]); TreeNode cnode = new TreeNode(); cnode.Text = dist.Item_name; cnode.Tag = dist as object; cnode.Name = dist.Id.ToString(); if (dist.Item_type == 109) { if (dist.Item_mode.ToString() == node.Name) { node.Nodes.Add(cnode); } } } } } childNode.Nodes.Add(node); } tempNode.Nodes.Add(childNode); } else { if (ds_amount_dist != null) { DataTable dt_amount_dist = ds_amount_dist.Tables[0]; if (dt_amount_dist.Rows.Count > 0) { foreach (DataRow row in dt_amount_dist.Rows) { Inout_amount_dist dist = new Inout_amount_dist(); dist.Id = Convert.ToInt32(row["id"]); dist.Item_code = row["item_code"].ToString(); dist.Item_name = row["item_name"].ToString(); dist.Item_value_type = row["item_value_type"].ToString(); dist.Item_unit = row["item_unit"].ToString(); if (row["display_seq"].ToString() != "") { dist.Display_seq = Convert.ToInt32(row["display_seq"].ToString()); } dist.Amount_flag = row["amount_flag"].ToString(); dist.Item_type = Convert.ToInt32(row["item_type"]); dist.Item_mode = Convert.ToInt32(row["item_mode"]); dist.Drainage_attribute = Convert.ToInt32(row["drainage_attribute"]); TreeNode cnode = new TreeNode(); cnode.Text = dist.Item_name; cnode.Name = dist.Id.ToString(); cnode.Tag = dist as object; if (dist.Item_type == 110) { if (dist.Drainage_attribute != 1) { Yinliunode.Nodes.Add(cnode); } else { tempNode.Nodes.Add(cnode); } } } } } tempNode.Nodes.Add(Yinliunode); } treeView1.Nodes.Add(tempNode); } } } }
//public delegate void RefPanel(UcInout_AmountC ucAmount); /// <summary> /// 显示项目编辑列表 /// </summary> private void DisProjList(TreeNodeCollection nodes) { foreach (TreeNode Pnode in nodes) { if (Pnode.Tag != null) { if (Pnode.Checked == true) { if (!IsSameItem(Pnode)) { Inout_amount_dist dist = (Inout_amount_dist)Pnode.Tag; UcInout_Amount amount = new UcInout_Amount(Pnode.Text, dist.Id.ToString(), dist.Item_type.ToString(), dist.Item_mode.ToString()); //订阅事件 amount.EventRef += new RefPanel(Reflocation); amount.Name = dist.Id.ToString(); if (flag) { y = y + amount.Height; } amount.Location = new System.Drawing.Point(x, y); if (y > 325) { Pal.Size = new System.Drawing.Size(349, y + 5); } Pal = panel2; Pal.Controls.Add(amount); flag = true; //Inout_amount_dist dist = (Inout_amount_dist)Pnode.Tag; //UcInout_AmountC amount = new UcInout_AmountC(Pnode.Text, dist.Id.ToString()); //amount.Tag = Pnode.Text.ToString() + dist.Id.ToString(); ////订阅事件 //amount.EventRef += new RefPanel(Reflocation); //amount.Name = dist.Id.ToString(); //if (flag) // amount.Location = new System.Drawing.Point(x, y); //panel2.Controls.Add(amount); ////按钮位置判断 //if (Pnode.Text == "其它" && dist.Id.ToString() == "4") //{ // btncad4.Visible = true; // ax = x + 265; // ay = y; // btncad.Location = new System.Drawing.Point(ax, ay); //} //if (Pnode.Text == "其它" && dist.Id.ToString() == "8") //{ // btncad.Visible = true; // ax = x + 265; // ay = y; // btncad4.Location = new System.Drawing.Point(ax, ay); //} //if (Pnode.Text == "其它" && dist.Id.ToString() == "17") //{ // btncad17.Visible = true; // ax = x + 265; // ay = y; // btncad17.Location = new System.Drawing.Point(ax, ay); //} //if (Pnode.Text == "其它" && dist.Id.ToString() == "30") //{ // btncad30.Visible = true; // ax = x + 265; // ay = y; // btncad30.Location = new System.Drawing.Point(ax, ay); //} //y = y + amount.Height; //flag = true; } } } if (Pnode.Nodes.Count > 0) { DisProjList(Pnode.Nodes); } } }