コード例 #1
0
 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();
 }