mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add new database fields for companies to model and view.
This commit is contained in:
@@ -32,36 +32,231 @@
|
||||
ViewData["Title"] = "Companies";
|
||||
}
|
||||
@using System.IO
|
||||
@using Cicm.Database.Schemas
|
||||
@model CompanyWithItems
|
||||
|
||||
<p>Search results:</p>
|
||||
<p align=center>
|
||||
@if(Model != null)
|
||||
{
|
||||
if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".gif")))
|
||||
@if(Model != null)
|
||||
{
|
||||
<p align=center>
|
||||
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".gif")))
|
||||
{
|
||||
<img src="@(System.IO.Path.Combine("/assets/logos", Model.Id + ".gif"))"
|
||||
alt="">
|
||||
}
|
||||
|
||||
if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".jpg")))
|
||||
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".jpg")))
|
||||
{
|
||||
<img src="@(System.IO.Path.Combine("/assets/logos", Model.Id + ".jpg"))"
|
||||
alt="">
|
||||
}
|
||||
|
||||
if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".png")))
|
||||
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".png")))
|
||||
{
|
||||
<img src="@(System.IO.Path.Combine("/assets/logos", Model.Id + ".png"))"
|
||||
alt="">
|
||||
}
|
||||
<b>@Model.Name</b>
|
||||
<br />
|
||||
</p>
|
||||
<div>
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<b>@Model.Name</b>
|
||||
</th>
|
||||
</tr>
|
||||
@if(Model.Founded > DateTime.MinValue)
|
||||
{
|
||||
<tr>
|
||||
<th>Founded</th>
|
||||
<td>@Model.Founded.ToLongDateString().</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<th>Country</th>
|
||||
<td>@Model.Country.Name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
@switch(Model.Status)
|
||||
{
|
||||
case CompanyStatus.Unknown:
|
||||
<td>Current company status is unknown.</td>
|
||||
break;
|
||||
case CompanyStatus.Active:
|
||||
<td>Company is active.</td>
|
||||
break;
|
||||
case CompanyStatus.Sold:
|
||||
if(Model.Sold != DateTime.MinValue)
|
||||
{
|
||||
if(Model.SoldTo != null)
|
||||
{
|
||||
<td>
|
||||
Company was sold to
|
||||
<a asp-controller="Company"
|
||||
asp-action="View"
|
||||
asp-route-id="@Model.SoldTo.Id">
|
||||
@Model.SoldTo.Name</a> on @Model.Sold.ToLongDateString().
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company was sold on @Model.Sold.ToLongDateString() to an unknown company.</td>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Model.SoldTo != null)
|
||||
{
|
||||
<td>
|
||||
Company was sold to
|
||||
<a asp-controller="Company"
|
||||
asp-action="View"
|
||||
asp-route-id="@Model.SoldTo.Id">
|
||||
@Model.SoldTo.Name</a> on an unknown date.
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company was sold to an unknown company on an unknown date.</td>
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CompanyStatus.Merged:
|
||||
if(Model.Sold != DateTime.MinValue)
|
||||
{
|
||||
if(Model.SoldTo != null)
|
||||
{
|
||||
<td>
|
||||
Company was merged on @Model.Sold.ToLongDateString() to form
|
||||
<a asp-controller="Company"
|
||||
asp-action="View"
|
||||
asp-route-id="@Model.SoldTo.Id">
|
||||
@Model.SoldTo.Name</a>.
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company was merge on @Model.Sold.ToLongDateString() to form an unknown company.</td>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Model.SoldTo != null)
|
||||
{
|
||||
<td>
|
||||
Company was merged on an unknown date to form
|
||||
<a asp-controller="Company"
|
||||
asp-action="View"
|
||||
asp-route-id="@Model.SoldTo.Id">
|
||||
@Model.SoldTo.Name</a>.
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company was merged to form an unknown company on an unknown date.</td>
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CompanyStatus.Bankrupt:
|
||||
if(Model.Sold != DateTime.MinValue)
|
||||
{
|
||||
<td>Company declared bankruptcy on @Model.Sold.ToLongDateString().</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company declared bankruptcy on an unknown date.</td>
|
||||
}
|
||||
break;
|
||||
case CompanyStatus.Defunct:
|
||||
if(Model.Sold != DateTime.MinValue)
|
||||
{
|
||||
<td>Company ceased operations on @Model.Sold.ToLongDateString().</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company ceased operations on an unknown date.</td>
|
||||
}
|
||||
break;
|
||||
case CompanyStatus.Renamed:
|
||||
if(Model.Sold != DateTime.MinValue)
|
||||
{
|
||||
if(Model.SoldTo != null)
|
||||
{
|
||||
<td>
|
||||
Company was renamed to
|
||||
<a asp-controller="Company"
|
||||
asp-action="View"
|
||||
asp-route-id="@Model.SoldTo.Id">
|
||||
@Model.SoldTo.Name</a> on @Model.Sold.ToLongDateString().
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company was renamed on @Model.Sold.ToLongDateString() to an unknown name.</td>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Model.SoldTo != null)
|
||||
{
|
||||
<td>
|
||||
Company was renamed to
|
||||
<a asp-controller="Company"
|
||||
asp-action="View"
|
||||
asp-route-id="@Model.SoldTo.Id">
|
||||
@Model.SoldTo.Name</a> on an unknown date.
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>Company was renamed to an unknown name on an unknown date.</td>
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Address</th>
|
||||
<td>
|
||||
@Model.Address<br>
|
||||
@if(Model.City != Model.Province)
|
||||
{
|
||||
@Model.City<br>
|
||||
}
|
||||
@Model.PostalCode @Model.Province</td>
|
||||
</tr>
|
||||
@if(!string.IsNullOrEmpty(Model.Website) || !string.IsNullOrEmpty(Model.Twitter) || !string.IsNullOrEmpty(Model.Facebook))
|
||||
{
|
||||
<tr>
|
||||
<th>Links</th>
|
||||
<td>
|
||||
@if(!string.IsNullOrEmpty(Model.Website))
|
||||
{
|
||||
<a href="@Model.Website">Website</a>
|
||||
<br />
|
||||
}
|
||||
@if(!string.IsNullOrEmpty(Model.Twitter))
|
||||
{
|
||||
<a href="https://www.twitter.com/@Model.Twitter">Twitter</a>
|
||||
<br />
|
||||
}
|
||||
@if(!string.IsNullOrEmpty(Model.Facebook))
|
||||
{
|
||||
<a href="https://www.facebook.com/@Model.Facebook">Facebook</a>
|
||||
<br />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
|
||||
if(Model.Computers.Any())
|
||||
<div>
|
||||
@if(Model.Computers.Any())
|
||||
{
|
||||
<p>
|
||||
@Model.Computers.Count() computers found in the database.<br />
|
||||
@Model.Computers.Count() computers made by this company found in the database.<br />
|
||||
@foreach(ComputerMini computer in Model.Computers)
|
||||
{
|
||||
<a asp-controller="Computer"
|
||||
@@ -74,13 +269,15 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>There are no computers found in the database that belong to that company.</p>
|
||||
<p>There are no computers made by this company in the database.</p>
|
||||
}
|
||||
</div>
|
||||
|
||||
if(Model.Consoles.Any())
|
||||
<div>
|
||||
@if(Model.Consoles.Any())
|
||||
{
|
||||
<p>
|
||||
@Model.Consoles.Count() videoconsoles found in the database.<br />
|
||||
@Model.Consoles.Count() videogame consoles made by this company found in the database.<br />
|
||||
@foreach(ConsoleMini console in Model.Consoles)
|
||||
{
|
||||
<a asp-controller="Console"
|
||||
@@ -93,11 +290,12 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>There are no videoconsoles found in the database that belong to that company.</p>
|
||||
<p>There are no videogame consoles made by this company found in the database.</p>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Company not found!</p>
|
||||
}
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<p>Company not found!</p>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user