示例#1
0
 private void Sava_Edit(object sender, RoutedEventArgs e)
 {
     if (this.roomName.Text.Equals(""))
     {
         MessageBox.Show("请输入机房名称!");
         return;
     }
     RoomBean bean = new RoomBean();
     RoomClass rc=new RoomClass();
     bean.RoomName = this.roomName.Text;
     bean.Floor = this.floor.Text;
     bean.Purpose = this.purpose.Text;
     bean.Belongs = this.belongs.Text;
     bean.Id = (int)this.roomId.Content;
     int state=rc.saveEditRoom(bean);
     if (state == BaseRequest.SUCCESS)
     {
         MessageBox.Show("操作成功!");
         this.edit_room.Visibility = Visibility.Hidden;
         RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
     }
 }
示例#2
0
 private void Add_Rooms(object sender, RoutedEventArgs e)
 {
     RoomBean bean=new RoomBean();
     if (this.roomName.Text.Equals(""))
     {
         MessageBox.Show("请输入机房名!");
         return;
     }
     RoomClass rc = new RoomClass();
     bean.RoomName = this.roomName.Text;
     if (!this.belongs.Text.Equals("")) bean.Belongs = this.belongs.Text;
     if (!this.purpose.Text.Equals("")) bean.Purpose = this.purpose.Text;
     if (!this.floor.Text.Equals("")) bean.Floor = this.floor.Text;
     int state=rc.AddRoom(bean);
     if (state == BaseRequest.HAS) MessageBox.Show("已存在该机房名!");
     else if (state == BaseRequest.SUCCESS)
     {
         MessageBox.Show("操作成功!");
         this.addRooms.Visibility = Visibility.Hidden;
         RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
     }
     else MessageBox.Show("系统异常,请连管理员!");
 }
示例#3
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);
            }
            
        }
示例#4
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);
            }
        }
示例#5
0
        private void Sava_Edit(object sender, RoutedEventArgs e)
        {
            if (this.roomName.Text.Equals(""))
            {
                MessageBox.Show("请输入机房名称!");
                return;
            }
            RoomBean  bean = new RoomBean();
            RoomClass rc   = new RoomClass();

            bean.RoomName = this.roomName.Text;
            bean.Floor    = this.floor.Text;
            bean.Purpose  = this.purpose.Text;
            bean.Belongs  = this.belongs.Text;
            bean.Id       = (int)this.roomId.Content;
            int state = rc.saveEditRoom(bean);

            if (state == BaseRequest.SUCCESS)
            {
                MessageBox.Show("操作成功!");
                this.edit_room.Visibility = Visibility.Hidden;
                RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
            }
        }
示例#6
0
        private void Add_Rooms(object sender, RoutedEventArgs e)
        {
            RoomBean bean = new RoomBean();

            if (this.roomName.Text.Equals(""))
            {
                MessageBox.Show("请输入机房名!");
                return;
            }
            RoomClass rc = new RoomClass();

            bean.RoomName = this.roomName.Text;
            if (!this.belongs.Text.Equals(""))
            {
                bean.Belongs = this.belongs.Text;
            }
            if (!this.purpose.Text.Equals(""))
            {
                bean.Purpose = this.purpose.Text;
            }
            if (!this.floor.Text.Equals(""))
            {
                bean.Floor = this.floor.Text;
            }
            int state = rc.AddRoom(bean);

            if (state == BaseRequest.HAS)
            {
                MessageBox.Show("已存在该机房名!");
            }
            else if (state == BaseRequest.SUCCESS)
            {
                MessageBox.Show("操作成功!");
                this.addRooms.Visibility = Visibility.Hidden;
                RoomManagerBean.AddRoom.page.ShowPages(RoomManagerBean.AddRoom.roomDate, rc.queryRoomsList(), BaseRequest.PAGE_SIZE);
            }
            else
            {
                MessageBox.Show("系统异常,请连管理员!");
            }
        }