//设备管理功能选择 private void Choice(object sender, RoutedEventArgs e) { TreeViewItem assets = ((sender as TreeView).SelectedItem as TreeViewItem); //MessageBox.Show(assets.Uid.ToString()); string assetsName = assets.Uid.ToString(); if (assetsName == null || "".Equals(assetsName)) { roomGrid.Children.Clear(); } if (roomGrid.Children != null) { roomGrid.Children.Clear(); } // ================================================================================== if (assetsName.Equals("Elist")) { EquipmentList equipment = RoomManagerBean.EquipmentList; RoomClass rc = new RoomClass(); EquipmentBean bean = new EquipmentBean(); DataSet equipmentSet = rc.queryEquipmentList(bean); DataSet typeSet = rc.queryType(); ComboBox box = RoomManagerBean.EquipmentList.type; if (box.HasItems) { box.Items.Clear(); } ComboBoxItem boxItem = new ComboBoxItem(); boxItem.Content = "请选择..."; boxItem.Tag = ""; boxItem.IsSelected = true; box.Items.Add(boxItem); //RoomManagerBean.DeviceClass.selectType.SelectedValuePath = ""; if (typeSet.Tables.Count > 0) { DataRowCollection drc = typeSet.Tables[0].Rows; for (int i = 0; i < drc.Count; i++) { DataRow dr = drc[i]; int typeId = (int)dr["ID"]; string typeName = dr["TYPE_NAME"].ToString(); ComboBoxItem boxItems = new ComboBoxItem(); boxItems.Content = typeName; boxItems.Tag = typeId; box.Items.Add(boxItems); //MessageBox.Show("typeId=" + typeId + " typeName=" + boxItems.Tag); } //MessageBox.Show("===" + equipmentSet.Tables.Count); RoomManagerBean.EquipmentList.page.ShowPages(RoomManagerBean.EquipmentList.equipment, equipmentSet, BaseRequest.PAGE_SIZE); roomGrid.Children.Add(equipment); equipment.SetValue(Grid.RowProperty, 0); equipment.SetValue(Grid.ColumnProperty, 0); } } else if (assetsName.Equals("Report")) { Statement statement = RoomManagerBean.Statement; roomGrid.Children.Add(statement); statement.SetValue(Grid.RowProperty, 0); statement.SetValue(Grid.ColumnProperty, 0); } else if (assetsName.Equals("Inventory")) { RoomClass rc = new RoomClass(); DataSet stockSet = rc.queryInventory(); RoomManagerBean.DeviceList.page.ShowPages(RoomManagerBean.DeviceList.stock, stockSet, BaseRequest.PAGE_SIZE); DeviceList deviceList = RoomManagerBean.DeviceList; roomGrid.Children.Add(deviceList); deviceList.SetValue(Grid.RowProperty, 0); deviceList.SetValue(Grid.ColumnProperty, 0); } else if (assetsName.Equals("Category")) { DeviceClass deviceClass = RoomManagerBean.DeviceClass; RoomClass room = new RoomClass(); QueryUser query = new QueryUser(); //query.Account = UserManagerBean.AddUser.queryAccount.Text; //query.UserName = UserManagerBean.AddUser.queryName.Text; DataSet set = room.queryType(); RoomManagerBean.DeviceClass.page.ShowPages(RoomManagerBean.DeviceClass.deviceData, set, BaseRequest.PAGE_SIZE); roomGrid.Children.Add(deviceClass); deviceClass.SetValue(Grid.RowProperty, 0); deviceClass.SetValue(Grid.ColumnProperty, 0); } else if (assetsName.Equals("HistoryEquipment")) { HistoryEquipment he = RoomManagerBean.HistoryEquipment; RoomClass rc = new RoomClass(); DataSet set = rc.queryHistoryEquipment(); he.page.ShowPages(he.historyEquipment, set, BaseRequest.PAGE_SIZE); roomGrid.Children.Add(he); he.SetValue(Grid.RowProperty, 0); he.SetValue(Grid.ColumnProperty, 0); } }