public void uc_configure(wsBaseItem bi, int mode = 0) { uc_BaseItem = bi; uc_deleteMode = mode; grid_modifyItem.DataContext = uc_BaseItem; }
public void SetNode(Node N) { if (N != null) { SelNode = N; if (N.bi != null) { baseItem = N.bi; id = (int)N.bi.ID; name = N.bi.Description; IsType = N.bi.IsType; IsCalibrated = N.bi.IsCalibrated; } if (N.ParentNode.bi != null) { HasParents = true; if (N.ParentNode.bi != null) { parentBaseItem = N.ParentNode.bi; parentID = (int)N.ParentNode.bi.ID; parentName = N.ParentNode.bi.Description; } } else { HasParents = false; parentBaseItem = N.bi; parentID = (int)N.bi.ID; parentName = N.bi.Description; } } }
//[DataMember] //public List<wsBaseItem> DBDATA //{ // get { return _dbdata; } //} //private List<wsBaseItem> _dbdata; private List <wsBaseItem> GetDBTableTree()//"SELECT * FROM tbl_DevType" { List <wsBaseItem> l = new List <wsBaseItem>(); using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString)) { SqlCommand cmd = new SqlCommand("SELECT * FROM tbl_DevType"); conn.Open(); cmd.Connection = conn; SqlDataReader Reader = cmd.ExecuteReader(); if (Reader.HasRows) { while (Reader.Read()) { wsBaseItem temp = new wsBaseItem(); temp.ID = (int)Reader["ID"]; temp.Description = (string)Reader["TypeName"]; if (!Reader.IsDBNull(Reader.GetOrdinal("Parent"))) { temp.ParentID = (int?)Reader["Parent"]; } else { temp.ParentID = null; } if (!Reader.IsDBNull(Reader.GetOrdinal("LinkToIcon"))) { temp.LinkToIcon = (string)Reader["LinkToIcon"]; } else { temp.LinkToIcon = null; } temp.IsType = true; if (!Reader.IsDBNull(Reader.GetOrdinal("IsCalibration"))) { temp.IsCalibrated = (bool)Reader["IsCalibration"]; } l.Add(temp); } } Reader.Close(); conn.Close(); } return(l); }
public Node(wsBaseItem data, int?parentID, GetDataFromDB f, Node parentNode) //,int? parent) { _parentNode = parentNode; _bi = data; bool itemType = (data == null) ? true : data.IsType; if (itemType == true) { this.GetChildList(parentID, f, this); } }
public void SetNode(wsBaseItem BI) { if (BI != null) { baseItem = BI; //parentID = id; id = (int)BI.ID; //parentName = name; name = BI.Description; IsType = BI.IsType; IsCalibrated = BI.IsCalibrated; //HasParents = false; } }
//---- Загрузить блок "Настройки раздела/класса" - uc_NodeOptions private void show_NodeOptions(wsBaseItem BI) { if (ucNodes == null) { ucNodes = new uc_NodeOptions(); } ucNodes.uc_configure(BI, tabControl_Tree.SelectedIndex); if (!panel_NodeOptions.Children.Contains(ucNodes)) { panel_NodeOptions.Children.Add(ucNodes); } ucNodes.w.Closed += new EventHandler(ucNodes_w_Closed); }
private List <wsBaseItem> GetDBPlaceTableTree_ex()//"SELECT * FROM tbl_DevPlace" { List <wsBaseItem> l = new List <wsBaseItem>(); using (SqlConnection conn = new SqlConnection(Configuration.ConnectionString)) { SqlCommand cmd = new SqlCommand("SELECT * FROM tbl_DevPlace"); conn.Open(); cmd.Connection = conn; SqlDataReader Reader = cmd.ExecuteReader(); if (Reader.HasRows) { while (Reader.Read()) { wsBaseItem temp = new wsBaseItem(); if (!Reader.IsDBNull(Reader.GetOrdinal("ID"))) { temp.ID = (int?)Reader["ID"]; } if (!Reader.IsDBNull(Reader.GetOrdinal("PlaceName"))) { temp.Description = (string)Reader["PlaceName"]; } if (!Reader.IsDBNull(Reader.GetOrdinal("Parent"))) { temp.ParentID = (int?)Reader["Parent"]; } else { temp.ParentID = null; } temp.IsType = true; l.Add(temp); } } Reader.Close(); cmd.CommandText = "SELECT ID,LongDescrRU,DevPlaceID FROM tbl_DevList"; Reader = cmd.ExecuteReader(); if (Reader.HasRows) { while (Reader.Read()) { wsBaseItem temp = new wsBaseItem(); if (!Reader.IsDBNull(Reader.GetOrdinal("ID"))) { temp.ID = (int)Reader["ID"]; } if (!Reader.IsDBNull(Reader.GetOrdinal("LongDescrRU"))) { temp.Description = (string)Reader["LongDescrRU"]; } if (!Reader.IsDBNull(Reader.GetOrdinal("DevPlaceID"))) { temp.ParentID = (int?)Reader["DevPlaceID"]; } temp.IsType = false; l.Add(temp); } } conn.Close(); } return(l); }