Remove unneeded code that has been substituted by Entity Framework.

This commit is contained in:
2018-08-06 23:48:38 +01:00
parent 36bc2b694e
commit 83ba8cf568
74 changed files with 1 additions and 11251 deletions

View File

@@ -1,206 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Company.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Company model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using Cicm.Database;
using Cicm.Database.Schemas;
using Markdig;
namespace cicm_web.Models
{
public class CompanyWithItems
{
public string Address;
public string City;
public MachineMini[] Computers;
public MachineMini[] Consoles;
public Iso3166 Country;
public string Description;
public string Facebook;
public DateTime Founded;
public int Id;
public CompanyLogo LastLogo;
public CompanyLogo[] Logos;
public string Name;
public string PostalCode;
public string Province;
public DateTime Sold;
public Cicm.Database.Schemas.Company SoldTo;
public CompanyStatus Status;
public string Twitter;
public string Website;
public static CompanyWithItems GetItem(int id)
{
Cicm.Database.Schemas.Company dbItem = Program.Database?.Operations.GetCompany(id);
MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
return dbItem == null
? null
: new CompanyWithItems
{
Name = dbItem.Name,
Id = dbItem.Id,
Computers = ComputerMini.GetItemsWithCompany(id, dbItem.Name),
Consoles = ConsoleMini.GetItemsWithCompany(id, dbItem.Name),
Address = dbItem.Address,
City = dbItem.City,
Country = dbItem.Country,
Facebook = dbItem.Facebook,
Founded = dbItem.Founded,
PostalCode = dbItem.PostalCode,
Province = dbItem.Province,
Sold = dbItem.Sold,
SoldTo = dbItem.SoldTo,
Status = dbItem.Status,
Twitter = dbItem.Twitter,
Website = dbItem.Website,
Logos = dbItem.Logos,
LastLogo = dbItem.LastLogo,
Description =
dbItem.Description == null ? null : Markdown.ToHtml(dbItem.Description, pipeline)
};
}
public static CompanyWithItems[] GetAllItems()
{
List<Cicm.Database.Schemas.Company> dbItems = null;
bool? result = Program.Database?.Operations.GetCompanies(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
return dbItems.Select(t => new CompanyWithItems
{
Id = t.Id,
Name = t.Name,
Computers = ComputerMini.GetItemsWithCompany(t.Id, t.Name),
Consoles = ConsoleMini.GetItemsWithCompany(t.Id, t.Name),
Address = t.Address,
City = t.City,
Country = t.Country,
Facebook = t.Facebook,
Founded = t.Founded,
PostalCode = t.PostalCode,
Province = t.Province,
Sold = t.Sold,
SoldTo = t.SoldTo,
Status = t.Status,
Twitter = t.Twitter,
Website = t.Website,
Logos = t.Logos,
LastLogo = t.LastLogo,
Description = t.Description == null ? null : Markdown.ToHtml(t.Description, pipeline)
}).OrderBy(t => t.Name).ToArray();
}
public static CompanyWithItems[] GetItemsStartingWithLetter(char letter)
{
List<Cicm.Database.Schemas.Company> dbItems = null;
bool? result = Program.Database?.Operations.GetCompanies(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
MarkdownPipeline pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
return dbItems
.Where(t => t.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase))
.Select(t => new CompanyWithItems
{
Id = t.Id,
Name = t.Name,
Computers = ComputerMini.GetItemsWithCompany(t.Id, t.Name),
Consoles = ConsoleMini.GetItemsWithCompany(t.Id, t.Name),
Address = t.Address,
City = t.City,
Country = t.Country,
Facebook = t.Facebook,
Founded = t.Founded,
PostalCode = t.PostalCode,
Province = t.Province,
Sold = t.Sold,
SoldTo = t.SoldTo,
Status = t.Status,
Twitter = t.Twitter,
Website = t.Website,
Logos = t.Logos,
LastLogo = t.LastLogo,
Description = t.Description == null ? null : Markdown.ToHtml(t.Description, pipeline)
}).OrderBy(t => t.Name).ToArray();
}
}
public class Company
{
public int Id;
public CompanyLogo LastLogo;
public string Name;
public static Company GetItem(int id)
{
Cicm.Database.Schemas.Company dbItem = Program.Database?.Operations.GetCompany(id);
return dbItem == null ? null : new Company {Name = dbItem.Name, Id = dbItem.Id, LastLogo = dbItem.LastLogo};
}
public static Company[] GetAllItems()
{
List<Cicm.Database.Schemas.Company> dbItems = null;
bool? result = Program.Database?.Operations.GetCompanies(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.Select(t => new Company {Id = t.Id, Name = t.Name, LastLogo = t.LastLogo})
.OrderBy(t => t.Name).ToArray();
}
public static Company[] GetItemsStartingWithLetter(char letter)
{
List<Cicm.Database.Schemas.Company> dbItems = null;
bool? result =
Program.Database?.Operations.GetCompanies(out dbItems, letter);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.Select(t => new Company {Id = t.Id, Name = t.Name, LastLogo = t.LastLogo})
.OrderBy(t => t.Name).ToArray();
}
public static Company[] GetItemsByCountry(int countryCode)
{
List<Cicm.Database.Schemas.Company> dbItems = null;
bool? result =
Program.Database?.Operations.GetCompanies(out dbItems, countryCode);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.Select(t => new Company {Id = t.Id, Name = t.Name, LastLogo = t.LastLogo})
.OrderBy(t => t.Name).ToArray();
}
}
}

View File

@@ -1,136 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Computer.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Videogame console model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
namespace cicm_web.Models
{
public static class Computer
{
public static Machine[] GetAllItems()
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<Machine> items = new List<Machine>();
return dbItems.Select(Machine.TransformItem).OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static Machine[] GetItemsFromCompany(int id)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id).Select(Machine.TransformItem).OrderBy(t => t.Name).ToArray();
}
public static Machine GetItem(int id)
{
Cicm.Database.Schemas.Machine dbItem = Program.Database?.Operations.GetComputer(id);
return dbItem == null ? null : Machine.TransformItem(dbItem);
}
}
public static class ComputerMini
{
public static MachineMini[] GetAllItems()
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems) items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsStartingWithLetter(char letter)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
if(dbItem.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase))
items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsFromYear(int year)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
if(dbItem.Introduced.Year == year)
items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsWithCompany(int id, string companyName)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id)
.Select(t => new MachineMini
{
Company = new Company {Id = id, Name = companyName},
Id = t.Id,
Name = t.Name
}).OrderBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsFromCompany(int id)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id).Select(MachineMini.TransformItem).OrderBy(t => t.Name).ToArray();
}
}
}

View File

@@ -1,134 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Console.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Videogame console model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
namespace cicm_web.Models
{
public static class Console
{
public static Machine[] GetAllItems()
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.OrderByDescending(i => i.Id).Select(Machine.TransformItem) as Machine[];
}
public static Machine[] GetItemsFromCompany(int id)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id).Select(Machine.TransformItem).OrderBy(t => t.Name).ToArray();
}
public static Machine GetItem(int id)
{
Cicm.Database.Schemas.Machine dbItem = Program.Database?.Operations.GetConsole(id);
return dbItem == null ? null : Machine.TransformItem(dbItem);
}
}
public static class ConsoleMini
{
public static MachineMini[] GetAllItems()
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems) items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsStartingWithLetter(char letter)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
if(dbItem.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase))
items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsFromYear(int year)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
if(dbItem.Introduced.Year == year)
items.Add(MachineMini.TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsWithCompany(int id, string companyName)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id)
.Select(t => new MachineMini
{
Company = new Company {Id = id, Name = companyName},
Id = t.Id,
Name = t.Name
}).OrderBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsFromCompany(int id)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id).Select(MachineMini.TransformItem).OrderBy(t => t.Name).ToArray();
}
}
}

View File

@@ -1,95 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Gpu.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Graphics Processing Unit model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
namespace cicm_web.Models
{
public class Gpu
{
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,
Company = dbItem.Company == null ? null : 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()
{
List<Cicm.Database.Schemas.Gpu> dbItems = null;
bool? result = Program.Database?.Operations.GetGpus(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<Gpu> items = new List<Gpu>();
foreach(Cicm.Database.Schemas.Gpu dbItem in dbItems)
items.Add(new Gpu
{
Name = dbItem.Name,
Company = dbItem.Company == null ? null : 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();
}
}
}

View File

@@ -1,57 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : GpuByMachine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Gpu by machine model
//
// --[ 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
*******************************************************************************/
using System.Collections.Generic;
namespace cicm_web.Models
{
public class GpuByMachine
{
public Gpu Gpu;
public static GpuByMachine[] GetAllItems(int machineId)
{
List<Cicm.Database.Schemas.GpuByMachine> dbItems = null;
bool? result =
Program.Database?.Operations.GetGpusByMachines(out dbItems, machineId);
if(result == null || result.Value == false || dbItems == null) return null;
List<GpuByMachine> items = new List<GpuByMachine>();
foreach(Cicm.Database.Schemas.GpuByMachine dbItem in dbItems)
items.Add(new GpuByMachine
{
Gpu = Gpu.GetItem(dbItem.Gpu)
});
return items.ToArray();
}
}
}

View File

@@ -1,178 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Machine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Machine model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using Cicm.Database;
namespace cicm_web.Models
{
public class Machine
{
public Company Company;
public MachineFamily Family;
public GpuByMachine[] Gpus;
public int Id;
public DateTime Introduced;
public MemoryByMachine[] Memories;
public string Model;
public string Name;
public ProcessorByMachine[] Processors;
public SoundByMachine[] SoundSynths;
public StorageByMachine[] Storage;
public MachineType Type;
public static Machine[] GetAllItems()
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<Machine> items = new List<Machine>();
return dbItems.Select(TransformItem).OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static Machine[] GetItemsFromCompany(int id)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id).Select(TransformItem).OrderBy(t => t.Name).ToArray();
}
public static Machine GetItem(int id)
{
Cicm.Database.Schemas.Machine dbItem = Program.Database?.Operations.GetMachine(id);
return dbItem == null ? null : TransformItem(dbItem);
}
internal static Machine TransformItem(Cicm.Database.Schemas.Machine dbItem)
{
return new Machine
{
Company = Company.GetItem(dbItem.Company),
Gpus = GpuByMachine.GetAllItems(dbItem.Id),
Id = dbItem.Id,
Name = dbItem.Name,
Introduced = dbItem.Introduced,
Type = dbItem.Type,
Processors = ProcessorByMachine.GetAllItems(dbItem.Id),
SoundSynths = SoundByMachine.GetAllItems(dbItem.Id),
Memories = MemoryByMachine.GetAllItems(dbItem.Id),
Storage = StorageByMachine.GetAllItems(dbItem.Id),
Family = MachineFamily.GetItem(dbItem.Family),
Model = dbItem.Model
};
}
}
public class MachineMini
{
public Company Company;
public int Id;
public string Name;
public static MachineMini[] GetAllItems()
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems) items.Add(TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsStartingWithLetter(char letter)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
if(dbItem.Name.StartsWith(new string(letter, 1), StringComparison.InvariantCultureIgnoreCase))
items.Add(TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsFromYear(int year)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<MachineMini> items = new List<MachineMini>();
foreach(Cicm.Database.Schemas.Machine dbItem in dbItems)
if(dbItem.Introduced.Year == year)
items.Add(TransformItem(dbItem));
return items.OrderBy(t => t.Company.Name).ThenBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsWithCompany(int id, string companyName)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id)
.Select(t => new MachineMini
{
Company = new Company {Id = id, Name = companyName},
Id = t.Id,
Name = t.Name
}).OrderBy(t => t.Name).ToArray();
}
public static MachineMini[] GetItemsFromCompany(int id)
{
List<Cicm.Database.Schemas.Machine> dbItems = null;
bool? result = Program.Database?.Operations.GetMachines(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
// TODO: Company chosen by DB
return dbItems.Where(t => t.Company == id).Select(TransformItem).OrderBy(t => t.Name).ToArray();
}
internal static MachineMini TransformItem(Cicm.Database.Schemas.Machine dbItem)
{
return new MachineMini {Company = Company.GetItem(dbItem.Company), Id = dbItem.Id, Name = dbItem.Name};
}
}
}

View File

@@ -1,47 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : GpuByMachine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Gpu by machine model
//
// --[ 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_web.Models
{
public class MachineFamily
{
public int Id;
public string Name;
public static MachineFamily GetItem(int familyId)
{
Cicm.Database.Schemas.MachineFamily result = Program.Database?.Operations.GetMachineFamily(familyId);
if(result == null || result.Id != familyId) return null;
return new MachineFamily {Name = result.Name, Id = familyId};
}
}
}

View File

@@ -1,64 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : GpuByMachine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Gpu by machine model
//
// --[ 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
*******************************************************************************/
using System.Collections.Generic;
using Cicm.Database;
namespace cicm_web.Models
{
public class MemoryByMachine
{
public long Size;
public double Speed;
public MemoryType Type;
public MemoryUsage Usage;
public static MemoryByMachine[] GetAllItems(int machineId)
{
List<Cicm.Database.Schemas.MemoryByMachine> dbItems = null;
bool? result =
Program.Database?.Operations.GetMemoryByMachine(out dbItems, machineId);
if(result == null || result.Value == false || dbItems == null) return null;
List<MemoryByMachine> items = new List<MemoryByMachine>();
foreach(Cicm.Database.Schemas.MemoryByMachine dbItem in dbItems)
items.Add(new MemoryByMachine
{
Type = dbItem.Type,
Usage = dbItem.Usage,
Size = dbItem.Size,
Speed = dbItem.Speed
});
return items.ToArray();
}
}
}

View File

@@ -1,161 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : News.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Website news model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Cicm.Database;
namespace cicm_web.Models
{
public class News
{
/// <summary>Affected ID</summary>
public int AffectedId;
/// <summary>Date</summary>
public DateTime Date;
/// <summary>URL of image</summary>
public string Image;
/// <summary>Subtext</summary>
public string SubText;
/// <summary>URL of target view, if applicable</summary>
public string TargetView;
/// <summary>Text</summary>
public string Text;
public static News[] GetAllItems()
{
List<Cicm.Database.Schemas.News> dbItems = null;
bool? result = Program.Database?.Operations.GetNews(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.OrderByDescending(i => i.Id).Select(TransformItem) as News[];
}
public static News[] GetLastItems(int count = 10)
{
List<Cicm.Database.Schemas.News> dbItems = null;
bool? result = Program.Database?.Operations.GetNews(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.OrderByDescending(i => i.Id).Take(count).Select(TransformItem).ToArray();
}
static News TransformItem(Cicm.Database.Schemas.News dbItem)
{
string imageUrl;
string text;
string targetView;
string subtext;
Machine computer;
OwnedComputer owncomputer;
Machine console;
OwnedConsole ownconsole;
switch(dbItem.Type)
{
case NewsType.NewComputerInDb:
text = "New computer added to the database.";
imageUrl = "assets/photos/computers/";
targetView = "Computer";
computer = Computer.GetItem(dbItem.AffectedId);
subtext = $"{computer.Company.Name} - {computer.Name}";
break;
case NewsType.NewConsoleInDb:
text = "New videoconsole added to the database.";
imageUrl = "assets/photos/consoles/";
targetView = "Console";
console = Console.GetItem(dbItem.AffectedId);
subtext = $"{console.Company.Name} - {console.Name}";
break;
case NewsType.NewComputerInCollection:
text = "New computer added to the museum's collection.";
imageUrl = "assets/photos/computers/";
targetView = "CollectionComputer";
owncomputer = OwnedComputer.GetItem(dbItem.AffectedId);
subtext = $"{owncomputer.Computer.Company.Name} - {owncomputer.Computer.Name}";
break;
case NewsType.NewConsoleInCollection:
text = "New videoconsole added to the museum's collection.";
imageUrl = "assets/photos/consoles/";
targetView = "CollectionConsole";
ownconsole = OwnedConsole.GetItem(dbItem.AffectedId);
subtext = $"{ownconsole.Console.Company.Name} - {ownconsole.Console.Name}";
break;
case NewsType.UpdatedComputerInDb:
text = "Updated computer from the database.";
imageUrl = "assets/photos/computers/";
targetView = "Computer";
computer = Computer.GetItem(dbItem.AffectedId);
subtext = $"{computer.Company.Name} - {computer.Name}";
break;
case NewsType.UpdatedConsoleInDb:
text = "Updated videoconsole from the database.";
imageUrl = "assets/photos/consoles/";
targetView = "Console";
console = Console.GetItem(dbItem.AffectedId);
subtext = $"{console.Company.Name} - {console.Name}";
break;
case NewsType.UpdatedComputerInCollection:
text = "Updated computer from museum's collection.";
imageUrl = "assets/photos/computers/";
targetView = "CollectionComputer";
owncomputer = OwnedComputer.GetItem(dbItem.AffectedId);
subtext = $"{owncomputer.Computer.Company.Name} - {owncomputer.Computer.Name}";
break;
case NewsType.UpdatedConsoleInCollection:
text = "Updated videoconsole from museum's collection.";
imageUrl = "assets/photos/consoles/";
targetView = "CollectionConsole";
ownconsole = OwnedConsole.GetItem(dbItem.AffectedId);
subtext = $"{ownconsole.Console.Company.Name} - {ownconsole.Console.Name}";
break;
case NewsType.NewMoneyDonation:
text = "New money donation.";
imageUrl = null;
targetView = null;
subtext = null;
break;
default: throw new ArgumentOutOfRangeException();
}
return new News
{
AffectedId = dbItem.AffectedId,
Date = DateTime.ParseExact(dbItem.Date, "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture),
Image = imageUrl == null ? null : imageUrl + $"{dbItem.AffectedId}",
Text = text,
TargetView = targetView,
SubText = subtext
};
}
}
}

View File

@@ -1,105 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : OwnedComputer.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Videogame console model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Cicm.Database;
namespace cicm_web.Models
{
public class OwnedComputer
{
public DateTime Acquired;
public bool Boxed;
public Machine Computer;
public Processor Cpu1;
public Processor Cpu2;
public int Id;
public bool Manuals;
public float Mhz1;
public float Mhz2;
public int Ram;
public string Rigid;
public StatusType Status;
public bool Trade;
public int Vram;
public static OwnedComputer[] GetAllItems()
{
List<Cicm.Database.Schemas.OwnedComputer> dbItems = null;
bool? result =
Program.Database?.Operations.GetOwnedComputers(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.OrderByDescending(i => i.Id).Select(TransformItem) as OwnedComputer[];
}
public static OwnedComputer GetItem(int id)
{
Cicm.Database.Schemas.OwnedComputer dbItem = Program.Database?.Operations.GetOwnedComputer(id);
return dbItem == null ? null : TransformItem(dbItem);
}
static OwnedComputer TransformItem(Cicm.Database.Schemas.OwnedComputer dbItem)
{
Machine computer = Machine.GetItem(dbItem.ComputerId);
OwnedComputer item = new OwnedComputer
{
Acquired = DateTime.ParseExact(dbItem.Acquired, "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture),
Boxed = dbItem.Boxed,
Computer = computer,
Id = dbItem.Id,
Manuals = dbItem.Manuals,
Ram = dbItem.Ram,
Rigid = dbItem.Rigid,
Status = dbItem.Status,
Trade = dbItem.Trade,
Vram = dbItem.Vram
};
if(dbItem.Cpu1 > 0)
{
item.Cpu1 = Processor.GetItem(dbItem.Cpu1);
item.Mhz1 = dbItem.Mhz1;
}
if(dbItem.Cpu2 > 0)
{
item.Cpu2 = Processor.GetItem(dbItem.Cpu2);
item.Mhz2 = dbItem.Mhz2;
}
return computer == null ? null : item;
}
}
}

View File

@@ -1,85 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : OwnedConsole.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Videogame console model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Cicm.Database;
namespace cicm_web.Models
{
public class OwnedConsole
{
public DateTime Acquired;
public bool Boxed;
public Machine Console;
public int Id;
public bool Manuals;
public StatusType Status;
public bool Trade;
public static OwnedConsole[] GetAllItems()
{
List<Cicm.Database.Schemas.OwnedConsole> dbItems = null;
bool? result =
Program.Database?.Operations.GetOwnedConsoles(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
return dbItems.OrderByDescending(i => i.Id).Select(TransformItem) as OwnedConsole[];
}
public static OwnedConsole GetItem(int id)
{
Cicm.Database.Schemas.OwnedConsole dbItem = Program.Database?.Operations.GetOwnedConsole(id);
return dbItem == null ? null : TransformItem(dbItem);
}
static OwnedConsole TransformItem(Cicm.Database.Schemas.OwnedConsole dbItem)
{
Machine console = Machine.GetItem(dbItem.ConsoleId);
return console == null
? null
: new OwnedConsole
{
Acquired =
DateTime.ParseExact(dbItem.Acquired, "yyyy/MM/dd HH:mm:ss",
CultureInfo.InvariantCulture),
Boxed = dbItem.Boxed,
Console = console,
Id = dbItem.Id,
Manuals = dbItem.Manuals,
Status = dbItem.Status,
Trade = dbItem.Trade
};
}
}
}

View File

@@ -1,148 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : Processor.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Processor model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
using Cicm.Database.Schemas;
namespace cicm_web.Models
{
public class Processor
{
public int AddressBus;
public Company Company;
public int Cores;
public int DataBus;
public float DieSize;
public int Fpr;
public int FprSize;
public int Gpr;
public int GprSize;
public int Id;
public InstructionSet InstructionSet;
public InstructionSetExtension[] InstructionSetExtensions;
public DateTime Introduced;
public float L1Data;
public float L1Instruction;
public float L2;
public float L3;
public string ModelCode;
public string Name;
public string Package;
public string Process;
public float ProcessNm;
public int Simd;
public int SimdSize;
public double Speed;
public int ThreadsPerCore;
public long Transistors;
public static Processor GetItem(int id)
{
Cicm.Database.Schemas.Processor dbItem = Program.Database?.Operations.GetProcessor(id);
return dbItem == null
? null
: new Processor
{
AddressBus = dbItem.AddressBus,
Name = dbItem.Name,
Company = Company.GetItem(dbItem.Company.Id),
Cores = dbItem.Cores,
DataBus = dbItem.DataBus,
DieSize = dbItem.DieSize,
Fpr = dbItem.Fpr,
FprSize = dbItem.FprSize,
Gpr = dbItem.Gpr,
GprSize = dbItem.GprSize,
InstructionSet = dbItem.InstructionSet,
InstructionSetExtensions = dbItem.InstructionSetExtensions,
Introduced = dbItem.Introduced,
L1Data = dbItem.L1Data,
L1Instruction = dbItem.L1Instruction,
L2 = dbItem.L2,
L3 = dbItem.L3,
ModelCode = dbItem.ModelCode,
Package = dbItem.Package,
Process = dbItem.Process,
ProcessNm = dbItem.ProcessNm,
Simd = dbItem.Simd,
SimdSize = dbItem.SimdSize,
Speed = dbItem.Speed,
ThreadsPerCore = dbItem.ThreadsPerCore,
Transistors = dbItem.Transistors,
Id = dbItem.Id
};
}
public static Processor[] GetAllItems()
{
List<Cicm.Database.Schemas.Processor> dbItems = null;
bool? result = Program.Database?.Operations.GetProcessors(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<Processor> items = new List<Processor>();
foreach(Cicm.Database.Schemas.Processor dbItem in dbItems)
items.Add(new Processor
{
AddressBus = dbItem.AddressBus,
Name = dbItem.Name,
Company = Company.GetItem(dbItem.Company.Id),
Cores = dbItem.Cores,
DataBus = dbItem.DataBus,
DieSize = dbItem.DieSize,
Fpr = dbItem.Fpr,
FprSize = dbItem.FprSize,
Gpr = dbItem.Gpr,
GprSize = dbItem.GprSize,
InstructionSet = dbItem.InstructionSet,
InstructionSetExtensions = dbItem.InstructionSetExtensions,
Introduced = dbItem.Introduced,
L1Data = dbItem.L1Data,
L1Instruction = dbItem.L1Instruction,
L2 = dbItem.L2,
L3 = dbItem.L3,
ModelCode = dbItem.ModelCode,
Package = dbItem.Package,
Process = dbItem.Process,
ProcessNm = dbItem.ProcessNm,
Simd = dbItem.Simd,
SimdSize = dbItem.SimdSize,
Speed = dbItem.Speed,
ThreadsPerCore = dbItem.ThreadsPerCore,
Transistors = dbItem.Transistors,
Id = dbItem.Id
});
return items.ToArray();
}
}
}

View File

@@ -1,59 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : ProcessorByMachine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Processor by machine model
//
// --[ 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
*******************************************************************************/
using System.Collections.Generic;
namespace cicm_web.Models
{
public class ProcessorByMachine
{
public Processor Processor;
public float Speed;
public static ProcessorByMachine[] GetAllItems(int machineId)
{
List<Cicm.Database.Schemas.ProcessorByMachine> dbItems = null;
bool? result =
Program.Database?.Operations.GetProcessorsByMachines(out dbItems, machineId);
if(result == null || result.Value == false || dbItems == null) return null;
List<ProcessorByMachine> items = new List<ProcessorByMachine>();
foreach(Cicm.Database.Schemas.ProcessorByMachine dbItem in dbItems)
items.Add(new ProcessorByMachine
{
Processor = Processor.GetItem(dbItem.Processor),
Speed = dbItem.Speed
});
return items.ToArray();
}
}
}

View File

@@ -1,54 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : GpuByMachine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Gpu by machine model
//
// --[ 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
*******************************************************************************/
using System.Collections.Generic;
namespace cicm_web.Models
{
public class SoundByMachine
{
public SoundSynth SoundSynth;
public static SoundByMachine[] GetAllItems(int machineId)
{
List<Cicm.Database.Schemas.SoundByMachine> dbItems = null;
bool? result =
Program.Database?.Operations.GetSoundsByMachines(out dbItems, machineId);
if(result == null || result.Value == false || dbItems == null) return null;
List<SoundByMachine> items = new List<SoundByMachine>();
foreach(Cicm.Database.Schemas.SoundByMachine dbItem in dbItems)
items.Add(new SoundByMachine {SoundSynth = SoundSynth.GetItem(dbItem.SoundSynth)});
return items.ToArray();
}
}
}

View File

@@ -1,98 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : SoundSynth.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Digital Sound Synthetizer model
//
// --[ 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
*******************************************************************************/
using System;
using System.Collections.Generic;
namespace cicm_web.Models
{
public class SoundSynth
{
public Company Company;
public int Depth;
public double Frequency;
public int Id;
public DateTime Introduced;
public string ModelCode;
public string Name;
public int SquareWave;
public int Type;
public int Voices;
public int WhiteNoise;
public static SoundSynth GetItem(int id)
{
Cicm.Database.Schemas.SoundSynth dbItem = Program.Database?.Operations.GetSoundSynth(id);
return dbItem == null
? null
: new SoundSynth
{
Name = dbItem.Name,
Id = dbItem.Id,
Company = dbItem.Company == null ? null : Company.GetItem(dbItem.Company.Id),
ModelCode = dbItem.ModelCode,
Introduced = dbItem.Introduced,
Voices = dbItem.Voices,
Frequency = dbItem.Frequency,
Depth = dbItem.Depth,
SquareWave = dbItem.SquareWave,
WhiteNoise = dbItem.WhiteNoise,
Type = dbItem.Type
};
}
public static SoundSynth[] GetAllItems()
{
List<Cicm.Database.Schemas.SoundSynth> dbItems = null;
bool? result = Program.Database?.Operations.GetSoundSynths(out dbItems);
if(result == null || result.Value == false || dbItems == null) return null;
List<SoundSynth> items = new List<SoundSynth>();
foreach(Cicm.Database.Schemas.SoundSynth dbItem in dbItems)
items.Add(new SoundSynth
{
Name = dbItem.Name,
Id = dbItem.Id,
Company = dbItem.Company == null ? null : Company.GetItem(dbItem.Company.Id),
ModelCode = dbItem.ModelCode,
Introduced = dbItem.Introduced,
Voices = dbItem.Voices,
Frequency = dbItem.Frequency,
Depth = dbItem.Depth,
SquareWave = dbItem.SquareWave,
WhiteNoise = dbItem.WhiteNoise,
Type = dbItem.Type
});
return items.ToArray();
}
}
}

View File

@@ -1,65 +0,0 @@
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : StorageByMachine.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Storage by machine model
//
// --[ 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
*******************************************************************************/
using System.Collections.Generic;
using Cicm.Database;
namespace cicm_web.Models
{
public class StorageByMachine
{
/// <summary>Capacity in bytes</summary>
public long Capacity;
/// <summary>Storage interface</summary>
public StorageInterface Interface;
/// <summary>Storage type</summary>
public StorageType Type;
public static StorageByMachine[] GetAllItems(int machineId)
{
List<Cicm.Database.Schemas.StorageByMachine> dbItems = null;
bool? result =
Program.Database?.Operations.GetStorageByMachines(out dbItems, machineId);
if(result == null || result.Value == false || dbItems == null) return null;
List<StorageByMachine> items = new List<StorageByMachine>();
foreach(Cicm.Database.Schemas.StorageByMachine dbItem in dbItems)
items.Add(new StorageByMachine
{
Type = dbItem.Type,
Interface = dbItem.Interface,
Capacity = dbItem.Capacity
});
return items.ToArray();
}
}
}

View File

@@ -2,7 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<Version>3.0.99.301</Version>
<Version>3.0.99.302</Version>
<Company>Canary Islands Computer Museum</Company>
<Copyright>Copyright © 2003-2018 Natalia Portillo</Copyright>
<Product>Canary Islands Computer Museum Website</Product>