Files
marechai/cicm_web/Views/Company/View.cshtml

302 lines
12 KiB
Plaintext
Raw Normal View History

2018-04-15 01:38:49 +01:00
@{
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
// Filename : ByLetter.cshtml
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// --[ Description ] ----------------------------------------------------------
//
// Lists computers by company
//
// --[ 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
*******************************************************************************/
ViewData["Title"] = "Companies";
}
@using System.IO
@using Cicm.Database.Schemas
2018-04-15 17:51:07 +01:00
@model CompanyWithItems
2018-04-15 01:38:49 +01:00
@if(Model != null)
{
<p align=center>
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".gif")))
2018-04-15 01:38:49 +01:00
{
2018-04-15 17:51:07 +01:00
<img src="@(System.IO.Path.Combine("/assets/logos", Model.Id + ".gif"))"
2018-04-15 01:38:49 +01:00
alt="">
}
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".jpg")))
2018-04-15 01:38:49 +01:00
{
2018-04-15 17:51:07 +01:00
<img src="@(System.IO.Path.Combine("/assets/logos", Model.Id + ".jpg"))"
2018-04-15 01:38:49 +01:00
alt="">
}
@if(File.Exists(System.IO.Path.Combine(ViewBag.WebRootPath, "assets/logos", Model.Id + ".png")))
2018-04-15 01:38:49 +01:00
{
2018-04-15 17:51:07 +01:00
<img src="@(System.IO.Path.Combine("/assets/logos", Model.Id + ".png"))"
2018-04-15 01:38:49 +01:00
alt="">
}
</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>
2018-04-15 01:38:49 +01:00
<div>
@if(Model.Computers.Any())
2018-04-15 17:51:07 +01:00
{
<p>
@Model.Computers.Count() computers made by this company found in the database.<br />
2018-04-15 17:51:07 +01:00
@foreach(ComputerMini computer in Model.Computers)
{
<a asp-controller="Computer"
asp-action="View"
asp-route-id="@computer.Id">
@computer.Model</a>
<br />
}
</p>
}
else
{
<p>There are no computers made by this company in the database.</p>
2018-04-15 17:51:07 +01:00
}
</div>
2018-04-15 17:51:07 +01:00
<div>
@if(Model.Consoles.Any())
2018-04-15 17:51:07 +01:00
{
<p>
@Model.Consoles.Count() videogame consoles made by this company found in the database.<br />
2018-04-15 17:51:07 +01:00
@foreach(ConsoleMini console in Model.Consoles)
{
<a asp-controller="Console"
asp-action="View"
asp-route-id="@console.Id">
@console.Model</a>
<br />
}
</p>
}
else
{
<p>There are no videogame consoles made by this company found in the database.</p>
2018-04-15 17:51:07 +01:00
}
</div>
}
else
{
<p>Company not found!</p>
}