mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Update DB to version 11: Add fields and indexes to GPUs table.
This commit is contained in:
16
.editorconfig
Normal file
16
.editorconfig
Normal file
@@ -0,0 +1,16 @@
|
||||
[*]
|
||||
charset=utf-8
|
||||
end_of_line=lf
|
||||
trim_trailing_whitespace=false
|
||||
insert_final_newline=false
|
||||
indent_style=space
|
||||
indent_size=4
|
||||
|
||||
[{.babelrc,.stylelintrc,.eslintrc,jest.config,*.uplugin,*.bowerrc,*.jsb3,*.jsb2,*.json}]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
|
||||
[*.js.map]
|
||||
indent_style=space
|
||||
indent_size=2
|
||||
|
||||
@@ -178,7 +178,11 @@ namespace Cicm.Database
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
const string SQL = "INSERT INTO gpus (name)" + " VALUES (@name)";
|
||||
const string SQL =
|
||||
"INSERT INTO gpus (name, company, model_code, introduced, package, process, process_nm, " +
|
||||
"die_size, transistors)" +
|
||||
" VALUES (@name, @company, @model_code, @introduced, @package, " +
|
||||
"@process, @process_nm, @die_size, @transistors)";
|
||||
|
||||
dbcmd.CommandText = SQL;
|
||||
|
||||
@@ -210,7 +214,11 @@ namespace Cicm.Database
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbcmd.Transaction = trans;
|
||||
|
||||
string sql = "UPDATE gpus SET name = @name " + $"WHERE id = {entry.Id}";
|
||||
string sql =
|
||||
"UPDATE gpus SET name = @name, company = @company, model_code = @model_code, " +
|
||||
"introduced = @introduced, package = @package, process = @process, process_nm = @process_nm, " +
|
||||
"die_size = @die_size, transistors = @transistors " +
|
||||
$"WHERE id = {entry.Id}";
|
||||
|
||||
dbcmd.CommandText = sql;
|
||||
|
||||
@@ -252,25 +260,71 @@ namespace Cicm.Database
|
||||
IDbCommand dbcmd = dbCon.CreateCommand();
|
||||
|
||||
IDbDataParameter param1 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param2 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param3 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param4 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param5 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param6 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param7 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param8 = dbcmd.CreateParameter();
|
||||
IDbDataParameter param9 = dbcmd.CreateParameter();
|
||||
|
||||
param1.ParameterName = "@name";
|
||||
param2.ParameterName = "@company";
|
||||
param3.ParameterName = "@model_code";
|
||||
param4.ParameterName = "@introduced";
|
||||
param5.ParameterName = "@package";
|
||||
param6.ParameterName = "@process";
|
||||
param7.ParameterName = "@process_nm";
|
||||
param8.ParameterName = "@die_size";
|
||||
param9.ParameterName = "@transistors";
|
||||
|
||||
param1.DbType = DbType.String;
|
||||
param2.DbType = DbType.Int32;
|
||||
param3.DbType = DbType.String;
|
||||
param4.DbType = DbType.DateTime;
|
||||
param5.DbType = DbType.String;
|
||||
param6.DbType = DbType.String;
|
||||
param7.DbType = DbType.Double;
|
||||
param8.DbType = DbType.Double;
|
||||
param9.DbType = DbType.UInt64;
|
||||
|
||||
param1.Value = entry.Name;
|
||||
param2.Value = entry.Company == null ? null : (object)entry.Company.Id;
|
||||
param3.Value = entry.ModelCode;
|
||||
param4.Value = entry.Introduced == DateTime.MinValue ? null : (object)entry.Introduced;
|
||||
param5.Value = entry.Package;
|
||||
param6.Value = entry.Process;
|
||||
param7.Value = entry.ProcessNm;
|
||||
param8.Value = entry.DieSize;
|
||||
param9.Value = entry.Transistors;
|
||||
|
||||
dbcmd.Parameters.Add(param1);
|
||||
|
||||
return dbcmd;
|
||||
}
|
||||
|
||||
static List<Gpu> GpusFromDataTable(DataTable dataTable)
|
||||
List<Gpu> GpusFromDataTable(DataTable dataTable)
|
||||
{
|
||||
List<Gpu> entries = new List<Gpu>();
|
||||
|
||||
foreach(DataRow dataRow in dataTable.Rows)
|
||||
{
|
||||
Gpu entry = new Gpu {Id = (int)dataRow["id"], Name = (string)dataRow["name"]};
|
||||
Gpu entry = new Gpu
|
||||
{
|
||||
Id = (int)dataRow["id"],
|
||||
Name = (string)dataRow["name"],
|
||||
ModelCode = dataRow["model_code"] == DBNull.Value ? null : (string)dataRow["model_code"],
|
||||
Package = dataRow["package"] == DBNull.Value ? null : (string)dataRow["package"],
|
||||
Process = dataRow["process"] == DBNull.Value ? null : (string)dataRow["process"],
|
||||
ProcessNm = dataRow["process_nm"] == DBNull.Value ? 0 : (float)dataRow["process_nm"],
|
||||
DieSize = dataRow["die_size"] == DBNull.Value ? 0 : (float)dataRow["die_size"],
|
||||
Transistors = dataRow["transistors"] == DBNull.Value ? 0 : (long)dataRow["transistors"],
|
||||
Company = dataRow["company"] == DBNull.Value ? null : GetCompany((int)dataRow["company"]),
|
||||
Introduced = dataRow["introduced"] == DBNull.Value
|
||||
? DateTime.MinValue
|
||||
: Convert.ToDateTime(dataRow["introduced"])
|
||||
};
|
||||
|
||||
entries.Add(entry);
|
||||
}
|
||||
|
||||
@@ -49,111 +49,111 @@ namespace Cicm.Database
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
|
||||
Console.WriteLine("Creating table `admins`");
|
||||
dbCmd.CommandText = V10.Admins;
|
||||
dbCmd.CommandText = V11.Admins;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `browser_tests`");
|
||||
dbCmd.CommandText = V10.BrowserTests;
|
||||
dbCmd.CommandText = V11.BrowserTests;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `cicm_db`");
|
||||
dbCmd.CommandText = V10.CicmDb;
|
||||
dbCmd.CommandText = V11.CicmDb;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `companies`");
|
||||
dbCmd.CommandText = V10.Companies;
|
||||
dbCmd.CommandText = V11.Companies;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `computers`");
|
||||
dbCmd.CommandText = V10.Computers;
|
||||
dbCmd.CommandText = V11.Computers;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `consoles`");
|
||||
dbCmd.CommandText = V10.Consoles;
|
||||
dbCmd.CommandText = V11.Consoles;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `disk_formats`");
|
||||
dbCmd.CommandText = V10.DiskFormats;
|
||||
dbCmd.CommandText = V11.DiskFormats;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `forbidden`");
|
||||
dbCmd.CommandText = V10.Forbidden;
|
||||
dbCmd.CommandText = V11.Forbidden;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `gpus`");
|
||||
dbCmd.CommandText = V10.Gpus;
|
||||
dbCmd.CommandText = V11.Gpus;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `log`");
|
||||
dbCmd.CommandText = V10.Logs;
|
||||
dbCmd.CommandText = V11.Logs;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `money_donations`");
|
||||
dbCmd.CommandText = V10.MoneyDonations;
|
||||
dbCmd.CommandText = V11.MoneyDonations;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `music_synths`");
|
||||
dbCmd.CommandText = V10.MusicSynths;
|
||||
dbCmd.CommandText = V11.MusicSynths;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `news`");
|
||||
dbCmd.CommandText = V10.News;
|
||||
dbCmd.CommandText = V11.News;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `owned_computers`");
|
||||
dbCmd.CommandText = V10.OwnedComputers;
|
||||
dbCmd.CommandText = V11.OwnedComputers;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `owned_consoles`");
|
||||
dbCmd.CommandText = V10.OwnedConsoles;
|
||||
dbCmd.CommandText = V11.OwnedConsoles;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_sets`");
|
||||
dbCmd.CommandText = V10.InstructionSets;
|
||||
dbCmd.CommandText = V11.InstructionSets;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_set_extensions`");
|
||||
dbCmd.CommandText = V10.InstructionSetExtensions;
|
||||
dbCmd.CommandText = V11.InstructionSetExtensions;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `processors`");
|
||||
dbCmd.CommandText = V10.Processors;
|
||||
dbCmd.CommandText = V11.Processors;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `instruction_set_extensions_by_processor`");
|
||||
dbCmd.CommandText = V10.InstructionSetExtensionsByProcessor;
|
||||
dbCmd.CommandText = V11.InstructionSetExtensionsByProcessor;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `sound_synths`");
|
||||
dbCmd.CommandText = V10.SoundSynths;
|
||||
dbCmd.CommandText = V11.SoundSynths;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `iso3166_1_numeric`");
|
||||
dbCmd.CommandText = V10.Iso3166Numeric;
|
||||
dbCmd.CommandText = V11.Iso3166Numeric;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Filling table `iso3166_1_numeric`");
|
||||
dbCmd.CommandText = V10.Iso3166NumericValues;
|
||||
dbCmd.CommandText = V11.Iso3166NumericValues;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `companies`");
|
||||
dbCmd.CommandText = V10.CompaniesForeignKeys;
|
||||
dbCmd.CommandText = V11.CompaniesForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `computers`");
|
||||
dbCmd.CommandText = V10.ComputersForeignKeys;
|
||||
dbCmd.CommandText = V11.ComputersForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating foreign keys for table `consoles`");
|
||||
dbCmd.CommandText = V10.ConsolesForeignKeys;
|
||||
dbCmd.CommandText = V11.ConsolesForeignKeys;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `company_logos`");
|
||||
dbCmd.CommandText = V10.CompanyLogos;
|
||||
dbCmd.CommandText = V11.CompanyLogos;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
Console.WriteLine("Creating table `company_descriptions`");
|
||||
dbCmd.CommandText = V10.CompanyDescriptions;
|
||||
dbCmd.CommandText = V11.CompanyDescriptions;
|
||||
dbCmd.ExecuteNonQuery();
|
||||
|
||||
return true;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Cicm.Database
|
||||
public partial class Operations
|
||||
{
|
||||
/// <summary>Last known database version</summary>
|
||||
const int DB_VERSION = 10;
|
||||
const int DB_VERSION = 11;
|
||||
|
||||
readonly IDbConnection dbCon;
|
||||
readonly IDbCore dbCore;
|
||||
|
||||
@@ -118,6 +118,11 @@ namespace Cicm.Database
|
||||
UpdateDatabaseToV10();
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
UpdateDatabaseToV11();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OptimizeDatabase();
|
||||
@@ -948,6 +953,59 @@ namespace Cicm.Database
|
||||
dbCmd.Dispose();
|
||||
}
|
||||
|
||||
void UpdateDatabaseToV11()
|
||||
{
|
||||
Console.WriteLine("Updating database to version 11");
|
||||
|
||||
Console.WriteLine("Adding new columns to table `gpus`");
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
IDbTransaction trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = "ALTER TABLE `gpus` ADD COLUMN `company` INT NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `model_code` VARCHAR(45) NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `introduced` DATETIME NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `package` VARCHAR(45) NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `process` VARCHAR(45) NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `process_nm` FLOAT NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `die_size` FLOAT NULL;\n" +
|
||||
"ALTER TABLE `gpus` ADD COLUMN `transistors` BIGINT NULL;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Adding new indexes to table `gpus`");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText = "CREATE INDEX `idx_gpus_company` ON `gpus` (`company`);\n" +
|
||||
"CREATE INDEX `idx_gpus_model_code` ON `gpus` (`model_code`);\n" +
|
||||
"CREATE INDEX `idx_gpus_introduced` ON `gpus` (`introduced`);\n" +
|
||||
"CREATE INDEX `idx_gpus_package` ON `gpus` (`package`);\n" +
|
||||
"CREATE INDEX `idx_gpus_process` ON `gpus` (`process`);\n" +
|
||||
"CREATE INDEX `idx_gpus_process_nm` ON `gpus` (`process_nm`);\n" +
|
||||
"CREATE INDEX `idx_gpus_die_size` ON `gpus` (`die_size`);\n" +
|
||||
"CREATE INDEX `idx_gpus_transistors` ON `gpus` (`transistors`);";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Adding new foreign keys to table `gpus`");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
trans = dbCon.BeginTransaction();
|
||||
dbCmd.Transaction = trans;
|
||||
dbCmd.CommandText =
|
||||
"ALTER TABLE `gpus` ADD FOREIGN KEY `fk_gpus_company` (company) REFERENCES `companies` (`id`) ON UPDATE CASCADE;;";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
trans.Commit();
|
||||
dbCmd.Dispose();
|
||||
|
||||
Console.WriteLine("Setting new database version to 11...");
|
||||
dbCmd = dbCon.CreateCommand();
|
||||
dbCmd.CommandText = "INSERT INTO cicm_db (version) VALUES ('11')";
|
||||
dbCmd.ExecuteNonQuery();
|
||||
dbCmd.Dispose();
|
||||
}
|
||||
|
||||
void OptimizeDatabase()
|
||||
{
|
||||
IDbCommand dbCmd = dbCon.CreateCommand();
|
||||
|
||||
@@ -28,14 +28,32 @@
|
||||
// Copyright © 2003-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Cicm.Database.Schemas
|
||||
{
|
||||
/// <summary>Graphics Processing Unit</summary>
|
||||
public class Gpu
|
||||
{
|
||||
/// <summary>Company</summary>
|
||||
public Company Company;
|
||||
/// <summary>Size of die in square milimeters</summary>
|
||||
public float DieSize;
|
||||
/// <summary>ID</summary>
|
||||
public int Id;
|
||||
/// <summary>Datetime of introduction</summary>
|
||||
public DateTime Introduced;
|
||||
/// <summary>Model/SKU code</summary>
|
||||
public string ModelCode;
|
||||
/// <summary>Name</summary>
|
||||
public string Name;
|
||||
/// <summary>Package</summary>
|
||||
public string Package;
|
||||
/// <summary>Name of litography process</summary>
|
||||
public string Process;
|
||||
/// <summary>Nanometers of litography process</summary>
|
||||
public float ProcessNm;
|
||||
/// <summary>How many transistors in package</summary>
|
||||
public long Transistors;
|
||||
}
|
||||
}
|
||||
114
Cicm.Database/Schemas/Sql/V11.cs
Normal file
114
Cicm.Database/Schemas/Sql/V11.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
/******************************************************************************
|
||||
// Canary Islands Computer Museum Website
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : V10.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains SQL queries to create the database version 7.
|
||||
//
|
||||
// --[ License ] --------------------------------------------------------------
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright © 2003-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
namespace Cicm.Database.Schemas.Sql
|
||||
{
|
||||
public static class V11
|
||||
{
|
||||
public static readonly string Admins = V10.Admins;
|
||||
|
||||
public static readonly string BrowserTests = V10.BrowserTests;
|
||||
|
||||
public static readonly string CicmDb = "CREATE TABLE `cicm_db` (\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||
"`version` int(11) NOT NULL,\n" +
|
||||
"`updated` datetime DEFAULT CURRENT_TIMESTAMP,\n" +
|
||||
"PRIMARY KEY (`id`)\n" + ");\n" +
|
||||
"INSERT INTO cicm_db (version) VALUES ('11');";
|
||||
|
||||
public static readonly string Companies = V10.Companies;
|
||||
|
||||
public static readonly string Computers = V10.Computers;
|
||||
|
||||
public static readonly string Consoles = V10.Consoles;
|
||||
|
||||
public static readonly string DiskFormats = V10.DiskFormats;
|
||||
|
||||
public static readonly string Forbidden = V10.Forbidden;
|
||||
|
||||
public static readonly string Gpus = "CREATE TABLE `gpus` (\n" +
|
||||
"`id` int(11) NOT NULL AUTO_INCREMENT,\n" +
|
||||
"`name` char(128) NOT NULL DEFAULT '',\n" +
|
||||
"`company` int(11) DEFAULT NULL,\n" +
|
||||
"`model_code` varchar(45) DEFAULT NULL,\n" +
|
||||
"`introduced` datetime DEFAULT NULL,\n" +
|
||||
"`package` varchar(45) DEFAULT NULL,\n" +
|
||||
"`process` varchar(45) DEFAULT NULL,\n" +
|
||||
"`process_nm` float DEFAULT NULL,\n" +
|
||||
"`die_size` float DEFAULT NULL,\n" +
|
||||
"`transistors` bigint(20) DEFAULT NULL,\n" + "PRIMARY KEY (`id`),\n" +
|
||||
"KEY `idx_gpus_name` (`name`),\n" +
|
||||
"KEY `idx_gpus_company` (`company`),\n" +
|
||||
"KEY `idx_gpus_model_code` (`model_code`),\n" +
|
||||
"KEY `idx_gpus_introduced` (`introduced`),\n" +
|
||||
"KEY `idx_gpus_package` (`package`),\n" +
|
||||
"KEY `idx_gpus_process` (`process`),\n" +
|
||||
"KEY `idx_gpus_process_nm` (`process_nm`),\n" +
|
||||
"KEY `idx_gpus_die_size` (`die_size`),\n" +
|
||||
"KEY `idx_gpus_transistors` (`transistors`),\n" +
|
||||
"CONSTRAINT `fk_gpus_company` FOREIGN KEY (`company`) REFERENCES `companies` (`id`) ON UPDATE CASCADE);";
|
||||
|
||||
public static readonly string Logs = V10.Logs;
|
||||
|
||||
public static readonly string MoneyDonations = V10.MoneyDonations;
|
||||
|
||||
public static readonly string MusicSynths = V10.MusicSynths;
|
||||
|
||||
public static readonly string News = V10.News;
|
||||
|
||||
public static readonly string OwnedComputers = V10.OwnedComputers;
|
||||
|
||||
public static readonly string OwnedConsoles = V10.OwnedConsoles;
|
||||
|
||||
public static readonly string Processors = V10.Processors;
|
||||
|
||||
public static readonly string SoundSynths = V10.SoundSynths;
|
||||
|
||||
public static readonly string ComputersForeignKeys = V10.ComputersForeignKeys;
|
||||
|
||||
public static readonly string ConsolesForeignKeys = V10.ConsolesForeignKeys;
|
||||
|
||||
public static readonly string Iso3166Numeric = V10.Iso3166Numeric;
|
||||
|
||||
public static readonly string Iso3166NumericValues = V10.Iso3166NumericValues;
|
||||
|
||||
public static readonly string CompaniesForeignKeys = V10.CompaniesForeignKeys;
|
||||
|
||||
public static readonly string CompanyLogos = V10.CompanyLogos;
|
||||
|
||||
public static readonly string CompanyDescriptions = V10.CompanyDescriptions;
|
||||
|
||||
public static readonly string InstructionSets = V10.InstructionSets;
|
||||
|
||||
public static readonly string InstructionSetExtensions = V10.InstructionSetExtensions;
|
||||
|
||||
public static readonly string InstructionSetExtensionsByProcessor = V10.InstructionSetExtensionsByProcessor;
|
||||
}
|
||||
}
|
||||
@@ -28,19 +28,42 @@
|
||||
// Copyright © 2003-2018 Natalia Portillo
|
||||
*******************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace cicm_web.Models
|
||||
{
|
||||
public class Gpu
|
||||
{
|
||||
public int Id;
|
||||
public string Name;
|
||||
public Company Company;
|
||||
public float DieSize;
|
||||
public int Id;
|
||||
public DateTime Introduced;
|
||||
public string ModelCode;
|
||||
public string Name;
|
||||
public string Package;
|
||||
public string Process;
|
||||
public float ProcessNm;
|
||||
public long Transistors;
|
||||
|
||||
public static Gpu GetItem(int id)
|
||||
{
|
||||
Cicm.Database.Schemas.Gpu dbItem = Program.Database?.Operations.GetGpu(id);
|
||||
return dbItem == null ? null : new Gpu {Name = dbItem.Name, Id = dbItem.Id};
|
||||
return dbItem == null
|
||||
? null
|
||||
: new Gpu
|
||||
{
|
||||
Name = dbItem.Name,
|
||||
Company = Company.GetItem(dbItem.Company.Id),
|
||||
DieSize = dbItem.DieSize,
|
||||
Introduced = dbItem.Introduced,
|
||||
ModelCode = dbItem.ModelCode,
|
||||
Package = dbItem.Package,
|
||||
Process = dbItem.Process,
|
||||
ProcessNm = dbItem.ProcessNm,
|
||||
Transistors = dbItem.Transistors,
|
||||
Id = dbItem.Id
|
||||
};
|
||||
}
|
||||
|
||||
public static Gpu[] GetAllItems()
|
||||
@@ -52,7 +75,19 @@ namespace cicm_web.Models
|
||||
List<Gpu> items = new List<Gpu>();
|
||||
|
||||
foreach(Cicm.Database.Schemas.Gpu dbItem in dbItems)
|
||||
items.Add(new Gpu {Id = dbItem.Id, Name = dbItem.Name});
|
||||
items.Add(new Gpu
|
||||
{
|
||||
Name = dbItem.Name,
|
||||
Company = Company.GetItem(dbItem.Company.Id),
|
||||
DieSize = dbItem.DieSize,
|
||||
Introduced = dbItem.Introduced,
|
||||
ModelCode = dbItem.ModelCode,
|
||||
Package = dbItem.Package,
|
||||
Process = dbItem.Process,
|
||||
ProcessNm = dbItem.ProcessNm,
|
||||
Transistors = dbItem.Transistors,
|
||||
Id = dbItem.Id
|
||||
});
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<Version>3.0.99.180</Version>
|
||||
<Version>3.0.99.182</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user