mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 11:04:25 +00:00
Add support to mark a company founded or sold date as having the month or the day unknown. Fixes #16.
This commit is contained in:
@@ -11,8 +11,8 @@ indent_size=4
|
||||
brace_style=next_line
|
||||
int_align=true
|
||||
keep_existing_arrangement=false
|
||||
place_simple_blocks_on_single_line=false
|
||||
place_simple_declaration_blocks_on_single_line=false
|
||||
place_simple_blocks_on_single_line=true
|
||||
place_simple_declaration_blocks_on_single_line=true
|
||||
place_attribute_on_same_line=false
|
||||
space_after_unary_operator=false
|
||||
space_after_comma=true
|
||||
@@ -48,13 +48,13 @@ accessor_owner_body=expression_body
|
||||
force_attribute_style=join
|
||||
function_braces=next_line
|
||||
force_control_statements_braces=always_remove
|
||||
|
||||
space_in_singleline_accessorholder=true
|
||||
type_declaration_braces=next_line
|
||||
invocable_declaration_braces=next_line
|
||||
anonymous_method_declaration_braces=next_line
|
||||
|
||||
space_between_accessors_in_singleline_property=true
|
||||
indent_nested_usings_stmt=true
|
||||
|
||||
space_within_empty_braces=false
|
||||
indent_nested_fixed_stmt=true
|
||||
indent_nested_lock_stmt=true
|
||||
indent_nested_for_stmt=true
|
||||
@@ -154,7 +154,7 @@ place_simple_embedded_block_on_same_line=false
|
||||
place_simple_anonymousmethod_on_single_line=false
|
||||
keep_existing_initializer_arrangement=false
|
||||
place_simple_initializer_on_single_line=false
|
||||
wrap_object_and_collection_initializer_style=wrap_if_long
|
||||
wrap_object_and_collection_initializer_style=chop_always
|
||||
wrap_array_initializer_style=wrap_if_long
|
||||
wrap_arguments_style=wrap_if_long
|
||||
keep_existing_invocation_parens_arrangement=false
|
||||
@@ -175,7 +175,7 @@ wrap_before_linq_expression=false
|
||||
place_linq_into_on_new_line=false
|
||||
wrap_verbatim_interpolated_strings=wrap_if_long
|
||||
extra_spaces=remove_all
|
||||
space_after_keywords_in_control_flow_statements=true
|
||||
space_after_keywords_in_control_flow_statements=false
|
||||
space_between_method_call_name_and_opening_parenthesis=false
|
||||
space_between_method_declaration_name_and_open_parenthesis=false
|
||||
space_before_typeof_parentheses=false
|
||||
@@ -206,6 +206,10 @@ blank_lines_around_class_definition=1
|
||||
namespace_indentation=all
|
||||
space_within_template_argument=false
|
||||
align_union_type_usage=true
|
||||
space_in_singleline_method=true
|
||||
space_in_singleline_anonymous_method=true
|
||||
space_within_single_line_array_initializer_braces=true
|
||||
space_around_arrow_op=false
|
||||
|
||||
# These are for markup languages (HTML, XML, etc)
|
||||
spaces_around_eq_in_pi_attribute=false
|
||||
@@ -294,7 +298,7 @@ dotnet_sort_system_directives_first=true
|
||||
|
||||
# Constants in C style, all-caps
|
||||
dotnet_naming_rule.constant_fields_caps.symbols = constant_fields
|
||||
dotnet_naming_rule.constant_fields_caps.severity = suggestion
|
||||
dotnet_naming_rule.constant_fields_caps.severity = warning
|
||||
dotnet_naming_rule.constant_fields_caps.style = caps_style
|
||||
dotnet_naming_symbols.constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.constant_fields.required_modifiers = const
|
||||
@@ -309,7 +313,7 @@ dotnet_naming_style.pascal_case_interface_style.required_prefix = I
|
||||
dotnet_naming_style.pascal_case_interface_style.capitalization = pascal_case
|
||||
|
||||
## internal and private fields should be _camelCase
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
|
||||
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
|
||||
@@ -502,6 +506,7 @@ csharp_int_align_invocations=false
|
||||
csharp_int_align_binary_expressions=true
|
||||
csharp_int_align_comments=true
|
||||
csharp_int_align_switch_sections=true
|
||||
csharp_int_align=true
|
||||
csharp_keep_user_linebreaks=false
|
||||
csharp_keep_existing_arrangement=false
|
||||
csharp_keep_existing_linebreaks=false
|
||||
@@ -555,7 +560,7 @@ csharp_place_simple_embedded_block_on_same_line=false
|
||||
csharp_place_simple_anonymousmethod_on_single_line=false
|
||||
csharp_keep_existing_initializer_arrangement=false
|
||||
csharp_place_simple_initializer_on_single_line=false
|
||||
csharp_wrap_object_and_collection_initializer_style=wrap_if_long
|
||||
csharp_wrap_object_and_collection_initializer_style=chop_always
|
||||
csharp_wrap_array_initializer_style=wrap_if_long
|
||||
csharp_wrap_arguments_style=wrap_if_long
|
||||
csharp_keep_existing_invocation_parens_arrangement=false
|
||||
@@ -583,8 +588,8 @@ csharp_space_before_typeof_parentheses=false
|
||||
csharp_space_before_checked_parentheses=false
|
||||
csharp_space_before_sizeof_parentheses=false
|
||||
csharp_space_before_nameof_parentheses=false
|
||||
csharp_space_between_keyword_and_expression=false
|
||||
csharp_space_between_keyword_and_type=false
|
||||
csharp_space_between_keyword_and_expression=true
|
||||
csharp_space_between_keyword_and_type=true
|
||||
csharp_space_around_assignment_op=true
|
||||
csharp_space_around_logical_op=true
|
||||
csharp_space_around_binary_operator=true
|
||||
|
||||
6852
Marechai.Database/Migrations/20200804163714_AddFieldsForUnknownPartialDateInCompanies.Designer.cs
generated
Normal file
6852
Marechai.Database/Migrations/20200804163714_AddFieldsForUnknownPartialDateInCompanies.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class AddFieldsForUnknownPartialDateInCompanies : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>("FoundedDayIsUnknown", "companies", nullable: false, defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>("FoundedMonthIsUnknown", "companies", nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>("SoldDayIsUnknown", "companies", nullable: false, defaultValue: false);
|
||||
|
||||
migrationBuilder.AddColumn<bool>("SoldMonthIsUnknown", "companies", nullable: false, defaultValue: false);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn("FoundedDayIsUnknown", "companies");
|
||||
|
||||
migrationBuilder.DropColumn("FoundedMonthIsUnknown", "companies");
|
||||
|
||||
migrationBuilder.DropColumn("SoldDayIsUnknown", "companies");
|
||||
|
||||
migrationBuilder.DropColumn("SoldMonthIsUnknown", "companies");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,6 +449,10 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
b.Property<DateTime?>("Founded").HasColumnName("founded").HasColumnType("datetime");
|
||||
|
||||
b.Property<bool>("FoundedDayIsUnknown").HasColumnType("bit(1)");
|
||||
|
||||
b.Property<bool>("FoundedMonthIsUnknown").HasColumnType("bit(1)");
|
||||
|
||||
b.Property<string>("Name").IsRequired().ValueGeneratedOnAdd().HasColumnName("name").
|
||||
HasColumnType("varchar(128)").HasDefaultValueSql("''");
|
||||
|
||||
@@ -459,6 +463,10 @@ namespace Marechai.Database.Migrations
|
||||
|
||||
b.Property<DateTime?>("Sold").HasColumnName("sold").HasColumnType("datetime");
|
||||
|
||||
b.Property<bool>("SoldDayIsUnknown").HasColumnType("bit(1)");
|
||||
|
||||
b.Property<bool>("SoldMonthIsUnknown").HasColumnType("bit(1)");
|
||||
|
||||
b.Property<int?>("SoldToId").HasColumnName("sold_to").HasColumnType("int(11)");
|
||||
|
||||
b.Property<int>("Status").HasColumnName("status").HasColumnType("int(11)");
|
||||
|
||||
@@ -69,6 +69,14 @@ namespace Marechai.Database.Models
|
||||
[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 virtual Iso31661Numeric Country { get; set; }
|
||||
[DisplayName("Sold to")]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>4.0.0.1730</Version>
|
||||
<Version>4.0.0.1735</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
@@ -83,6 +83,9 @@
|
||||
}
|
||||
@if (!_editing || !_unknownFounded)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_model.FoundedMonthIsUnknown" Disabled="!_editing">@L["Unknown foundation month"]</Check>
|
||||
<Check TValue="bool" @bind-Checked="@_model.FoundedDayIsUnknown" Disabled="_model.FoundedMonthIsUnknown || !_editing">@L["Unknown foundation day"]</Check>
|
||||
@L["If the foundation day or month are selected as unknown, pick anyone in the field below, it will be ignored."]
|
||||
<Validation Validator="@ValidateFounded">
|
||||
<DateEdit TValue="DateTime?" ReadOnly="!_editing" @bind-Date="@_model.Founded" >
|
||||
<Feedback>
|
||||
@@ -273,6 +276,9 @@
|
||||
@if (!_editing ||
|
||||
!_unknownSold)
|
||||
{
|
||||
<Check TValue="bool" @bind-Checked="@_model.SoldMonthIsUnknown" Disabled="!_editing">@L["Unknown sold/merge/bankruptcy month"]</Check>
|
||||
<Check TValue="bool" @bind-Checked="@_model.SoldDayIsUnknown" Disabled="_model.SoldMonthIsUnknown || !_editing">@L["Unknown sold/merge/bankruptcy day"]</Check>
|
||||
@L["If the sold, merge or bankruptcy day or month are selected as unknown, pick anyone in the field below, it will be ignored."]
|
||||
<Validation Validator="@ValidateSold">
|
||||
<DateEdit TValue="DateTime?" ReadOnly="!_editing" @bind-Date="@_model.Sold">
|
||||
<Feedback>
|
||||
|
||||
@@ -91,6 +91,7 @@ namespace Marechai.Pages.Admin.Details
|
||||
bool _uploading;
|
||||
MemoryStream _uploadMs;
|
||||
bool _yearChangeInProgress;
|
||||
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
@@ -116,7 +116,18 @@
|
||||
{
|
||||
<tr>
|
||||
<th>@L["Founded"]</th>
|
||||
<td>@_company.Founded.Value.ToLongDateString().</td>
|
||||
@if(_company.FoundedMonthIsUnknown)
|
||||
{
|
||||
<td>@_company.Founded.Value.Year.</td>
|
||||
}
|
||||
else if(_company.FoundedDayIsUnknown)
|
||||
{
|
||||
<td>@($"{_company.Founded.Value:Y}").</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@_company.Founded.Value.ToLongDateString().</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
@@ -163,12 +174,12 @@
|
||||
{
|
||||
<td>
|
||||
<a href="/company/@_soldTo.Id">
|
||||
@string.Format(L["Company sold to {0} on {1}."], _soldTo.Name, _company.Sold.Value.ToLongDateString())</a>
|
||||
@string.Format(L["Company sold to {0} on {1}."], _soldTo.Name, _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</a>
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@string.Format(L["Company sold on {0} to an unknown company."], _company.Sold.Value.ToLongDateString())</td>
|
||||
<td>@string.Format(L["Company sold on {0} to an unknown company."], _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</td>
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -192,12 +203,12 @@
|
||||
if (_soldTo != null)
|
||||
{
|
||||
<td>
|
||||
<a href="/company/@_soldTo.Id">@string.Format(L["Company merged on {0} to form {1}."], _company.Sold.Value.ToLongDateString(), _soldTo.Name)</a>
|
||||
<a href="/company/@_soldTo.Id">@string.Format(L["Company merged on {0} to form {1}."], _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString(), _soldTo.Name)</a>
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@string.Format(L["Company merged on {0} to form an unknown company."], _company.Sold.Value.ToLongDateString())</td>
|
||||
<td>@string.Format(L["Company merged on {0} to form an unknown company."], _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</td>
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -217,7 +228,7 @@
|
||||
case CompanyStatus.Bankrupt:
|
||||
if (_company.Sold != null)
|
||||
{
|
||||
<td>@string.Format(L["Company declared bankruptcy on {0}."], _company.Sold.Value.ToLongDateString())</td>
|
||||
<td>@string.Format(L["Company declared bankruptcy on {0}."], _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -227,7 +238,7 @@
|
||||
case CompanyStatus.Defunct:
|
||||
if (_company.Sold != null)
|
||||
{
|
||||
<td>@string.Format(L["Company ceased operations on {0}."], _company.Sold.Value.ToLongDateString())</td>
|
||||
<td>@string.Format(L["Company ceased operations on {0}."], _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -240,12 +251,12 @@
|
||||
if (_soldTo != null)
|
||||
{
|
||||
<td>
|
||||
<a href="/company/@_soldTo.Id">@string.Format(L["Company renamed to {0} on {1}."], _soldTo.Name, _company.Sold.Value.ToLongDateString())</a>
|
||||
<a href="/company/@_soldTo.Id">@string.Format(L["Company renamed to {0} on {1}."], _soldTo.Name, _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</a>
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td>@string.Format(L["Company was renamed on {0} to an unknown name."], _company.Sold.Value.ToLongDateString())</td>
|
||||
<td>@string.Format(L["Company was renamed on {0} to an unknown name."], _company.SoldMonthIsUnknown ? $"{_company.Sold.Value.Year}" : _company.SoldDayIsUnknown ? $"{_company.Sold.Value:Y}" : _company.Sold.Value.ToLongDateString())</td>
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -506,4 +506,28 @@
|
||||
<value>Añadir nueva descripción</value>
|
||||
<comment>Add new description</comment>
|
||||
</data>
|
||||
<data name="Unknown foundation month" xml:space="preserve">
|
||||
<value>Mes de fundación desconocido</value>
|
||||
<comment>Unknown foundation month</comment>
|
||||
</data>
|
||||
<data name="Unknown foundation day" xml:space="preserve">
|
||||
<value>Día de fundación desconocido</value>
|
||||
<comment>Unknown foundation day</comment>
|
||||
</data>
|
||||
<data name="If the foundation day or month are selected as unknown, pick anyone in the field below, it will be ignored." xml:space="preserve">
|
||||
<value>Si el día o mes de la fundación están marcados como desconocidos, elige cualquiera en el campo inferior, será ignorado.</value>
|
||||
<comment>If the foundation day or month are selected as unknown, pick anyone in the field below, it will be ignored.</comment>
|
||||
</data>
|
||||
<data name="Unknown sold/merge/bankruptcy month" xml:space="preserve">
|
||||
<value>Mes de venta, fusión o bancarrota desconocido</value>
|
||||
<comment>Unknown sold/merge/bankruptcy month</comment>
|
||||
</data>
|
||||
<data name="Unknown sold/merge/bankruptcy day" xml:space="preserve">
|
||||
<value>Día de venta, fusión o bancarrota desconocido</value>
|
||||
<comment>Unknown sold/merge/bankruptcy day</comment>
|
||||
</data>
|
||||
<data name="If the sold, merge or bankruptcy day or month are selected as unknown, pick anyone in the field below, it will be ignored." xml:space="preserve">
|
||||
<value>Si el día o mes de la venta, fusión o bancarrota están marcados como desconocidos, elige cualquiera en el campo inferior, será ignorado.</value>
|
||||
<comment>If the sold, merge or bankruptcy day or month are selected as unknown, pick anyone in the field below, it will be ignored.</comment>
|
||||
</data>
|
||||
</root>
|
||||
@@ -54,14 +54,25 @@ namespace Marechai.Services
|
||||
Logos.
|
||||
OrderByDescending(l => l.Year).
|
||||
FirstOrDefault().Guid,
|
||||
Name = c.Name, Founded = c.Founded,
|
||||
Sold = c.Sold, SoldToId = c.SoldToId,
|
||||
CountryId = c.CountryId, Status = c.Status,
|
||||
Website = c.Website, Twitter = c.Twitter,
|
||||
Facebook = c.Facebook, Address = c.Address,
|
||||
City = c.City, Province = c.Province,
|
||||
PostalCode = c.PostalCode,
|
||||
Country = c.Country.Name
|
||||
Name = c.Name,
|
||||
Founded = c.Founded,
|
||||
Sold = c.Sold,
|
||||
SoldToId = c.SoldToId,
|
||||
CountryId = c.CountryId,
|
||||
Status = c.Status,
|
||||
Website = c.Website,
|
||||
Twitter = c.Twitter,
|
||||
Facebook = c.Facebook,
|
||||
Address = c.Address,
|
||||
City = c.City,
|
||||
Province = c.Province,
|
||||
PostalCode = c.PostalCode,
|
||||
Country = c.Country.Name,
|
||||
FoundedDayIsUnknown = c.FoundedDayIsUnknown,
|
||||
FoundedMonthIsUnknown =
|
||||
c.FoundedMonthIsUnknown,
|
||||
SoldDayIsUnknown = c.SoldDayIsUnknown,
|
||||
SoldMonthIsUnknown = c.SoldMonthIsUnknown
|
||||
}).ToListAsync();
|
||||
|
||||
public async Task<CompanyViewModel> GetAsync(int id) => await _context.Companies.Where(c => c.Id == id).
|
||||
@@ -73,17 +84,28 @@ namespace Marechai.Services
|
||||
OrderByDescending(l => l.
|
||||
Year).
|
||||
FirstOrDefault().Guid,
|
||||
Name = c.Name, Founded = c.Founded,
|
||||
Sold = c.Sold, SoldToId = c.SoldToId,
|
||||
CountryId = c.CountryId,
|
||||
Status = c.Status,
|
||||
Website = c.Website,
|
||||
Twitter = c.Twitter,
|
||||
Facebook = c.Facebook,
|
||||
Address = c.Address, City = c.City,
|
||||
Province = c.Province,
|
||||
Name = c.Name,
|
||||
Founded = c.Founded,
|
||||
Sold = c.Sold,
|
||||
SoldToId = c.SoldToId,
|
||||
CountryId = c.CountryId,
|
||||
Status = c.Status,
|
||||
Website = c.Website,
|
||||
Twitter = c.Twitter,
|
||||
Facebook = c.Facebook,
|
||||
Address = c.Address,
|
||||
City = c.City,
|
||||
Province = c.Province,
|
||||
PostalCode = c.PostalCode,
|
||||
Country = c.Country.Name
|
||||
Country = c.Country.Name,
|
||||
FoundedDayIsUnknown =
|
||||
c.FoundedDayIsUnknown,
|
||||
FoundedMonthIsUnknown =
|
||||
c.FoundedMonthIsUnknown,
|
||||
SoldDayIsUnknown =
|
||||
c.SoldDayIsUnknown,
|
||||
SoldMonthIsUnknown =
|
||||
c.SoldMonthIsUnknown
|
||||
}).FirstOrDefaultAsync();
|
||||
|
||||
public async Task UpdateAsync(CompanyViewModel viewModel, string userId)
|
||||
@@ -93,20 +115,23 @@ namespace Marechai.Services
|
||||
if(model is null)
|
||||
return;
|
||||
|
||||
model.Name = viewModel.Name;
|
||||
model.Founded = viewModel.Founded;
|
||||
model.Sold = viewModel.Sold;
|
||||
model.SoldToId = viewModel.SoldToId;
|
||||
model.CountryId = viewModel.CountryId;
|
||||
model.Status = viewModel.Status;
|
||||
model.Website = viewModel.Website;
|
||||
model.Twitter = viewModel.Twitter;
|
||||
model.Facebook = viewModel.Facebook;
|
||||
model.Address = viewModel.Address;
|
||||
model.City = viewModel.City;
|
||||
model.Province = viewModel.Province;
|
||||
model.PostalCode = viewModel.PostalCode;
|
||||
|
||||
model.Name = viewModel.Name;
|
||||
model.Founded = viewModel.Founded;
|
||||
model.Sold = viewModel.Sold;
|
||||
model.SoldToId = viewModel.SoldToId;
|
||||
model.CountryId = viewModel.CountryId;
|
||||
model.Status = viewModel.Status;
|
||||
model.Website = viewModel.Website;
|
||||
model.Twitter = viewModel.Twitter;
|
||||
model.Facebook = viewModel.Facebook;
|
||||
model.Address = viewModel.Address;
|
||||
model.City = viewModel.City;
|
||||
model.Province = viewModel.Province;
|
||||
model.PostalCode = viewModel.PostalCode;
|
||||
model.FoundedDayIsUnknown = viewModel.FoundedDayIsUnknown;
|
||||
model.FoundedMonthIsUnknown = viewModel.FoundedMonthIsUnknown;
|
||||
model.SoldDayIsUnknown = viewModel.SoldDayIsUnknown;
|
||||
model.SoldMonthIsUnknown = viewModel.SoldMonthIsUnknown;
|
||||
await _context.SaveChangesWithUserAsync(userId);
|
||||
}
|
||||
|
||||
@@ -114,11 +139,23 @@ namespace Marechai.Services
|
||||
{
|
||||
var model = new Company
|
||||
{
|
||||
Name = viewModel.Name, Founded = viewModel.Founded, Sold = viewModel.Sold,
|
||||
SoldToId = viewModel.SoldToId, CountryId = viewModel.CountryId, Status = viewModel.Status,
|
||||
Website = viewModel.Website, Twitter = viewModel.Twitter, Facebook = viewModel.Facebook,
|
||||
Address = viewModel.Address, City = viewModel.City, Province = viewModel.Province,
|
||||
PostalCode = viewModel.PostalCode
|
||||
Name = viewModel.Name,
|
||||
Founded = viewModel.Founded,
|
||||
Sold = viewModel.Sold,
|
||||
SoldToId = viewModel.SoldToId,
|
||||
CountryId = viewModel.CountryId,
|
||||
Status = viewModel.Status,
|
||||
Website = viewModel.Website,
|
||||
Twitter = viewModel.Twitter,
|
||||
Facebook = viewModel.Facebook,
|
||||
Address = viewModel.Address,
|
||||
City = viewModel.City,
|
||||
Province = viewModel.Province,
|
||||
PostalCode = viewModel.PostalCode,
|
||||
FoundedDayIsUnknown = viewModel.FoundedDayIsUnknown,
|
||||
FoundedMonthIsUnknown = viewModel.FoundedMonthIsUnknown,
|
||||
SoldDayIsUnknown = viewModel.SoldDayIsUnknown,
|
||||
SoldMonthIsUnknown = viewModel.SoldMonthIsUnknown
|
||||
};
|
||||
|
||||
await _context.Companies.AddAsync(model);
|
||||
@@ -130,7 +167,9 @@ namespace Marechai.Services
|
||||
public async Task<List<Machine>> GetMachinesAsync(int id) =>
|
||||
await _context.Machines.Where(m => m.CompanyId == id).OrderBy(m => m.Name).Select(m => new Machine
|
||||
{
|
||||
Id = m.Id, Name = m.Name, Type = m.Type
|
||||
Id = m.Id,
|
||||
Name = m.Name,
|
||||
Type = m.Type
|
||||
}).ToListAsync();
|
||||
|
||||
public async Task<string> GetDescriptionTextAsync(int id)
|
||||
@@ -143,7 +182,8 @@ namespace Marechai.Services
|
||||
|
||||
public async Task<Company> GetSoldToAsync(int? id) => await _context.Companies.Select(c => new Company
|
||||
{
|
||||
Id = c.Id, Name = c.Name
|
||||
Id = c.Id,
|
||||
Name = c.Name
|
||||
}).FirstOrDefaultAsync(c => c.Id == id);
|
||||
|
||||
public async Task<string> GetCountryNameAsync(int id) =>
|
||||
@@ -228,7 +268,9 @@ namespace Marechai.Services
|
||||
{
|
||||
current = new CompanyDescription
|
||||
{
|
||||
CompanyId = id, Html = description.Html, Text = description.Markdown
|
||||
CompanyId = id,
|
||||
Html = description.Html,
|
||||
Text = description.Markdown
|
||||
};
|
||||
|
||||
await _context.CompanyDescriptions.AddAsync(current);
|
||||
|
||||
@@ -46,6 +46,10 @@ namespace Marechai.ViewModels
|
||||
public Guid? LastLogo { get; set; }
|
||||
public string SoldTo { get; set; }
|
||||
public string Country { get; set; }
|
||||
public bool FoundedDayIsUnknown { get; set; }
|
||||
public bool FoundedMonthIsUnknown { get; set; }
|
||||
public bool SoldDayIsUnknown { get; set; }
|
||||
public bool SoldMonthIsUnknown { get; set; }
|
||||
|
||||
public string SoldView => Status != CompanyStatus.Active && Status != CompanyStatus.Unknown
|
||||
? Sold?.ToShortDateString() ?? "Unknown"
|
||||
|
||||
Reference in New Issue
Block a user