示例#1
0
 private void roomsTreeView()
 {
     RoomClass rc=new RoomClass();
     MySqlDataReader reader=rc.queryRoomsName();
     while(reader.Read())
     {
         TreeViewItem item = new TreeViewItem();
         //item.HeaderTemplate;
         item.Header=reader["ROOM_NAME"];
         item.Uid = reader["ID"].ToString();
         item.FontSize = 12;
         //item.Foreground = ;
         this.rooms.Items.Add(item);
     }
 }
示例#2
0
        private void roomsTreeView()
        {
            RoomClass       rc     = new RoomClass();
            MySqlDataReader reader = rc.queryRoomsName();

            while (reader.Read())
            {
                TreeViewItem item = new TreeViewItem();
                //item.HeaderTemplate;
                item.Header   = reader["ROOM_NAME"];
                item.Uid      = reader["ID"].ToString();
                item.FontSize = 12;
                //item.Foreground = ;
                this.rooms.Items.Add(item);
            }
        }
        //编辑新添加设备
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            EditEquipments  edit     = new EditEquipments();
            var             a        = this.comingGrild.SelectedItem;
            var             b        = a as DataRowView;
            int             _Eid     = Convert.ToInt32(b.Row[0]);
            EquipmentClass  _Eclass  = new EquipmentClass();
            RoomClass       room     = new RoomClass();
            MySqlDataReader reader   = _Eclass.editNewEquipment(_Eid);
            ComboBox        rooms    = edit.roomBox;
            ComboBoxItem    roomItem = new ComboBoxItem();

            if (reader.Read())
            {
                edit.ID.Content     = reader["ID"];
                edit.numberStr.Text = reader["NUMBER"].ToString();
                edit.Ename.Text     = reader["NAME"].ToString();
                edit.Etype.Content  = reader["TYPE_NAME"];
                roomItem.Content    = reader["ROOM_NAME"];
                roomItem.Tag        = reader["RID"];
                roomItem.IsSelected = true;
                rooms.Items.Add(roomItem);
                edit.UserName.Content   = reader["USER_NAME"];
                edit.CreateTime.Content = Convert.ToDateTime(reader["STORAGE_TIME"]).ToString(BaseRequest.DATE_TIME_FORMAT);
            }

            MySqlDataReader roomReader = room.queryRoomsName();

            while (roomReader.Read())
            {
                if (!reader["RID"].ToString().Equals(roomReader["ID"].ToString()))
                {
                    roomItem         = new ComboBoxItem();
                    roomItem.Content = roomReader["ROOM_NAME"];
                    roomItem.Tag     = roomReader["ID"];
                    rooms.Items.Add(roomItem);
                }
            }
            edit.Owner = Window.GetWindow(this);
            edit.ShowDialog();
        }
        private void Add_ReaderAndWrite(object sender, RoutedEventArgs e)
        {
            AddReaderWrider rw         = new AddReaderWrider();
            EquipmentClass  ec         = new EquipmentClass();
            RoomClass       rc         = new RoomClass();
            MySqlDataReader roomReader = rc.queryRoomsName();
            ComboBox        rooms      = rw.roomBox;
            ComboBoxItem    roomItem   = new ComboBoxItem();

            roomItem.Content    = "请选择...";
            roomItem.Tag        = "";
            roomItem.IsSelected = true;
            rooms.Items.Add(roomItem);
            while (roomReader.Read())
            {
                roomItem         = new ComboBoxItem();
                roomItem.Content = roomReader["ROOM_NAME"];
                roomItem.Tag     = roomReader["ID"];
                rooms.Items.Add(roomItem);
            }
            MySqlDataReader reader = ec.getWriderMaxId();

            if (reader.Read())
            {
                if ("".Equals(reader["ID"].ToString()) || reader["ID"] == null)
                {
                    int _Ecode = 100000;
                    rw.number.Text    = "100000";
                    rw.numberStr.Text = ReaderAndWriterConnection.getEPCCode(_Ecode);
                }
                else
                {
                    rw.number.Text    = reader["ID"].ToString();
                    rw.numberStr.Text = ReaderAndWriterConnection.getEPCCode(int.Parse(reader["ID"].ToString()));
                }
            }
            rw.Owner = Window.GetWindow(this);
            rw.ShowDialog();
        }
        //录入设备
        private void Add_NewEquipment(object sender, RoutedEventArgs e)
        {
            AddEquipment    add        = new AddEquipment();;
            EquipmentClass  equip      = new EquipmentClass();
            RoomClass       room       = new RoomClass();
            MySqlDataReader roomReader = room.queryRoomsName();
            MySqlDataReader typeReader = room.getTypeList();
            MySqlDataReader reader     = equip.getMaxId();

            if (reader.Read())
            {
                // ReaderAndWriterConnection EpcNumber = new ReaderAndWriterConnection();
                int i = 1;
                if (reader["ID"].ToString().Equals("") || reader["ID"] == null)
                {
                    add.ID.Content = i;

                    add.numberStr.Text = ReaderAndWriterConnection.getEPCCode(i);
                }
                else
                {
                    add.ID.Content     = reader["ID"];
                    add.numberStr.Text = ReaderAndWriterConnection.getEPCCode(int.Parse(reader["ID"].ToString()));
                }
            }
            ComboBox     rooms = add.roomBox;
            ComboBoxItem check = new ComboBoxItem();

            check.Content    = "请选择...";
            check.Tag        = "";
            check.IsSelected = true;
            rooms.Items.Add(check);
            while (roomReader.Read())
            {
                check         = new ComboBoxItem();
                check.Content = roomReader["ROOM_NAME"];
                check.Tag     = roomReader["ID"];
                rooms.Items.Add(check);
            }
            ComboBox     types     = add.typeBox;
            ComboBoxItem checkType = new ComboBoxItem();

            checkType.Content    = "请选择...";
            checkType.Tag        = "";
            checkType.IsSelected = true;
            types.Items.Add(checkType);
            while (typeReader.Read())
            {
                if (int.Parse(typeReader["ID"].ToString()) == 4)
                {
                    continue;
                }
                else
                {
                    ComboBoxItem TypeItems = new ComboBoxItem();
                    TypeItems.Content = typeReader["TYPE_NAME"];
                    TypeItems.Tag     = typeReader["ID"];
                    types.Items.Add(TypeItems);
                }
            }
            add.Owner = Window.GetWindow(this);
            add.ShowDialog();
        }
        //录入设备
        private void Add_NewEquipment(object sender, RoutedEventArgs e)
        {
            AddEquipment add = new AddEquipment(); ;
            EquipmentClass equip = new EquipmentClass();
            RoomClass room = new RoomClass();
            MySqlDataReader roomReader = room.queryRoomsName();
            MySqlDataReader typeReader = room.getTypeList();
            MySqlDataReader reader = equip.getMaxId();
            if (reader.Read())
            {
                // ReaderAndWriterConnection EpcNumber = new ReaderAndWriterConnection();
                int i = 1;
                if (reader["ID"].ToString().Equals("") || reader["ID"] == null)
                {

                    add.ID.Content = i;

                    add.numberStr.Text = ReaderAndWriterConnection.getEPCCode(i);

                }
                else
                {
                    add.ID.Content = reader["ID"];
                    add.numberStr.Text = ReaderAndWriterConnection.getEPCCode(int.Parse(reader["ID"].ToString()));

                }
            }
            ComboBox rooms = add.roomBox;
            ComboBoxItem check = new ComboBoxItem();
            check.Content = "请选择...";
            check.Tag = "";
            check.IsSelected = true;
            rooms.Items.Add(check);
            while (roomReader.Read())
            {
                check = new ComboBoxItem();
                check.Content = roomReader["ROOM_NAME"];
                check.Tag = roomReader["ID"];
                rooms.Items.Add(check);
            }
            ComboBox types = add.typeBox;
            ComboBoxItem checkType = new ComboBoxItem();
            checkType.Content = "请选择...";
            checkType.Tag = "";
            checkType.IsSelected = true;
            types.Items.Add(checkType);
            while (typeReader.Read())
            {
                if (int.Parse(typeReader["ID"].ToString()) == 4)
                {
                    continue;
                }
                else
                {
                    ComboBoxItem TypeItems = new ComboBoxItem();
                    TypeItems.Content = typeReader["TYPE_NAME"];
                    TypeItems.Tag = typeReader["ID"];
                    types.Items.Add(TypeItems);
                }
            }
            add.Owner = Window.GetWindow(this);
            add.ShowDialog();
        }
 private void Add_ReaderAndWrite(object sender, RoutedEventArgs e)
 {
     AddReaderWrider rw = new AddReaderWrider();
     EquipmentClass ec = new EquipmentClass();
     RoomClass rc = new RoomClass();
     MySqlDataReader roomReader = rc.queryRoomsName();
     ComboBox rooms = rw.roomBox;
     ComboBoxItem roomItem = new ComboBoxItem();
     roomItem.Content = "请选择...";
     roomItem.Tag = "";
     roomItem.IsSelected = true;
     rooms.Items.Add(roomItem);
     while (roomReader.Read())
     {
         roomItem = new ComboBoxItem();
         roomItem.Content = roomReader["ROOM_NAME"];
         roomItem.Tag = roomReader["ID"];
         rooms.Items.Add(roomItem);
     }
     MySqlDataReader reader = ec.getWriderMaxId();
     if (reader.Read())
     {
         if ("".Equals(reader["ID"].ToString()) || reader["ID"] == null)
         {
             int _Ecode = 100000;
             rw.number.Text = "100000";
             rw.numberStr.Text = ReaderAndWriterConnection.getEPCCode(_Ecode);
         }
         else
         {
             rw.number.Text = reader["ID"].ToString();
             rw.numberStr.Text = ReaderAndWriterConnection.getEPCCode(int.Parse(reader["ID"].ToString()));
         }
     }
     rw.Owner = Window.GetWindow(this);
     rw.ShowDialog();
 }
        //编辑新添加设备
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            EditEquipments edit = new EditEquipments();
            var a = this.comingGrild.SelectedItem;
            var b = a as DataRowView;
            int _Eid = Convert.ToInt32(b.Row[0]);
            EquipmentClass _Eclass = new EquipmentClass();
            RoomClass room = new RoomClass();
            MySqlDataReader reader = _Eclass.editNewEquipment(_Eid);
            ComboBox rooms = edit.roomBox;
            ComboBoxItem roomItem = new ComboBoxItem();
            if (reader.Read())
            {
                edit.ID.Content = reader["ID"];
                edit.numberStr.Text = reader["NUMBER"].ToString();
                edit.Ename.Text = reader["NAME"].ToString();
                edit.Etype.Content = reader["TYPE_NAME"];
                roomItem.Content = reader["ROOM_NAME"];
                roomItem.Tag = reader["RID"];
                roomItem.IsSelected = true;
                rooms.Items.Add(roomItem);
                edit.UserName.Content = reader["USER_NAME"];
                edit.CreateTime.Content = Convert.ToDateTime(reader["STORAGE_TIME"]).ToString(BaseRequest.DATE_TIME_FORMAT);
            }

            MySqlDataReader roomReader = room.queryRoomsName();
            while (roomReader.Read())
            {
                if (!reader["RID"].ToString().Equals(roomReader["ID"].ToString()))
                {
                    roomItem = new ComboBoxItem();
                    roomItem.Content = roomReader["ROOM_NAME"];
                    roomItem.Tag = roomReader["ID"];
                    rooms.Items.Add(roomItem);
                }
            }
            edit.Owner = Window.GetWindow(this);
            edit.ShowDialog();
        }