Major refactor and cleanup.

This commit is contained in:
2025-11-13 04:05:35 +00:00
parent 1d67081792
commit 8f6d334af4
833 changed files with 86800 additions and 74355 deletions

View File

@@ -29,72 +29,75 @@ using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace Marechai.Database.Models
namespace Marechai.Database.Models;
public class Company : BaseModel<int>
{
public class Company : BaseModel<int>
public Company()
{
public Company()
{
Logos = new HashSet<CompanyLogo>();
Gpus = new HashSet<Gpu>();
InverseSoldToNavigation = new HashSet<Company>();
MachineFamilies = new HashSet<MachineFamily>();
Machines = new HashSet<Machine>();
Processors = new HashSet<Processor>();
SoundSynths = new HashSet<SoundSynth>();
}
[Required]
public string Name { get; set; }
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true), DataType(DataType.Date)]
public DateTime? Founded { get; set; }
[Url, StringLength(255)]
public string Website { get; set; }
[StringLength(45)]
public string Twitter { get; set; }
[StringLength(45)]
public string Facebook { get; set; }
[DisplayFormat(DataFormatString = "{0:d}"), DataType(DataType.Date)]
public DateTime? Sold { get; set; }
public int? SoldToId { get; set; }
[StringLength(80)]
public string Address { get; set; }
[StringLength(80)]
public string City { get; set; }
[StringLength(80)]
public string Province { get; set; }
[StringLength(25), DisplayName("Postal code")]
public string PostalCode { get; set; }
public short? CountryId { get; set; }
[Required]
public CompanyStatus Status { get; set; }
public int? DocumentCompanyId { get; set; }
[DefaultValue(false)]
public bool FoundedMonthIsUnknown { get; set; }
[DefaultValue(false)]
public bool FoundedDayIsUnknown { get; set; }
[DefaultValue(false)]
public bool SoldMonthIsUnknown { get; set; }
[DefaultValue(false)]
public bool SoldDayIsUnknown { get; set; }
public string LegalName { get; set; }
public virtual Iso31661Numeric Country { get; set; }
[DisplayName("Sold to")]
public virtual Company SoldTo { get; set; }
public virtual ICollection<CompanyDescription> Descriptions { get; set; }
public virtual ICollection<CompanyLogo> Logos { get; set; }
public virtual ICollection<Gpu> Gpus { get; set; }
public virtual ICollection<Company> InverseSoldToNavigation { get; set; }
public virtual ICollection<MachineFamily> MachineFamilies { get; set; }
public virtual ICollection<Machine> Machines { get; set; }
public virtual ICollection<Processor> Processors { get; set; }
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
public virtual ICollection<PeopleByCompany> People { get; set; }
public virtual CompanyLogo LastLogo => Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
public virtual DocumentCompany DocumentCompany { get; set; }
public virtual ICollection<CompaniesBySoftwareFamily> SoftwareFamilies { get; set; }
public virtual ICollection<CompaniesBySoftwareVersion> SoftwareVersions { get; set; }
public virtual ICollection<CompaniesBySoftwareVariant> SoftwareVariants { get; set; }
Logos = new HashSet<CompanyLogo>();
Gpus = new HashSet<Gpu>();
InverseSoldToNavigation = new HashSet<Company>();
MachineFamilies = new HashSet<MachineFamily>();
Machines = new HashSet<Machine>();
Processors = new HashSet<Processor>();
SoundSynths = new HashSet<SoundSynth>();
}
[Required]
public string Name { get; set; }
[DisplayFormat(DataFormatString = "{0:d}", ApplyFormatInEditMode = true)]
[DataType(DataType.Date)]
public DateTime? Founded { get; set; }
[Url]
[StringLength(255)]
public string Website { get; set; }
[StringLength(45)]
public string Twitter { get; set; }
[StringLength(45)]
public string Facebook { get; set; }
[DisplayFormat(DataFormatString = "{0:d}")]
[DataType(DataType.Date)]
public DateTime? Sold { get; set; }
public int? SoldToId { get; set; }
[StringLength(80)]
public string Address { get; set; }
[StringLength(80)]
public string City { get; set; }
[StringLength(80)]
public string Province { get; set; }
[StringLength(25)]
[DisplayName("Postal code")]
public string PostalCode { get; set; }
public short? CountryId { get; set; }
[Required]
public CompanyStatus Status { get; set; }
public int? DocumentCompanyId { get; set; }
[DefaultValue(false)]
public bool FoundedMonthIsUnknown { get; set; }
[DefaultValue(false)]
public bool FoundedDayIsUnknown { get; set; }
[DefaultValue(false)]
public bool SoldMonthIsUnknown { get; set; }
[DefaultValue(false)]
public bool SoldDayIsUnknown { get; set; }
public string LegalName { get; set; }
public virtual Iso31661Numeric Country { get; set; }
[DisplayName("Sold to")]
public virtual Company SoldTo { get; set; }
public virtual ICollection<CompanyDescription> Descriptions { get; set; }
public virtual ICollection<CompanyLogo> Logos { get; set; }
public virtual ICollection<Gpu> Gpus { get; set; }
public virtual ICollection<Company> InverseSoldToNavigation { get; set; }
public virtual ICollection<MachineFamily> MachineFamilies { get; set; }
public virtual ICollection<Machine> Machines { get; set; }
public virtual ICollection<Processor> Processors { get; set; }
public virtual ICollection<SoundSynth> SoundSynths { get; set; }
public virtual ICollection<PeopleByCompany> People { get; set; }
public virtual CompanyLogo LastLogo => Logos?.OrderByDescending(l => l.Year).FirstOrDefault();
public virtual DocumentCompany DocumentCompany { get; set; }
public virtual ICollection<CompaniesBySoftwareFamily> SoftwareFamilies { get; set; }
public virtual ICollection<CompaniesBySoftwareVersion> SoftwareVersions { get; set; }
public virtual ICollection<CompaniesBySoftwareVariant> SoftwareVariants { get; set; }
}