コード例 #1
0
        public List <PowerSupply> GetAllPowerSupply()
        {
            var        connection = new SqlConnection(connectionString);
            SqlCommand command    = new SqlCommand("Select * FROM PowerSupply");

            List <PowerSupply> powersupplies = new List <PowerSupply>();

            command.Connection = connection;
            connection.Open();
            using (connection)
                using (var reader = command.ExecuteReader())
                {
                    for (int i = 0; i < 1; i++)
                    {
                        reader.Read();
                        string     brand   = reader.GetString(1);
                        string     model   = reader.GetString(2);
                        int        wattage = reader.GetInt32(3);
                        Formfactor size    = Formfactor.ATX;
                        switch (reader.GetString(4))
                        {
                        case "E-ATX":
                            size = Formfactor.E_ATX;
                            break;

                        case "Mini-ATX":
                            size = Formfactor.Mini_ATX;
                            break;

                        case "Micro-ATX":
                            size = Formfactor.Micro_ATX;
                            break;

                        case "ITX":
                            size = Formfactor.ITX;
                            break;
                        }
                        string effefficiency = reader.GetString(5);
                        bool   modularity    = false;
                        if (reader.GetSqlBoolean(6) == true)
                        {
                            modularity = true;
                        }
                        bool multigpu = false;
                        if (reader.GetSqlBoolean(7) == true)
                        {
                            multigpu = true;
                        }
                        int    maxsata   = reader.GetInt32(8);
                        string cabletype = reader.GetString(9);
                        double price     = reader.GetDouble(10);



                        PowerSupply powersupply = new PowerSupply(brand, model, wattage, size, effefficiency, modularity, multigpu, maxsata, cabletype, price);
                        powersupplies.Add(powersupply);
                    }
                }
            connection.Close();
            return(powersupplies);
        }
コード例 #2
0
 /// <summary>
 /// Creating new Entry
 /// </summary>
 /// <param name="brand">Manufacturer of Computer</param>
 /// <param name="model">Productname</param>
 /// <param name="cpu">Installed CPU</param>
 /// <param name="mb">Installed MB</param>
 /// <param name="gpu">Installed GPU</param>
 /// <param name="psu">Installed PSU</param>
 /// <param name="caseing">Used </param>
 /// <param name="fans">Additional Fans(Case fans not included)</param>
 /// <param name="drives">Installed Drives</param>
 /// <param name="ram">Installed RAM</param>
 public PreBuild(string brand, string model, Cpu cpu, Motherboard mb, GPU gpu, PowerSupply psu, Case caseing,
                 Fan[] fans, Drive[] drives, Ram ram)
 {
     this.Brand              = brand;
     this.Model              = model;
     this.Processor          = cpu;
     this.GProcessor         = gpu;
     this.Psu                = Psu;
     this.Enclousure         = caseing;
     this.ExtraFans          = fans;
     this.Internaldrives     = drives;
     this.RandomAccessMemory = ram;
 }