예제 #1
0
        public static SysChar GetSysCharDataByID(string id)
        {
            SqlConnection sqlConnection = new SqlConnection(ConnectionAdres);

            SysChar    sysChar    = null;
            SqlCommand nameComand = new SqlCommand($"SELECT * FROM systemCharacteristic WHERE PCID = '{id}';", sqlConnection);

            sqlConnection.Open();
            SqlDataReader reader = nameComand.ExecuteReader();

            reader.Read();
            if (reader.HasRows)
            {
                var processorName    = reader.GetString(1);
                var processorModel   = reader.GetString(2);
                var RAM              = reader.GetString(3);
                var capacity         = reader.GetString(4);
                var operationgSystem = reader.GetString(5);

                sysChar = new SysChar {
                    processorName = processorName, processorModel = processorModel, RAM = RAM, capacity = capacity, operatingSystem = operationgSystem
                };
            }
            reader.Close();
            sqlConnection.Close();
            return(sysChar);
        }
예제 #2
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (pcIDBOX.Text != "")
     {
         SysChar sysChar = Querys.GetSysCharDataByID(pcIDBOX.Text);
         if (sysChar != null)
         {
             prcessorFirm.Text  = sysChar.processorName;
             prcessorModel.Text = sysChar.processorModel;
             RAM.Text           = sysChar.RAM;
             opacty.Text        = sysChar.capacity;
             OS.Text            = sysChar.operatingSystem;
         }
     }
     else
     {
         errorLabel.Content = "Поле должно быть заполненно";
     }
 }