コード例 #1
0
        //录入设备
        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();
        }
コード例 #2
0
        //编辑设备信息
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            RoomClass       rc      = new RoomClass();
            var             a       = this.roomEquipment.SelectedItem;
            var             b       = a as DataRowView;
            int             _Eid    = Convert.ToInt32(b.Row[0]);
            int             _TypeId = Convert.ToInt32(b.Row[1]);
            MySqlDataReader reader;

            if (_TypeId == 4)
            {
                reader = rc.getWriteAndReaderInformation(_Eid);
                if (reader.Read())
                {
                    EditWriteAndReader ear = new EditWriteAndReader();
                    ear.ID.Content      = reader["READER_WRITER_ID"];
                    ear.numberStr.Text  = reader["NUMBER"].ToString();
                    ear.Ename.Text      = reader["NAME"].ToString();
                    ear.Etype.Text      = reader["TYPE_NAME"].ToString();
                    ear.room.Text       = reader["ROOM_NAME"].ToString();
                    ear.ip.Text         = reader["IP"].ToString();
                    ear.port.Text       = reader["PORT"].ToString();
                    ear.antenenSum.Text = reader["ANTENNA_SUM"].ToString();
                    if (int.Parse(reader["TYPE"].ToString()) == 0)
                    {
                        ear.type.SelectedIndex = 0;
                    }
                    else
                    {
                        ear.type.SelectedIndex = 1;
                    }
                    ear.sweepTime.Text  = reader["SWEEP_TIME"].ToString();
                    ear.userName.Text   = reader["USER_NAME"].ToString();
                    ear.createTime.Text = reader["CREATE_TIME"].ToString();
                    ear.Owner           = Window.GetWindow(this);
                    ear.ShowDialog();
                }
            }
            else
            {
                reader = rc.getEquipmentInfo(_Eid);
                if (reader.Read())
                {
                    EditEquipment ed = new EditEquipment();
                    ed.ID.Content     = reader["ID"];
                    ed.numberStr.Text = reader["NUMBER"].ToString();
                    ed.Ename.Text     = reader["NAME"].ToString();
                    //ed.Etype.Text = reader["TYPE_NAME"].ToString();
                    int status = int.Parse(reader["WORK_STATUS"].ToString());
                    if (status == 1)
                    {
                        ed.status.Text = "入库中";
                    }
                    else if (status == 0)
                    {
                        ed.status.Text = "正常使用";
                    }
                    else if (status == 15)
                    {
                        ed.status.Text = "保修中";
                    }
                    ed.room.Text = reader["ROOM_NAME"].ToString();
                    if (int.Parse(reader["POWER_SOURCE"].ToString()) == 0)
                    {
                        ed.powerSource.Text = "开";
                        //ed.powerSource.Foreground = Brush.TransformProperty;
                    }
                    else
                    {
                        ed.powerSource.Text = "关";
                    }
                    ed.userName.Text = reader["USER_NAME"].ToString();
                    ed.time.Text     = reader["STORAGE_TIME"].ToString();
                    reader           = rc.getTypeList();
                    ComboBox     types = ed.Etype;
                    ComboBoxItem TypeItems;
                    while (reader.Read())
                    {
                        if (int.Parse(reader["ID"].ToString()) != 4)
                        {
                            TypeItems         = new ComboBoxItem();
                            TypeItems.Content = reader["TYPE_NAME"];
                            TypeItems.Tag     = reader["ID"];
                            if (int.Parse(reader["ID"].ToString()) == _TypeId)
                            {
                                TypeItems.IsSelected = true;
                            }
                            types.Items.Add(TypeItems);
                        }
                    }

                    ed.Owner = Window.GetWindow(this);
                    ed.ShowDialog();
                }
            }
        }
コード例 #3
0
        //录入设备
        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();
        }
コード例 #4
0
ファイル: Room.xaml.cs プロジェクト: uwitec/gloryview-rfid
        //编辑设备信息
        private void Edit_Click(object sender, RoutedEventArgs e)
        {
            RoomClass rc=new RoomClass();
            var a = this.roomEquipment.SelectedItem;
            var b = a as DataRowView;
            int _Eid = Convert.ToInt32(b.Row[0]);
            int _TypeId = Convert.ToInt32(b.Row[1]);
            MySqlDataReader reader;
            if (_TypeId == 4)
            {
                reader = rc.getWriteAndReaderInformation(_Eid);
                if (reader.Read())
                {
                    EditWriteAndReader ear = new EditWriteAndReader();
                    ear.ID.Content = reader["READER_WRITER_ID"];
                    ear.numberStr.Text =reader["NUMBER"].ToString();
                    ear.Ename.Text = reader["NAME"].ToString();
                    ear.Etype.Text = reader["TYPE_NAME"].ToString();
                    ear.room.Text = reader["ROOM_NAME"].ToString();
                    ear.ip.Text = reader["IP"].ToString();
                    ear.port.Text = reader["PORT"].ToString();
                    ear.antenenSum.Text = reader["ANTENNA_SUM"].ToString();
                    if (int.Parse(reader["TYPE"].ToString()) == 0)
                    {
                        ear.type.SelectedIndex = 0;

                    }
                    else
                    {
                        ear.type.SelectedIndex = 1;
                    }
                    ear.sweepTime.Text = reader["SWEEP_TIME"].ToString();
                    ear.userName.Text = reader["USER_NAME"].ToString();
                    ear.createTime.Text = reader["CREATE_TIME"].ToString();
                    ear.Owner = Window.GetWindow(this);
                    ear.ShowDialog();
                }

            }
            else
            {
                 reader = rc.getEquipmentInfo(_Eid);
                if (reader.Read())
                {
                    EditEquipment ed = new EditEquipment();
                    ed.ID.Content = reader["ID"];
                    ed.numberStr.Text = reader["NUMBER"].ToString();
                    ed.Ename.Text = reader["NAME"].ToString();
                    //ed.Etype.Text = reader["TYPE_NAME"].ToString();
                    int status = int.Parse(reader["WORK_STATUS"].ToString());
                    if (status == 1)
                    {
                        ed.status.Text = "入库中";
                    }
                    else if (status == 0)
                    {
                        ed.status.Text = "正常使用";
                    }
                    else if (status == 15)
                    {
                        ed.status.Text = "保修中";
                    }
                    ed.room.Text = reader["ROOM_NAME"].ToString();
                    if (int.Parse(reader["POWER_SOURCE"].ToString()) == 0)
                    {
                        ed.powerSource.Text = "开";
                        //ed.powerSource.Foreground = Brush.TransformProperty;
                    }
                    else
                    {
                        ed.powerSource.Text = "关";
                    }
                    ed.userName.Text = reader["USER_NAME"].ToString();
                    ed.time.Text = reader["STORAGE_TIME"].ToString();
                    reader = rc.getTypeList();
                    ComboBox types = ed.Etype;
                    ComboBoxItem TypeItems;
                    while (reader.Read())
                    {
                        if (int.Parse(reader["ID"].ToString()) != 4)
                        {
                            TypeItems = new ComboBoxItem();
                            TypeItems.Content = reader["TYPE_NAME"];
                            TypeItems.Tag = reader["ID"];
                            if (int.Parse(reader["ID"].ToString()) == _TypeId)
                                TypeItems.IsSelected = true;
                            types.Items.Add(TypeItems);
                        }
                    }
                    
                    ed.Owner = Window.GetWindow(this);
                    ed.ShowDialog();
                }
            }
        }