Ejemplo n.º 1
0
 private void SaveEdit_Click(object sender, RoutedEventArgs e)
 {
     ComboBoxItem type = (ComboBoxItem)this.Etype.SelectedItem;
     if (this.Ename.Text.Equals(""))
     {
         JXMessageBox.Show(this, "设备名称不准为空!", MsgImage.Error);
         return;
     }
     if (type.Tag.ToString().Equals(""))
     {
         JXMessageBox.Show(this, "非法操作!", MsgImage.Error);
         return;
     }
     RoomClass rc = new RoomClass();
     int state = rc.updateEquipmentInformation(int.Parse(this.ID.Content.ToString()), this.Ename.Text,
          int.Parse(type.Tag.ToString()));
     if (state == BaseRequest.SUCCESS)
     {
         Room roomBean = RoomManagerBean.Room;
         EquipmentClass ec = new EquipmentClass();
         DataSet set = ec.getEquipmentInformationByRoom(int.Parse(roomBean.roomId.Text));
         roomBean.page.ShowPages(roomBean.roomEquipment, set, BaseRequest.PAGE_SIZE);
         JXMessageBox.Show(this, "编辑信息已保存.", MsgImage.Success);
         this.Close();
     }
     else
     {
         JXMessageBox.Show(this, "保存失败!", MsgImage.Error);
     }
 }
Ejemplo n.º 2
0
        //机房选择
        private void SelectRoom(object sender, RoutedEventArgs e)
        {
            TreeViewItem roomId = ((sender as TreeView).SelectedItem as TreeViewItem);

            string  id = roomId.Uid.ToString();
            
            if (roomGrid.Children != null) roomGrid.Children.Clear();
            if ("roomName".Equals(id))
            {
                AddRoom addRoom = RoomManagerBean.AddRoom;
                RoomClass room = new RoomClass();
                QueryUser query = new QueryUser();
                //query.Account = UserManagerBean.AddUser.queryAccount.Text;
                //query.UserName = UserManagerBean.AddUser.queryName.Text;
                DataSet set = room.queryRoomsList();
                RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, set, BaseRequest.PAGE_SIZE);
                roomGrid.Children.Add(addRoom);
                addRoom.SetValue(Grid.RowProperty, 0);
                addRoom.SetValue(Grid.ColumnProperty, 0);
            }
            else if (id.Equals("EquipmentInfo")) { }

            else if (id.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 (id.Equals("Report"))
            {
                Statement statement = RoomManagerBean.Statement;
                roomGrid.Children.Add(statement);
                statement.SetValue(Grid.RowProperty, 0);
                statement.SetValue(Grid.ColumnProperty, 0);
            }
            else if (id.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 (id.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 (id.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);
            }
            else
            {
                Room roomBean = RoomManagerBean.Room;
                EquipmentClass ec = new EquipmentClass();
                roomBean.roomId.Text = id;
                DataSet set = ec.getEquipmentInformationByRoom(int.Parse(id));
                roomBean.page.ShowPages(roomBean.roomEquipment, set, BaseRequest.PAGE_SIZE);
                roomBean.roomName.Content = roomId.Header.ToString();
                roomGrid.Children.Add(roomBean);
                roomBean.SetValue(Grid.RowProperty, 0);
                roomBean.SetValue(Grid.ColumnProperty, 0);
            }
            
        }