Exemplo n.º 1
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();
                }
            }
        }
Exemplo n.º 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();
                }
            }
        }