Prvi commit

This commit is contained in:
David Štaleker
2023-05-12 09:00:07 +02:00
parent d3ffe93e42
commit 03b92525d7
14757 changed files with 9251133 additions and 53 deletions

25
.dockerignore Normal file
View File

@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

63
.gitattributes vendored Normal file
View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

56
.gitignore vendored
View File

@@ -1,8 +1,7 @@
# ---> VisualStudio
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
@@ -30,6 +29,7 @@ x86/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
@@ -91,7 +91,6 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
@@ -295,17 +294,6 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
@@ -362,9 +350,6 @@ ASALocalRun/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
@@ -376,39 +361,4 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
/EveryThing/wwwroot/Uploads

25
EveryThing.sln Normal file
View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EveryThing", "EveryThing\EveryThing.csproj", "{E6B6526C-7DF2-4F89-8305-26BAF6E52292}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E6B6526C-7DF2-4F89-8305-26BAF6E52292}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6B6526C-7DF2-4F89-8305-26BAF6E52292}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6B6526C-7DF2-4F89-8305-26BAF6E52292}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6B6526C-7DF2-4F89-8305-26BAF6E52292}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {184ACD9A-ADAC-401C-B305-BED08AEC4EC2}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "5.0.9",
"commands": [
"dotnet-ef"
]
}
}
}

View File

@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models;
using EveryThing.Models.Transport;
using EveryThing.Models.Vehicle;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using EveryThing.Models.CodeTable;
using EveryThing.Models.Invoice;
using EveryThing.Models.Project;
namespace EveryThing.Data
{
public class ApplicationDbContext : IdentityDbContext<IdentityApplicationUser, IdentityApplicationRole, int>
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
}
public DbSet<CodeTableEmployee> CodeTableEmployees { get; set; }
public DbSet<CodeTableCountry> CodeTableCountries { get; set; }
public DbSet<CodeTableCompany> CodeTableCompanies { get; set; }
public DbSet<Vehicle> Vehicles { get; set; }
public DbSet<VehicleIssue> VehicleIssues { get; set; }
public DbSet<VehicleBreakdown> VehicleBreakdowns { get; set; }
public DbSet<VehicleDriver> VehicleDrivers { get; set; }
public DbSet<VehicleDrive> VehicleDrives { get; set; }
public DbSet<VehicleFueling> VehicleFuelings { get; set; }
public DbSet<VehicleFuelingCard> VehicleFuelingCards { get; set; }
public DbSet<VehicleFuelType> VehicleFuelTypes { get; set; }
public DbSet<VehicleGroup> VehicleGroups { get; set; }
public DbSet<VehicleIncident> VehicleIncidents { get; set; }
public DbSet<VehicleMake> VehicleMakes { get; set; }
public DbSet<VehicleMeterReading> VehicleMeterReadings { get; set; }
public DbSet<VehicleType> VehicleTypes { get; set; }
public DbSet<GeneralNote> GeneralNotes { get; set; }
public DbSet<CodeTableDepartement> CodeTableDepartements { get; set; }
public DbSet<Document> Documents { get; set; }
public DbSet<DocumentType> DocumentTypes { get; set; }
public DbSet<File> Files { get; set; }
public DbSet<CodeTableJob> CodeTableJobs { get; set; }
public DbSet<TransportLoadingOrder> TransportLoadingOrders {get; set; }
public DbSet<TransportLoadingOrderLoadUnload> TransportLoadingOrderLoadUnloads { get; set; }
public DbSet<CodeTablePartner> CodeTablePartners { get; set; }
public DbSet<Project> Projects { get; set; }
public DbSet<ProjectPart> ProjectParts { get; set; }
public DbSet<ProjectPartItem> ProjectPartItems { get; set; }
public DbSet<CodeTableItem> CodeTableItems { get; set; }
public DbSet<Invoice> Invoices { get; set; }
public DbSet<InvoiceItem> InvoiceItems { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// Sprememba imen tabel in stolpcev v Identity
modelBuilder.Entity<IdentityApplicationUser>(entity =>
{
entity.ToTable("IdentityUser");
entity.Property(e => e.Id).HasColumnName("IdUser");
});
modelBuilder.Entity<IdentityApplicationRole>(entity =>
{
entity.ToTable("IdentityRole");
entity.Property(e => e.Id).HasColumnName("IdRole");
});
modelBuilder.Entity<IdentityUserRole<int>>(entity =>
{
entity.ToTable("IdentityUserRoles");
entity.Property(e => e.UserId).HasColumnName("IdUserFk");
entity.Property(e => e.RoleId).HasColumnName("IdRoleFk");
});
modelBuilder.Entity<IdentityUserClaim<int>>(entity =>
{
entity.ToTable("IdentityUserClaims");
entity.Property(e => e.Id).HasColumnName("IdUserClaim");
entity.Property(e => e.UserId).HasColumnName("IdUserFk");
});
modelBuilder.Entity<IdentityUserLogin<int>>(entity =>
{
entity.ToTable("IdentityUserLogins");
entity.Property(e => e.UserId).HasColumnName("IdUserFk");
});
modelBuilder.Entity<IdentityUserToken<int>>(entity =>
{
entity.ToTable("IdentityUserTokens");
entity.Property(e => e.UserId).HasColumnName("IdUserFk");
});
modelBuilder.Entity<IdentityRoleClaim<int>>(entity =>
{
entity.ToTable("IdentityRoleClaims");
entity.Property(e => e.Id).HasColumnName("IdRoleClaim");
entity.Property(e => e.RoleId).HasColumnName("IdRoleFk");
});
//Relacije
modelBuilder.Entity<CodeTableCountry>().HasMany(t => t.CountryCompany).WithOne(t => t.Country).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCountry>().HasMany(t => t.CountryEmployeeCountry).WithOne(t => t.Country).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCountry>().HasMany(t => t.CountryEmployeeCitizenship).WithOne(t => t.Citizenship).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCountry>().HasMany(t => t.CountryEmployeeTemporaryCountry).WithOne(t => t.TemporaryCountry).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCountry>().HasMany(t => t.CountryPartner).WithOne(t => t.Country).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyPartner).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyTransportLoadingOrder).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyEmployee).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyPrePostText).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyProject).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyItem).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableCompany>().HasMany(t => t.CompanyInvoice).WithOne(t => t.Company).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableJob>().HasMany(t => t.JobEmployee).WithOne(t => t.Job).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleNote).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleVehicleDriver).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleVehicleDrive).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleVehicleFueling).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleVehicleIncident).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleVehicleIssue).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleVehicleMeterReading).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Vehicle>().HasMany(t => t.VehicleTransportLoadingOrder).WithOne(t => t.Vehicle).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Project>().HasMany(t => t.ProjectProjectPart).WithOne(t => t.Project).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<ProjectPart>().HasMany(t => t.ProjectPartProjectPartItem).WithOne(t => t.ProjectPart).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableItem>().HasMany(t => t.ItemProjectPartItem).WithOne(t => t.Item).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<CodeTableItem>().HasMany(t => t.ItemProjectPartItemMaterial).WithOne(t => t.Material).OnDelete(DeleteBehavior.Restrict);
modelBuilder.Entity<Invoice>().HasMany(t => t.InvoiceInvoiceItem).WithOne(t => t.Invoice).OnDelete(DeleteBehavior.Restrict);
}
}
}

22
EveryThing/Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["EveryThing/EveryThing.csproj", "EveryThing/"]
RUN dotnet restore "EveryThing/EveryThing.csproj"
COPY . .
WORKDIR "/src/EveryThing"
RUN dotnet build "EveryThing.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "EveryThing.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "EveryThing.dll"]

View File

@@ -0,0 +1,69 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
<StartupObject>EveryThing.Program</StartupObject>
<UserSecretsId>26f134e2-3bc7-4885-b726-e8a92f2abb2e</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
</PropertyGroup>
<ItemGroup>
<TypeScriptCompile Remove="node_modules\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
<Folder Include="Properties\PublishProfiles\" />
<Folder Include="Properties\ServiceDependencies\" />
<Folder Include="wwwroot\Uploads\Files\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ClosedXML" Version="0.95.4" />
<PackageReference Include="Htmx" Version="0.0.15" />
<PackageReference Include="Htmx.TagHelpers" Version="0.0.15" />
<PackageReference Include="LettuceEncrypt" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Analyzers" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore" Version="6.0.1" />
<PackageReference Include="NLog" Version="4.7.14" />
<PackageReference Include="NLog.Config" Version="4.7.14" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.15.1" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties NpmRestoreOnPackageJsonSave="True" /></VisualStudio></ProjectExtensions>
</Project>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="1a7bd1ae-19dc-41de-be2e-e64403f82159" version="1">
<creationDate>2023-05-03T13:10:54.373874Z</creationDate>
<activationDate>2023-05-03T13:10:54.3012762Z</activationDate>
<expirationDate>2023-08-01T13:10:54.3012762Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>XH/o1Q8fiukfCP8g46LJBJFVfKBnyVaJbhxdHEkP5bz7PXW0B+CsFIZidzz7++eyDlSb1lujrTnV09rlymVgzw==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="69f0890e-0f11-4830-98f4-f90d319c3479" version="1">
<creationDate>2022-09-15T10:28:17.7415146Z</creationDate>
<activationDate>2022-09-15T10:28:17.6715335Z</activationDate>
<expirationDate>2022-12-14T10:28:17.6715335Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>c0QLoDfbPViGBz5zbImP5OxjcO34Bd/ZcyluZGJiisyrbiTv/fZJ8ikCxndCXHgj3gsQuggpaQ1R+B3r004bjQ==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="a73bf233-a73e-4b4f-a9be-00eb859c8481" version="1">
<creationDate>2022-12-18T10:15:30.3394683Z</creationDate>
<activationDate>2022-12-18T10:15:30.2779454Z</activationDate>
<expirationDate>2023-03-18T10:15:30.2779454Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>VbcP3gI3GitBCLI9x3Y2e23HKce5cGyqJoUrjxV0WuCUWbBPNNDS0qoxjhKi7AdFRCth3RFI7yFr6eISjh/t4w==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="c6ca39e6-90a4-4a6c-82c1-57940171c341" version="1">
<creationDate>2022-03-12T19:39:19.0684887Z</creationDate>
<activationDate>2022-03-12T19:39:18.9942222Z</activationDate>
<expirationDate>2022-06-10T19:39:18.9942222Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>JnNSZOrRvnv0Lz/Mxj3YQAE3fA8nqs3Kb3JKoB9u2sniq1LpASc7DyHGtr0PUWHKr+BYg9d/2ffjqdYSH16J9Q==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<key id="dab2bc0e-f8d3-4ece-961d-c70c843695f5" version="1">
<creationDate>2022-06-13T06:09:02.7441532Z</creationDate>
<activationDate>2022-06-13T06:09:02.6344071Z</activationDate>
<expirationDate>2022-09-11T06:09:02.6344071Z</expirationDate>
<descriptor deserializerType="Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer, Microsoft.AspNetCore.DataProtection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60">
<descriptor>
<encryption algorithm="AES_256_CBC" />
<validation algorithm="HMACSHA256" />
<masterKey p4:requiresEncryption="true" xmlns:p4="http://schemas.asp.net/2015/03/dataProtection">
<!-- Warning: the key below is in an unencrypted form. -->
<value>koptjvQgnCMR8h3jm6BOt496AgU8mzyvqRST9hHM6yLzQdgvCu+J1Si2+TwhMaQiLef6XHCryl0U+qGQ6Bzg6A==</value>
</masterKey>
</descriptor>
</descriptor>
</key>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,270 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _2 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_Invoices_IdInvoiceFk",
table: "InvoiceItems");
migrationBuilder.DropPrimaryKey(
name: "PK_Invoices",
table: "Invoices");
migrationBuilder.RenameColumn(
name: "IdProject",
table: "Invoices",
newName: "Type");
migrationBuilder.AlterColumn<int>(
name: "Type",
table: "Invoices",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AddColumn<int>(
name: "IdInvoice",
table: "Invoices",
type: "int",
nullable: false,
defaultValue: 0)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AddColumn<DateTime>(
name: "Date",
table: "Invoices",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<int>(
name: "IdPartnerFk",
table: "Invoices",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<double>(
name: "Discount",
table: "InvoiceItems",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<int>(
name: "IdItemFk",
table: "InvoiceItems",
type: "int",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "IdProjectPartItem",
table: "InvoiceItems",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "ItemDescription",
table: "InvoiceItems",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Note",
table: "InvoiceItems",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<double>(
name: "Price",
table: "InvoiceItems",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "Quantity",
table: "InvoiceItems",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "Tax",
table: "InvoiceItems",
type: "double",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddPrimaryKey(
name: "PK_Invoices",
table: "Invoices",
column: "IdInvoice");
migrationBuilder.CreateIndex(
name: "IX_Invoices_IdPartnerFk",
table: "Invoices",
column: "IdPartnerFk");
migrationBuilder.CreateIndex(
name: "IX_InvoiceItems_IdItemFk",
table: "InvoiceItems",
column: "IdItemFk");
migrationBuilder.CreateIndex(
name: "IX_InvoiceItems_IdProjectPartItem",
table: "InvoiceItems",
column: "IdProjectPartItem");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_CodeTableItems_IdItemFk",
table: "InvoiceItems",
column: "IdItemFk",
principalTable: "CodeTableItems",
principalColumn: "IdItem");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_Invoices_IdInvoiceFk",
table: "InvoiceItems",
column: "IdInvoiceFk",
principalTable: "Invoices",
principalColumn: "IdInvoice",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_ProjectPartItems_IdProjectPartItem",
table: "InvoiceItems",
column: "IdProjectPartItem",
principalTable: "ProjectPartItems",
principalColumn: "IdProjectPartItem",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Invoices_CodeTablePartners_IdPartnerFk",
table: "Invoices",
column: "IdPartnerFk",
principalTable: "CodeTablePartners",
principalColumn: "IdPartner",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_CodeTableItems_IdItemFk",
table: "InvoiceItems");
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_Invoices_IdInvoiceFk",
table: "InvoiceItems");
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_ProjectPartItems_IdProjectPartItem",
table: "InvoiceItems");
migrationBuilder.DropForeignKey(
name: "FK_Invoices_CodeTablePartners_IdPartnerFk",
table: "Invoices");
migrationBuilder.DropPrimaryKey(
name: "PK_Invoices",
table: "Invoices");
migrationBuilder.DropIndex(
name: "IX_Invoices_IdPartnerFk",
table: "Invoices");
migrationBuilder.DropIndex(
name: "IX_InvoiceItems_IdItemFk",
table: "InvoiceItems");
migrationBuilder.DropIndex(
name: "IX_InvoiceItems_IdProjectPartItem",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "IdInvoice",
table: "Invoices");
migrationBuilder.DropColumn(
name: "Date",
table: "Invoices");
migrationBuilder.DropColumn(
name: "IdPartnerFk",
table: "Invoices");
migrationBuilder.DropColumn(
name: "Discount",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "IdItemFk",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "IdProjectPartItem",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "ItemDescription",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "Note",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "Price",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "Quantity",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "Tax",
table: "InvoiceItems");
migrationBuilder.RenameColumn(
name: "Type",
table: "Invoices",
newName: "IdProject");
migrationBuilder.AlterColumn<int>(
name: "IdProject",
table: "Invoices",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AddPrimaryKey(
name: "PK_Invoices",
table: "Invoices",
column: "IdProject");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_Invoices_IdInvoiceFk",
table: "InvoiceItems",
column: "IdInvoiceFk",
principalTable: "Invoices",
principalColumn: "IdProject",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _3 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "State",
table: "Invoices",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "State",
table: "Invoices");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _4 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_ProjectPartItems_IdProjectPartItem",
table: "InvoiceItems");
migrationBuilder.AlterColumn<int>(
name: "IdProjectPartItem",
table: "InvoiceItems",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_ProjectPartItems_IdProjectPartItem",
table: "InvoiceItems",
column: "IdProjectPartItem",
principalTable: "ProjectPartItems",
principalColumn: "IdProjectPartItem");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_ProjectPartItems_IdProjectPartItem",
table: "InvoiceItems");
migrationBuilder.AlterColumn<int>(
name: "IdProjectPartItem",
table: "InvoiceItems",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_ProjectPartItems_IdProjectPartItem",
table: "InvoiceItems",
column: "IdProjectPartItem",
principalTable: "ProjectPartItems",
principalColumn: "IdProjectPartItem",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _5 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "InvoiceNumber",
table: "Invoices",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "InvoiceYear",
table: "Invoices",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Note",
table: "Invoices",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PostText",
table: "Invoices",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PreText",
table: "Invoices",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "InvoiceNumber",
table: "Invoices");
migrationBuilder.DropColumn(
name: "InvoiceYear",
table: "Invoices");
migrationBuilder.DropColumn(
name: "Note",
table: "Invoices");
migrationBuilder.DropColumn(
name: "PostText",
table: "Invoices");
migrationBuilder.DropColumn(
name: "PreText",
table: "Invoices");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _6 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "IdPartnerFk",
table: "Projects",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "LogoFileName",
table: "CodeTableCompanies",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Projects_IdPartnerFk",
table: "Projects",
column: "IdPartnerFk");
migrationBuilder.AddForeignKey(
name: "FK_Projects_CodeTablePartners_IdPartnerFk",
table: "Projects",
column: "IdPartnerFk",
principalTable: "CodeTablePartners",
principalColumn: "IdPartner",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Projects_CodeTablePartners_IdPartnerFk",
table: "Projects");
migrationBuilder.DropIndex(
name: "IX_Projects_IdPartnerFk",
table: "Projects");
migrationBuilder.DropColumn(
name: "IdPartnerFk",
table: "Projects");
migrationBuilder.DropColumn(
name: "LogoFileName",
table: "CodeTableCompanies");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _7 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DateOfDispatch",
table: "Invoices",
type: "datetime(6)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DateOfDispatch",
table: "Invoices");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _8 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PathOfPlans",
table: "ProjectParts",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PathOfPlans",
table: "ProjectParts");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _9 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "State",
table: "InvoiceItems",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "State",
table: "InvoiceItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,48 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _10 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Buyer",
table: "CodeTablePartners",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "Supplier",
table: "CodeTablePartners",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "CodeTableItemType",
table: "CodeTableItems",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Buyer",
table: "CodeTablePartners");
migrationBuilder.DropColumn(
name: "Supplier",
table: "CodeTablePartners");
migrationBuilder.DropColumn(
name: "CodeTableItemType",
table: "CodeTableItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,81 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _11 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "BuyersOrderNumber",
table: "Projects",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "ProjectNumber",
table: "Projects",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ProjectYear",
table: "Projects",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ProjectPartNumber",
table: "ProjectParts",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "DeliveryDate",
table: "ProjectPartItems",
type: "datetime(6)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ProjectPartItemNumber",
table: "ProjectPartItems",
type: "int",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BuyersOrderNumber",
table: "Projects");
migrationBuilder.DropColumn(
name: "ProjectNumber",
table: "Projects");
migrationBuilder.DropColumn(
name: "ProjectYear",
table: "Projects");
migrationBuilder.DropColumn(
name: "ProjectPartNumber",
table: "ProjectParts");
migrationBuilder.DropColumn(
name: "DeliveryDate",
table: "ProjectPartItems");
migrationBuilder.DropColumn(
name: "ProjectPartItemNumber",
table: "ProjectPartItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _12 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "BuyersOrderNumber",
table: "Invoices",
type: "longtext",
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BuyersOrderNumber",
table: "Invoices");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _13 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<float>(
name: "SellingPrice",
table: "ProjectPartItems",
type: "float",
nullable: false,
defaultValue: 0f);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SellingPrice",
table: "ProjectPartItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _14 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DateModified",
table: "ProjectPartItems",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DateModified",
table: "ProjectPartItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EveryThing.Migrations
{
public partial class _15 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "IdInvoiceItemJoinFk",
table: "InvoiceItems",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_InvoiceItems_IdInvoiceItemJoinFk",
table: "InvoiceItems",
column: "IdInvoiceItemJoinFk");
migrationBuilder.AddForeignKey(
name: "FK_InvoiceItems_InvoiceItems_IdInvoiceItemJoinFk",
table: "InvoiceItems",
column: "IdInvoiceItemJoinFk",
principalTable: "InvoiceItems",
principalColumn: "IdInvoiceItem");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InvoiceItems_InvoiceItems_IdInvoiceItemJoinFk",
table: "InvoiceItems");
migrationBuilder.DropIndex(
name: "IX_InvoiceItems_IdInvoiceItemJoinFk",
table: "InvoiceItems");
migrationBuilder.DropColumn(
name: "IdInvoiceItemJoinFk",
table: "InvoiceItems");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,170 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.Transport;
using EveryThing.Models.Vehicle;
using Microsoft.AspNetCore.Http;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.CodeTable
{
public class CodeTableCompany
{
[Key]
public int IdCompany { get; set; }
[NotMapped]
public IFormFile Logo { get; set; }
[Display(Name = "Logotip ime datoteke")]
public string LogoFileName { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Display(Name = "Kratek naziv")]
public string ShortTitle { get; set; }
[Required]
[ForeignKey("Country")]
[Display(Name = "Država")]
public int IdCountryFk { get; set; }
[Required]
[Display(Name = "Mesto")]
public string City { get; set; }
[Required]
[Display(Name = "Ulica")]
public string Street { get; set; }
[Required]
[Display(Name = "Hišna št.")]
public string HouseNumber { get; set; }
[Required]
[Display(Name = "Poštna številka")]
public int PostNumber { get; set; }
[Required]
[Display(Name = "Pošta")]
public string Post { get; set; }
[Required]
[Display(Name = "Davčna številka")]
public string TaxNumber { get; set; }
[Required]
[Display(Name = "Matična številka")]
public string RegistrationNumber { get; set; }
[Display(Name = "E-poštni naslov")]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[Required]
[Display(Name= "Banka")]
public string Bank { get; set; }
[Required]
[Display(Name = "IBAN")]
public string Iban { get; set; }
[Required]
[Display(Name = "SWIFT/BIC")]
public string SwiftBic { get; set; }
[Required]
[Display(Name = "Direktor")]
public string Ceo { get; set; }
[Display(Name = "Telefon")]
public string Phone { get; set; }
[Required]
public bool Active { get; set; }
// ForeignKey
public CodeTableCountry Country { get; set; }
// Partner
[InverseProperty("Company")]
public virtual ICollection<CodeTablePartner> CompanyPartner { get; set; }
// Partner
[InverseProperty("Company")]
public virtual ICollection<TransportLoadingOrder> CompanyTransportLoadingOrder { get; set; }
// Employee
[InverseProperty("Company")]
public virtual ICollection<CodeTableEmployee> CompanyEmployee { get; set; }
// Departement
[InverseProperty("Company")]
public virtual ICollection<CodeTableDepartement> CompanyDepartement { get; set; }
// Job
[InverseProperty("Company")]
public virtual ICollection<CodeTableJob> CompanyJob { get; set; }
// Vehicle
[InverseProperty("Company")]
public virtual ICollection<Vehicle.Vehicle> CompanyVehicle { get; set; }
// VehicleType
[InverseProperty("Company")]
public virtual ICollection<VehicleType> CompanyVehicleType { get; set; }
// VehicleMake
[InverseProperty("Company")]
public virtual ICollection<VehicleMake> CompanyVehicleMake { get; set; }
// VehicleGroup
[InverseProperty("Company")]
public virtual ICollection<VehicleGroup> CompanyVehicleGroup { get; set; }
// VehicleFuelType
[InverseProperty("Company")]
public virtual ICollection<VehicleFuelType> CompanyVehicleFuelType { get; set; }
// VehicleFuelingCard
[InverseProperty("Company")]
public virtual ICollection<VehicleFuelingCard> CompanyVehicleFuelingCard { get; set; }
// IdentityApplicationUser
[InverseProperty("Company")]
public virtual ICollection<IdentityApplicationUser> CompanyIdentityApplicationUser { get; set; }
// Note
[InverseProperty("Company")]
public virtual ICollection<GeneralNote> CompanyNote { get; set; }
// VehicleBreakdown
[InverseProperty("Company")]
public virtual ICollection<VehicleBreakdown> CompanyVehicleBreakdown { get; set; }
// File
[InverseProperty("Company")]
public virtual ICollection<File> CompanyFile { get; set; }
// PrePostText
[InverseProperty("Company")]
public virtual ICollection<CodeTablePrePostText> CompanyPrePostText { get; set; }
// Project
[InverseProperty("Company")]
public virtual ICollection<Project.Project> CompanyProject { get; set; }
// CodeTableItem
[InverseProperty("Company")]
public virtual ICollection<CodeTableItem> CompanyItem { get; set; }
// Invoice
[InverseProperty("Company")]
public virtual ICollection<Invoice.Invoice> CompanyInvoice { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.Vehicle;
namespace EveryThing.Models.CodeTable
{
public class CodeTableCountry
{
[Key]
public int IdCountry { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
[Display(Name = "Koda države")]
public string Code { get; set; }
[Required]
[Display(Name = "Slovenski naziv")]
public string TranslationSlovenian { get; set; }
// Partner
[InverseProperty("Country")]
public virtual ICollection<CodeTablePartner> CountryPartner { get; set; }
//Employee
[InverseProperty("Citizenship")]
public virtual ICollection<CodeTableEmployee> CountryEmployeeCitizenship { get; set; }
//Employee
[InverseProperty("Country")]
public virtual ICollection<CodeTableEmployee> CountryEmployeeCountry { get; set; }
//Employee
[InverseProperty("TemporaryCountry")]
public virtual ICollection<CodeTableEmployee> CountryEmployeeTemporaryCountry { get; set; }
//Company
[InverseProperty("Country")]
public virtual ICollection<CodeTableCompany> CountryCompany { get; set; }
//VehicleFueling
[InverseProperty("Country")]
public virtual ICollection<VehicleFueling> CountryVehicleFueling { get; set; }
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace EveryThing.Models.CodeTable
{
public class CodeTableDepartement
{
[Key]
public int IdDepartement { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Employee
[InverseProperty("Departement")]
public virtual ICollection<CodeTableEmployee> DepartementEmployee { get; set; }
//Vehicle
[InverseProperty("Departement")]
public virtual ICollection<Vehicle.Vehicle> DepartementVehicle { get; set; }
}
}

View File

@@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.Vehicle;
using Microsoft.AspNetCore.Http;
namespace EveryThing.Models.CodeTable
{
public enum CodeTableEmployeeGender
{
[Display(Name = "Moški")]
Male = 0,
[Display(Name = "Ženska")]
Female = 1
}
public class CodeTableEmployee
{
[Key]
public int IdEmployee { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[NotMapped]
public IFormFile ProfileImage { get; set; }
[Required]
[Display(Name = "Ime")]
public string FirstName { get; set; }
[Required]
[Display(Name = "Priimek")]
public string LastName { get; set; }
[Required]
[Display(Name = "Spol")]
public CodeTableEmployee Gender { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum rojstva")]
public DateTime BirthDate { get; set; }
[ForeignKey("Job")]
[Display(Name = "Delovno mesto")]
public int IdJobFk { get; set; }
[ForeignKey("Departement")]
[Display(Name = "Oddelek")]
public int IdDepartementFk { get; set; }
[ForeignKey("Country")]
[Display(Name = "Država")]
public int IdCountryFk { get; set; }
[Required]
[Display(Name = "Mesto")]
public string City { get; set; }
[Required]
[Display(Name = "Ulica")]
public string Street { get; set; }
[Required]
[Display(Name = "Hišna št.")]
public string HouseNumber { get; set; }
[Required]
[Display(Name = "Poštna številka")]
public int PostNumber { get; set; }
[Required]
[Display(Name = "Pošta")]
public string Post { get; set; }
[ForeignKey("TemporaryCountry")]
[Display(Name = "Država")]
public int? IdTemporaryCountryFk { get; set; }
[Display(Name = "Mesto")]
public string TemporaryCity { get; set; }
[Display(Name = "Ulica")]
public string TemporaryStreet { get; set; }
[Display(Name = "Hišna št.")]
public string TemporaryHouseNumber { get; set; }
[Display(Name = "Poštna številka")]
public int TemporaryPostNumber { get; set; }
[Display(Name = "Pošta")]
public string TemporaryPost { get; set; }
[Required]
[ForeignKey("Citizenship")]
[Display(Name = "Državljanstvo")]
public int IdCitizenshipFk { get; set; }
[Required]
[Display(Name = "Številka EMŠO")]
public string CitizenIdNumber { get; set; }
[Display(Name = "Telefon")]
public string Telephone { get; set; }
[Display(Name = "Mobilni telefon")]
public string MobileTelephone { get; set; }
[Display(Name = "E-poštni naslov")]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[Required]
[Display(Name = "Davčna številka")]
public int TaxNumber { get; set; }
[Required]
[Display(Name = "Bančni račun")]
public string BankAccount { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum zaposlitve")]
public DateTime EmploymentDate { get; set; }
[Display(Name = "Urna postavka")]
public float HourlyWage { get; set; } = 0;
[Display(Name = "Opomba")]
public string Note { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCountry Citizenship { get; set; }
public CodeTableCompany Company { get; set; }
public CodeTableCountry Country { get; set; }
public CodeTableCountry TemporaryCountry { get; set; }
public CodeTableJob Job { get; set; }
public CodeTableDepartement Departement { get; set; }
//VehicleFueling
[InverseProperty("Employee")]
public virtual ICollection<VehicleFueling> EmployeeVehicleFueling { get; set; }
//Incident
[InverseProperty("Employee")]
public virtual ICollection<VehicleIncident> EmployeeIncident { get; set; }
//Issue
[InverseProperty("Employee")]
public virtual ICollection<VehicleIssue> EmployeeIssue { get; set; }
//Note
[InverseProperty("Employee")]
public virtual ICollection<GeneralNote> EmployeeNote { get; set; }
//VehicleBreakdown
[InverseProperty("Employee")]
public virtual ICollection<VehicleBreakdown> EmployeeVehicleBreakdown { get; set; }
//VehicleDriver
[InverseProperty("Employee")]
public virtual ICollection<VehicleDriver> EmployeeVehicleDriver { get; set; }
//VehicleDrive
[InverseProperty("Employee")]
public virtual ICollection<VehicleDrive> EmployeeVehicleDrive { get; set; }
}
}

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using EveryThing.Models.Project;
namespace EveryThing.Models.CodeTable
{
public enum CodeTableItemType
{
[Display(Name = "Produkt")]
Product = 0,
[Display(Name = "Material")]
Material = 1
}
public class CodeTableItem
{
[Key]
public int IdItem { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Display(Name = "Opis")]
public string Description { get; set; }
[Required]
[Display(Name = "Aktiven")]
public bool Active { get; set; }
[Required]
[Display(Name = "Tip")]
public CodeTableItemType CodeTableItemType { get; set; } = CodeTableItemType.Product;
// ForeignKey
public CodeTableCompany Company { get; set; }
// ProjectPartItem
[InverseProperty("Item")]
public virtual ICollection<ProjectPartItem> ItemProjectPartItem { get; set; }
// ProjectPartItem
[InverseProperty("Material")]
public virtual ICollection<ProjectPartItem> ItemProjectPartItemMaterial { get; set; }
// InoviceItem
[InverseProperty("Item")]
public virtual ICollection<Invoice.InvoiceItem> InvoiceItem { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace EveryThing.Models.CodeTable
{
public class CodeTableJob
{
[Key]
public int IdJob { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Employee
[InverseProperty("Job")]
public virtual ICollection<CodeTableEmployee> JobEmployee { get; set; }
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.Project;
using EveryThing.Models.Transport;
namespace EveryThing.Models.CodeTable
{
public class CodeTablePartner
{
[Key]
public int IdPartner { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
[ForeignKey("Country")]
[Display(Name = "Država")]
public int IdCountryFk { get; set; }
[Required]
[Display(Name = "Mesto")]
public string City { get; set; }
[Required]
[Display(Name = "Ulica")]
public string Street { get; set; }
[Required]
[Display(Name = "Hišna št.")]
public string HouseNumber { get; set; }
[Required]
[Display(Name = "Poštna številka")]
public int PostNumber { get; set; }
[Required]
[Display(Name = "Pošta")]
public string Post { get; set; }
[Display(Name = "Davčna številka")]
public string TaxNumber { get; set; }
[Display(Name = "Matična številka")]
public string RegistrationNumber { get; set; }
[Display(Name = "E-poštni naslov")]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[Required]
[Display(Name = "Aktiven")]
public bool Active { get; set; }
[Required]
[Display(Name = "Kupec")]
public bool Buyer { get; set; } = false;
[Required]
[Display(Name = "Dobavitelj")]
public bool Supplier { get; set; } = false;
// ForeingKey
public CodeTableCountry Country { get; set; }
public CodeTableCompany Company { get; set; }
// TransportLoadingOrderLoad
[InverseProperty("Loading")]
public virtual ICollection<TransportLoadingOrderLoadUnload> PartnerTransportLoadingOrderLoad { get; set; }
// TransportLoadingOrderUnload
[InverseProperty("Unloading")]
public virtual ICollection<TransportLoadingOrderLoadUnload> PartnerTransportLoadingOrderUnload { get; set; }
// TransportLoadingOrderLoad
[InverseProperty("Partner")]
public virtual ICollection<TransportLoadingOrder> PartnerTransportLoadingOrder { get; set; }
// ProjectPartItem
[InverseProperty("MaterialSupplier")]
public virtual ICollection<ProjectPartItem> PartnerProjectPartItem { get; set; }
// InvoicePart
[InverseProperty("Partner")]
public virtual ICollection<Invoice.Invoice> Invoice { get; set; }
// Project
[InverseProperty("Partner")]
public virtual ICollection<Project.Project> PartnerProject { get; set; }
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.CodeTable
{
public class CodeTablePrePostText
{
[Key]
public int IdPrePostText { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Vrsta")]
public string Type { get; set; }
[Required]
[Display(Name = "Vsebina")]
public string Content { get; set; }
// ForeingKey
public CodeTableCompany Company { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace EveryThing.Models
{
public class Document
{
[Key]
public int IdDocument { get; set; }
[Required]
[ForeignKey("DocumentType")]
public int IdDocumentTypeFk { get; set; }
[Required]
public int IdReferenceFk { get; set; }
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum poteka")]
public DateTime? ExpirationDate { get; set; }
[Display(Name = "Številka")]
public string Number { get; set; }
[Display(Name = "Referenca")]
public string Reference { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public DocumentType DocumentType { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models
{
public enum DocumentTypeReference
{
Vehicle = 0,
Employee = 1
}
public class DocumentType
{
[Key]
public int IdDocumentType { get; set; }
[ForeignKey("Company")]
public int? IdCompanyFk { get; set; }
[Required]
public DocumentTypeReference DocumentTypeReference { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Document
[InverseProperty("DocumentType")]
public virtual ICollection<Document> DocumentTypeDocument { get; set; }
}
}

70
EveryThing/Models/File.cs Normal file
View File

@@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models
{
public enum FileType
{
Vehicle = 0,
VehicleIssue = 1,
VehicleIncident = 2,
VehicleFuelingCard = 3,
VehicleFueling = 4,
VehicleBreakdown = 5,
Document = 6,
Note = 7,
Project = 8,
ProjectPart = 9,
ProjectPartItem = 10,
CodeTableItem = 11
}
public class File
{
[Key]
public int IdFile { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
public FileType FileType { get; set; }
[Required]
public int IdReferenceFk { get; set; }
[Required]
public string Guid { get; set; }
[Required]
public string Extension { get; set; }
[Required]
public string Salt { get; set; }
[Required]
public string Iv { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH:mm:ss}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum dodajanja")]
public DateTime DateOfUpload { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models
{
public enum GeneralNoteStatus
{
[Display(Name = "Na čakanju")]
Pending = 0,
[Display(Name = "V teku")]
Processing = 1,
[Display(Name = "Obdelano")]
Fixed = 2
}
public class GeneralNote
{
[Key]
public int IdNote { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required(ErrorMessage = "Izbira stanja je obvezna")]
[Display(Name = "Status")]
public GeneralNoteStatus Status { get; set; }
[ForeignKey("Employee")]
[Display(Name = "Delavec")]
public int? IdEmployeeFk { get; set; }
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int? IdVehicleFk { get; set; }
[Required(ErrorMessage = "Polje datum vnosa je obvezno")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum vnosa")]
public DateTime DateSubmitted { get; set; }
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum opomnika")]
public DateTime? DateReminder { get; set; }
[Display(Name = "Opis")]
public string Description { get; set; }
//ForeignKey
public CodeTableEmployee Employee { get; set; }
public Vehicle.Vehicle Vehicle { get; set; }
public CodeTableCompany Company { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
namespace EveryThing.Models
{
public class IdentityApplicationRole : IdentityRole<int>
{
[Required]
public string Description { get; set; }
[Required]
public bool Active { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models
{
public class IdentityApplicationUser : IdentityUser<int>
{
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
public string Name { get; set; }
[Required]
public string Surname { get; set; }
[Required]
public DateTime DateCreated { get; set; }
[Required]
public DateTime DateValidUntil { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
}
}

View File

@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Invoice
{
public class Invoice
{
public class InvoiceStateAttribute : Attribute
{
public string AllowedTypes { get; set; } = "0,1,2,3";
}
public enum InvoiceType
{
[Display(Name = "Račun", ShortName = "Racun")]
Invoice = 0,
[Display(Name = "Naročilo", ShortName = "Narocilo")]
Order = 1,
[Display(Name = "Dobavnica", ShortName = "Dobavnica")]
DeliveryNote = 2,
[Display(Name = "Naročilo kupca", ShortName = "Narocilo")]
BuyersOrder = 3,
}
public enum InvoiceState
{
[Display(Name = "Nov")]
[InvoiceState]
New = 0,
[Display(Name = "Povpraševanje")]
[InvoiceState(AllowedTypes = "1")]
Inquiry = 1,
[Display(Name = "Ponudba")]
[InvoiceState(AllowedTypes = "3")]
Offer = 2,
[Display(Name = "Potrjen")]
[InvoiceState]
Confirmed = 10,
[Display(Name = "Potrditev naročila")]
[InvoiceState(AllowedTypes = "3")]
OfferConfirmation = 15,
[Display(Name = "Zaprt")]
[InvoiceState]
Closed = 20
}
[Key]
public int IdInvoice { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Datum")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime Date { get; set; }
[Required]
[Display(Name = "Tip")]
public InvoiceType Type { get; set; }
[Required]
[Display(Name = "Status")]
public InvoiceState State { get; set; } = InvoiceState.New;
[Required]
[ForeignKey("Partner")]
[Display(Name = "Partner")]
public int? IdPartnerFk { get; set; }
[Required]
public int InvoiceNumber { get; set; }
[Required]
public int InvoiceYear { get; set; }
[Display(Name = "Uvodno besedilo")]
public string PreText { get; set; }
[Display(Name = "Zaključno besedilo")]
public string PostText { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
[Display(Name = "Številka naročila kupca")]
public string BuyersOrderNumber { get; set; }
/// <summary>
/// Dobavnica/racun => datum odpreme
/// Narocilo => dobavni rok
/// </summary>
[Display(Name = "Datum odpreme")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? DateOfDispatch { get; set; }
[NotMapped]
public string InvoiceNumberFormatted => $"{InvoiceYear}-{InvoiceNumber}";
[NotMapped]
public string InvoiceTypeString
{
get
{
if (Type == InvoiceType.BuyersOrder && State == InvoiceState.Offer)
{
return "Ponudba";
}
if (Type == InvoiceType.BuyersOrder && State == InvoiceState.OfferConfirmation)
{
return "Potrditev_narocila";
}
if (Type == InvoiceType.Order && State == InvoiceState.Inquiry)
{
return "Povprasevanje";
}
return Type.GetType().GetMember(Type.ToString()).First().GetCustomAttribute<DisplayAttribute>()?.ShortName;
}
}
[NotMapped]
public string InvoiceNumberFull => $"{InvoiceTypeString}-{InvoiceNumberFormatted}";
// ForeignKey
public CodeTableCompany Company { get; set; }
public CodeTablePartner Partner { get; set; }
// InvoicePart
[InverseProperty("Invoice")]
public virtual ICollection<InvoiceItem> InvoiceInvoiceItem { get; set; }
}
}

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static EveryThing.Models.Invoice.Invoice;
namespace EveryThing.Models.Invoice
{
public class InvoiceItem
{
public enum InvoiceItemState
{
[Display(Name = "Novo")]
New = 0,
[Display(Name = "Potrjeno")]
Confirmed = 10,
[Display(Name = "Zaprto")]
Closed = 50
}
[Key]
public int IdInvoiceItem { get; set; }
[Required]
[ForeignKey("Invoice")]
public int IdInvoiceFk { get; set; }
[ForeignKey("ProjectPartItem")]
public int? IdProjectPartItem { get; set; }
[ForeignKey("Item")]
[Display(Name = "Artikel")]
public int? IdItemFk { get; set; }
[ForeignKey("InvoiceItemJoin")]
[Display(Name = "Pozicija")]
public int? IdInvoiceItemJoinFk { get; set; }
[Display(Name = "Opis pozicije")]
public string ItemDescription { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
[Display(Name = "Količina")]
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
public double Quantity { get; set; }
[Display(Name = "Cena")]
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
public double Price { get; set; }
[Display(Name = "Rabat")]
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
public double Discount { get; set; }
[Display(Name = "DDV")]
public double Tax { get; set; }
[Required]
[Display(Name = "Status")]
public InvoiceItemState State { get; set; } = InvoiceItemState.New;
[NotMapped]
[Display(Name = "Skupaj")]
[DisplayFormat(DataFormatString = "{0:#,###,##0.00}", ApplyFormatInEditMode = true)]
public double TotalValue => Math.Round((Price * (100 - Discount) / 100) * Quantity, 2);
// ForeignKey
public Invoice Invoice { get; set; }
public Project.ProjectPartItem ProjectPartItem { get; set; }
public CodeTable.CodeTableItem Item { get; set; }
/// <summary>
/// Povezana pozicija fakture, npr ko se iz dob naredi racun
/// </summary>
public InvoiceItem InvoiceItemJoin { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Project
{
public enum ProjectStatus
{
[Display(Name = "Odprt")]
Opened = 0,
[Display(Name = "V izdelavi")]
InProduction = 1,
[Display(Name = "Zaključen")]
Finished = 2,
[Display(Name = "Ponudba")]
Offer = 10
}
public class Project
{
[Key]
public int IdProject { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Partner")]
[ForeignKey("Partner")]
public int IdPartnerFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Display(Name = "Številka naročila kupca")]
public string BuyersOrderNumber { get; set; }
[Display(Name = "Opis")]
public string Description { get; set; }
[Required]
public int ProjectNumber { get; set; } = 0;
[Required]
public int ProjectYear { get; set; } = 0;
[Required]
[Display(Name = "Status")]
public ProjectStatus Status { get; set; } = ProjectStatus.Opened;
[Display(Name = "Datum zaključka")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? FinishedDate { get; set; }
[NotMapped]
[Display(Name = "Številka projekta")]
public string ProjectNumberFormatted => $"{ProjectYear}-{ProjectNumber:D4}";
[NotMapped]
[Display(Name = "Prvi dobavni rok")]
public DateTime? FirstDeliveryDate { get; set; }
[NotMapped]
[Display(Name = "Prvi dobavni rok")]
public string FirstDeliveryDateString => FirstDeliveryDate == null || (DateTime)FirstDeliveryDate == DateTime.MaxValue
? ""
: ((DateTime)FirstDeliveryDate).ToString("dd.MM.yyyy");
// ForeignKey
public CodeTableCompany Company { get; set; }
public CodeTablePartner Partner { get; set; }
// ProjectPart
[InverseProperty("Project")]
public virtual ICollection<ProjectPart> ProjectProjectPart { get; set; }
}
}

View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace EveryThing.Models.Project
{
public enum ProjectPartStatus
{
[Display(Name = "Odprto")]
Opened = 0,
[Display(Name = "V izdelavi")]
InProduction = 1,
[Display(Name = "Zaključeno")]
Finished = 2,
[Display(Name = "Odpremljeno")]
Shipped = 3
}
public class ProjectPart
{
[Key]
public int IdProjectPart { get; set; }
[Required]
[ForeignKey("Project")]
public int IdProjectFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Display(Name = "Opis")]
public string Description { get; set; }
[Required]
[Display(Name = "Status")]
public ProjectPartStatus Status { get; set; } = ProjectPartStatus.Opened;
[Display(Name = "Datum zaključka")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? FinishedDate { get; set; }
[Display(Name = "Datum odpreme")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? ShippedDate { get; set; }
[Display(Name = "Pot načrtov")]
public string PathOfPlans { get; set; }
[Required]
public int ProjectPartNumber { get; set; } = 0;
[NotMapped]
public string ProjectPartNumberFormatted => (Project != null ? Project.ProjectNumberFormatted : "") + $"-{ProjectPartNumber:D4}";
// ForeignKey
public Project Project { get; set; }
// ProjectPartItem
[InverseProperty("ProjectPart")]
public virtual ICollection<ProjectPartItem> ProjectPartProjectPartItem { get; set; }
}
}

View File

@@ -0,0 +1,164 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
using EveryThing.Models.Invoice;
namespace EveryThing.Models.Project
{
public enum ProjectPartItemStatus
{
[Display(Name = "Odprto")]
Opened = 0,
[Display(Name = "V izdelavi")]
InProduction = 1,
[Display(Name = "Zaključeno")]
Finished = 2,
[Display(Name = "Odpremljeno")]
Shipped = 3
}
public class ProjectPartItem
{
[Key]
public int IdProjectPartItem { get; set; }
[Required]
[ForeignKey("ProjectPart")]
public int IdProjectPartFk { get; set; }
[ForeignKey("Item")]
[Display(Name = "Artikel")]
public int? IdItemFk { get; set; }
[Required]
[Display(Name = "Število kosov")]
public float NumberOfItems { get; set; }
[Display(Name = "Število kompletov")]
public float NumberOfSets { get; set; }
[ForeignKey("Material")]
[Display(Name = "Material")]
public int? IdMaterialFk { get; set; }
[Display(Name = "Dimenzije surovca")]
public string MaterialDimensions { get; set; }
[Required]
[ForeignKey("MaterialSupplier")]
[Display(Name = "Dobavitelj materiala")]
public int? IdMaterialSupplierFk { get; set; }
[Display(Name = "Cena - Material")]
public float MaterialPrice { get; set; }
[Display(Name = "Cena - Delo")]
public float WorkPrice { get; set; }
[Display(Name = "Prodajna cena")]
public float SellingPrice { get; set; } = 0;
[Display(Name = "Število kosov - Zaključeno")]
public float NumberOfItemsFinished { get; set; }
[NotMapped]
[Display(Name = "Vrednost - Delo")]
public double WorkValue
{
get => Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems) * Convert.ToDouble(WorkPrice);
set => WorkPrice = Convert.ToSingle(Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems == 0
? 0
: value / (Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems))));
}
[NotMapped]
[Display(Name = "Vrednost - Delo")]
public double MaterialValue
{
get => Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems) * Convert.ToDouble(MaterialPrice);
set => MaterialPrice = Convert.ToSingle(Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems == 0
? 0
: value / (Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems))));
}
[NotMapped]
[Display(Name = "Vrednost - cena")]
public double CostPrice=> Convert.ToDouble(WorkPrice) + Convert.ToDouble(MaterialPrice);
[NotMapped]
[Display(Name = "Vrednost - strošek")]
public double CostValue => Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems) * Convert.ToDouble(CostPrice);
[NotMapped]
[Display(Name = "Prodajna vrednost")]
public double SellingValue
{
get => Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems) * Convert.ToDouble(SellingPrice);
set => SellingPrice = Convert.ToSingle(Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems == 0
? 0
: value / (Convert.ToDouble(NumberOfSets) * Convert.ToDouble(NumberOfItems))));
}
[NotMapped]
[Display(Name = "RVC")]
public double DifferenceInPrice
{
get => SellingPrice - (MaterialPrice + WorkPrice);
set => SellingPrice = Convert.ToSingle(value + (MaterialPrice + WorkPrice));
}
[NotMapped]
[Display(Name = "RVC")]
public double DifferenceInPriceValue => SellingValue - (MaterialValue + WorkValue);
[NotMapped]
[Display(Name = "RVC")]
public double DifferenceInPricePercentage =>
(Convert.ToDouble(MaterialValue) + Convert.ToDouble(WorkValue)) == 0
? 100
: ((SellingValue / (MaterialValue + WorkValue) - 1) * 100);
[Required]
[Display(Name = "Status")]
public ProjectPartItemStatus Status { get; set; } = ProjectPartItemStatus.Opened;
[Display(Name = "Datum zaključka")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? FinishedDate { get; set; }
[Display(Name = "Datum odpreme")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? ShippingDate { get; set; }
[Display(Name = "Dobavni rok")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
public DateTime? DeliveryDate { get; set; }
[Display(Name = "Spremenjeno")]
public DateTime DateModified { get; set; } = DateTime.Now;
[Required]
public int ProjectPartItemNumber { get; set; } = 0;
[NotMapped]
public string ProjectPartNumberFormatted => (ProjectPart != null ? ProjectPart.ProjectPartNumberFormatted : "") + $"-{ProjectPartItemNumber:D4}";
// ForeignKey
public ProjectPart ProjectPart { get; set; }
public CodeTablePartner MaterialSupplier { get; set; }
public CodeTableItem Item { get; set; }
public CodeTableItem Material { get; set; }
//Invoice item
[InverseProperty("ProjectPartItem")]
public virtual ICollection<InvoiceItem> InvoiceItem { get; set; }
}
}

View File

@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Transport
{
public class TransportLoadingOrder
{
[Key]
public int IdTransportLoadingOrder { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[ForeignKey("Partner")]
[Display(Name = "Prevoznik - Partner")]
[Required]
public int IdPartnerFk { get; set; }
[Required]
public int OrderNumber { get; set; }
[Required]
public int OrderYear { get; set; }
[Required]
[Display(Name = "Kraj naloga")]
public string OrderCity { get; set; }
[Required]
[Display(Name = "Datum naloga")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}")]
public DateTime OrderDate { get; set; }
[Display(Name = "Uvodno besedilo")]
public string PreText { get; set; }
[Display(Name = "Zaključno besedilo")]
public string PostText { get; set; }
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo iz šifranta")]
public int? IdVehicleFk { get; set; }
[Display(Name = "Vozilo")]
public string VehicleText { get; set; }
[Display(Name = "Znesek")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:N}")]
public float Total { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
// ForeignKey
public CodeTableCompany Company { get; set; }
public Vehicle.Vehicle Vehicle { get; set; }
public CodeTablePartner Partner { get; set; }
// TransportOrderLoadUnload
[InverseProperty("TransportLoadingOrder")]
public virtual ICollection<TransportLoadingOrderLoadUnload> TransportLoadingOrderLoadUnload { get; set; }
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Transport
{
public class TransportLoadingOrderLoadUnload
{
[Key]
public int IdTransportLoadingOrderLoadUnload { get; set; }
[Required]
[ForeignKey("TransportLoadingOrder")]
public int IdTransportLoadingOrderFk { get; set; }
// Loading data
[Display(Name = "Naklad - Partner")]
[ForeignKey("Loading")]
public int? IdLoadingFk { get; set; }
[Display(Name = "Naslov naklada")]
public string LoadingText { get; set; }
[Display(Name = "Naklad - Od")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH\\:mm}", ApplyFormatInEditMode = true)]
public DateTime? LoadingDateFrom { get; set; }
[Display(Name = "Naklad - Do")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH\\:mm}", ApplyFormatInEditMode = true)]
public DateTime? LoadingDateTo { get; set; }
[Display(Name = "Referenca naklada")]
public string LoadingReference { get; set; }
[Display(Name = "Opomba naklada")]
public string LoadingNote { get; set; }
// Unloading data
[Display(Name = "Razklad - Partner")]
[ForeignKey("Unloading")]
public int? IdUnloadingFk { get; set; }
[Display(Name = "Naslov razklada")]
public string UnloadingText { get; set; }
[Display(Name = "Razklad - Od")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH\\:mm}", ApplyFormatInEditMode = true)]
public DateTime? UnloadingDateFrom { get; set; }
[Display(Name = "Razklad - Do")]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy HH\\:mm}", ApplyFormatInEditMode = true)]
public DateTime? UnloadingDateTo { get; set; }
[Display(Name = "Referenca razklada")]
public string UnloadingReference { get; set; }
[Display(Name = "Opomba razklada")]
public string UnloadingNote { get; set; }
// Cargo
[Display(Name = "Opis tovora")]
public string CargoDescription { get; set; }
// ForeignKey
public CodeTablePartner Loading { get; set; }
public CodeTablePartner Unloading { get; set; }
public TransportLoadingOrder TransportLoadingOrder { get; set; }
}
}

View File

@@ -0,0 +1,156 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using EveryThing.Models.Transport;
using Microsoft.AspNetCore.Http;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public enum VehicleMeterType
{
[Display(Name = "Kilometri")]
Km = 0,
[Display(Name = "Milje")]
Miles = 1,
[Display(Name = "Ure")]
Hrs = 2
}
public class Vehicle
{
[Key]
public int IdVehicle { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[ForeignKey("VehicleType")]
[Display(Name = "Tip vozila")]
public int IdVehicleTypeFk { get; set; }
[ForeignKey("VehicleMake")]
[Display(Name = "Znamka")]
public int? IdMakeFk { get; set; }
[Display(Name = "Model")]
public string Model { get; set; }
[Required]
[Display(Name = "Letnik")]
public int Year { get; set; }
[Required]
[Display(Name = "Številka VIN")]
public string VinNumber { get; set; }
[Display(Name = "Številka motorja")]
public string EngineNumber { get; set; }
[ForeignKey("VehicleFuelType")]
[Display(Name = "Vrsta goriva")]
public int? IdFuelTypeFk { get; set; }
[ForeignKey("Departement")]
[Display(Name = "Oddelek")]
public int? IdDepartementFk { get; set; }
[ForeignKey("VehicleGroup")]
[Display(Name = "Skupina")]
public int? IdVehicleGroupFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
[Display(Name = "Vrsta števca")]
public VehicleMeterType VehicleMeterType { get; set; } = VehicleMeterType.Km;
[Display(Name = "Opomba")]
public string Note { get; set; }
[NotMapped]
public IFormFile Image { get; set; }
[Required]
[Display(Name = "Registrska številka")]
public string RegistrationNumber { get; set; }
//TODO: Manjkajo polja
//[Required]
//[Display(Name = "Datum veljavnosti registracije")]
//public DateTime RegistrationExpiry { get; set; }
//[ForeignKey("Partner")]
//[Display(Name = "Zavarovalnica")]
//public int IdInsurancePartnerFk { get; set; }
//[Display(Name = "Datum veljavnosti zavarovanja")]
//public DateTime? InsuranceExpiry { get; set; }
//[Display(Name = "Referenčna številka zavarovanja")]
//public string InsuranceReference { get; set; }
//[Display(Name = "Opomba zavarovanja")]
//public string InsuranceNote { get; set; }
//[Display(Name = "Datum veljavnosti tehničnega pregleda")]
//public DateTime TechnicalInspectionExpiry { get; set; }
//[Display(Name = "Referenčna tehničnega pregleda")]
//public string TechnicalInspectionReference { get; set; }
//[Display(Name = "Opomba tehničnega pregleda")]
//public string TechnicalInspectionNote { get; set; }
[Required]
[Display(Name = "Aktiven")]
public bool Active { get; set; }
// ForeignKey
public CodeTableCompany Company { get; set; }
public VehicleType VehicleType { get; set; }
public VehicleMake VehicleMake { get; set; }
public CodeTableDepartement Departement { get; set; }
public VehicleGroup VehicleGroup { get; set; }
public VehicleFuelType VehicleFuelType { get; set; }
// VehicleFueling
[InverseProperty("Vehicle")]
public virtual ICollection<VehicleFueling> VehicleVehicleFueling { get; set; }
// VehicleIncident
[InverseProperty("Vehicle")]
public virtual ICollection<VehicleIncident> VehicleVehicleIncident { get; set; }
// VehicleIssue
[InverseProperty("Vehicle")]
public virtual ICollection<VehicleIssue> VehicleVehicleIssue { get; set; }
// Note
[InverseProperty("Vehicle")]
public virtual ICollection<GeneralNote> VehicleNote { get; set; }
// VehicleDriver
[InverseProperty("Vehicle")]
public virtual ICollection<VehicleDriver> VehicleVehicleDriver { get; set; }
// VehicleMeterReading
[InverseProperty("Vehicle")]
public virtual ICollection<VehicleMeterReading> VehicleVehicleMeterReading { get; set; }
// VehicleDrive
[InverseProperty("Vehicle")]
public virtual ICollection<VehicleDrive> VehicleVehicleDrive { get; set; }
// VehicleTransportLoadingOrder
[InverseProperty("Vehicle")]
public virtual ICollection<TransportLoadingOrder> VehicleTransportLoadingOrder { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleBreakdown
{
[Key]
public int IdVehicleBreakdown { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int IdVehicleFk { get; set; }
[Required(ErrorMessage = "Polje datum okvare je obvezno")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum okvare")]
public DateTime DateBreakdown { get; set; }
[Display(Name = "Referenčna številka")]
public string Reference { get; set; }
[Display(Name = "Število kilometrov")]
public int Meter { get; set; }
[Display(Name = "Opis")]
public string Description { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public CodeTableEmployee Employee { get; set; }
public CodeTableCompany Company { get; set; }
}
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleDrive
{
[Key]
public int IdVehicleDrive { get; set; }
[Required]
[ForeignKey("Employee")]
[Display(Name = "Voznik")]
public int IdEmployeeFk { get; set; }
[Required]
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int IdVehicleFk { get; set; }
[Required(ErrorMessage = "Polje datum začetka je obvezno")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum začetka")]
public DateTime DateStart { get; set; }
[Required(ErrorMessage = "Polje datum konca je obvezno")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum začetka")]
public DateTime DateEnd { get; set; }
[Required]
[Display(Name = "Začetek")]
public int MileageStart { get; set; }
[Required]
[Display(Name = "Konec")]
public int MileageEnd { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public CodeTableEmployee Employee { get; set; }
public Vehicle Vehicle { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleDriver
{
[Key]
public int IdVehicleDriver { get; set; }
[Required]
[ForeignKey("Employee")]
[Display(Name = "Voznik")]
public int IdEmployeeFk { get; set; }
[Required]
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int IdVehicleFk { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public CodeTableEmployee Employee { get; set; }
public Vehicle Vehicle { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleFuelType
{
[Key]
public int IdVehicleFuelType { get; set; }
[ForeignKey("Company")]
public int? IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Vehicle
[InverseProperty("VehicleFuelType")]
public virtual ICollection<Vehicle> VehicleFuelTypeVehicle { get; set; }
//VehicleFueling
[InverseProperty("VehicleFuelType")]
public virtual ICollection<VehicleFueling> VehicleFuelTypeVehicleFueling { get; set; }
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleFueling
{
[Key]
public int IdVehicleFueling { get; set; }
[Required]
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int IdVehicleFk { get; set; }
[Required]
[ForeignKey("Employee")]
[Display(Name = "Voznik")]
public int IdEmployeeFk { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum polnjenja")]
public DateTime DateOfFueling { get; set; }
[ForeignKey("VehicleFuelingCard")]
[Display(Name = "Kartica")]
public int? IdVehicleFuelingCardFk { get; set; }
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum računa")]
public DateTime? FuelingCardInvoiceDate { get; set; }
[Display(Name = "Številka računa")]
public string FuelingCardInvoiceNumber { get; set; }
[Required]
[ForeignKey("VehicleFuelType")]
[Display(Name = "Tip goriva")]
public int IdVehicleFuelTypeFk { get; set; }
[Required]
[Display(Name = "Količina [l]")]
public double Quantity { get; set; }
[Required]
[Display(Name = "Staje števca [km]")]
public int Mileage { get; set; }
[Required]
[Display(Name = "Polno točenje")]
public bool FullTank { get; set; }
[Required]
[Display(Name = "Znesek")]
public double Amount { get; set; } //TODO: Unit cost; Total cost
[ForeignKey("Country")]
[Display(Name = "Država")]
public int IdCountryFk { get; set; }
[Display(Name = "Mesto")]
public string City { get; set; }
[Display(Name = "Referenca")]
public string Reference { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public Vehicle Vehicle { get; set; }
public CodeTableEmployee Employee { get; set; }
public CodeTableCountry Country { get; set; }
public VehicleFuelingCard VehicleFuelingCard { get; set; }
public VehicleFuelType VehicleFuelType { get; set; }
//TODO: Fuel source (bencingka, n/a, zaloga)
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleFuelingCard
{
[Key]
public int IdFuelingCard { get; set; }
[Required]
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum veljavnosti")]
public DateTime DateOfExpiry { get; set; }
[Required]
[Display(Name = "Številka kartice")]
public string CardNumber { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//VehicleFueling
[InverseProperty("VehicleFuelingCard")]
public virtual ICollection<VehicleFueling> VehicleFuelingCardVehicleFueling { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleGroup
{
[Key]
public int IdVehicleGroup { get; set; }
[ForeignKey("Company")]
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Vehicle
[InverseProperty("VehicleGroup")]
public virtual ICollection<Vehicle> VehicleGroupVehicle { get; set; }
}
}

View File

@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleIncident
{
[Key]
public int IdVehicleIncident { get; set; }
[Required]
[ForeignKey("Employee")]
[Display(Name = "Voznik")]
public int IdEmployeeFk { get; set; }
[Required]
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int IdVehicleFk { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum")]
public DateTime Date { get; set; }
[Display(Name = "Referenčna številka")]
public string Reference { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public CodeTableEmployee Employee { get; set; }
public Vehicle Vehicle { get; set; }
}
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public enum VehicleIssuePriority
{
[Display(Name = "(1) Zelo nizko")]
VeryLow = 0,
[Display(Name = "(2) Nizko")]
Low = 1,
[Display(Name = "(3) Normalno")]
Normal = 2,
[Display(Name = "(4) Urgentno")]
Urgent = 3,
[Display(Name = "(5) Kritično")]
Critical = 4
}
public enum VehicleIssueStatus
{
[Display(Name = "Na čakanju")]
Pending = 0,
[Display(Name = "V teku")]
Processing = 1,
[Display(Name = "Urejeno")]
Fixed = 2
}
public class VehicleIssue
{
[Key]
public int IdVehicleIssue { get; set; }
[Required(ErrorMessage = "Izbira prioritete je obvezna")]
[Display(Name = "Prioriteta")]
public VehicleIssuePriority Priority { get; set; }
[Required(ErrorMessage = "Izbira stanja je obvezna")]
[Display(Name = "Status")]
public VehicleIssueStatus Status { get; set; }
[ForeignKey("Employee")]
[Display(Name = "Prijavil")]
public int? IdEmployeeFk { get; set; }
[Required]
[ForeignKey("Vehicle")]
[Display(Name = "Vozilo")]
public int IdVehicleFk { get; set; }
[Required(ErrorMessage = "Polje datum prijave je obvezno")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum prijave")]
public DateTime DateReported { get; set; }
[Display(Name = "Opis")]
public string Description { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public CodeTableEmployee Employee { get; set; }
public Vehicle Vehicle { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleMake
{
[Key]
public int IdVehicleMake { get; set; }
[ForeignKey("Company")]
public int? IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Vehicle
[InverseProperty("VehicleMake")]
public virtual ICollection<Vehicle> VehicleMakeVehicle { get; set; }
}
}

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
namespace EveryThing.Models.Vehicle
{
public class VehicleMeterReading
{
[Key]
public int IdVehicle { get; set; }
[Required]
[ForeignKey("Vehicle")]
public int IdVehicleFk { get; set; }
[Required]
[ForeignKey("Kilometrov")]
public int Mileage { get; set; }
[Display(Name = "Ustvarjeno")]
public string CreatedBy { get; set; }
[Required(ErrorMessage = "Polje datum vnosa je obvezno")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Datum vnosa")]
public DateTime DateAdded { get; set; }
[Display(Name = "Opomba")]
public string Note { get; set; }
//ForeignKey
public Vehicle Vehicle { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models.CodeTable;
namespace EveryThing.Models.Vehicle
{
public class VehicleType
{
[Key]
public int IdVehicleType { get; set; }
[ForeignKey("Company")]
public int? IdCompanyFk { get; set; }
[Required]
[Display(Name = "Naziv")]
public string Title { get; set; }
[Required]
public bool Active { get; set; }
//ForeignKey
public CodeTableCompany Company { get; set; }
//Vehicle
[InverseProperty("VehicleType")]
public virtual ICollection<Vehicle> VehicleTypeVehicle { get; set; }
}
}

12
EveryThing/Notes.txt Normal file
View File

@@ -0,0 +1,12 @@
/// logging model error
private readonly ILogger<CreateModel> _logger;
_logger.LogInformation("DODAJAM");
foreach (var modelState in ModelState.Values)
{
foreach (var error in modelState.Errors)
{
_logger.LogInformation(error.ErrorMessage);
}
}

View File

@@ -0,0 +1,125 @@
@page
@model EveryThing.Pages.AdministrationCompanies.CreateModel
@{
ViewData["Title"] = "Vnos podjetja";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<form method="post">
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Podjetja /</span> Novo
</span>
</h4>
<div class="row">
<div class="col-6">
<div class="card">
<h6 class="card-header">
Podatki podjetja
</h6>
<div class="card-body">
<div class="form-group">
<label asp-for="Company.Title" class="form-label"></label>
<input asp-for="Company.Title" class="form-control" />
<span asp-validation-for="Company.Title" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.ShortTitle" class="form-label"></label>
<input asp-for="Company.ShortTitle" class="form-control" />
<span asp-validation-for="Company.ShortTitle" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.IdCountryFk" class="form-label"></label>
<select asp-for="Company.IdCountryFk" class="form-control" asp-items="ViewBag.IdCountryFk"></select>
</div>
<div class="form-group">
<label asp-for="Company.City" class="form-label"></label>
<input asp-for="Company.City" class="form-control" />
<span asp-validation-for="Company.City" class="text-danger"></span>
</div>
<div class="row">
<div class="col-8">
<div class="form-group">
<label asp-for="Company.Street" class="form-label"></label>
<input asp-for="Company.Street" class="form-control" />
<span asp-validation-for="Company.Street" class="text-danger"></span>
</div>
</div>
<div class="col-4">
<div class="form-group">
<label asp-for="Company.HouseNumber" class="form-label"></label>
<input asp-for="Company.HouseNumber" class="form-control" />
<span asp-validation-for="Company.HouseNumber" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Company.Post" class="form-label"></label>
<input asp-for="Company.Post" class="form-control" />
<span asp-validation-for="Company.Post" class="text-danger"></span>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Company.TaxNumber" class="form-label"></label>
<input asp-for="Company.TaxNumber" class="form-control" />
<span asp-validation-for="Company.TaxNumber" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Company.RegistrationNumber" class="form-label"></label>
<input asp-for="Company.RegistrationNumber" class="form-control" />
<span asp-validation-for="Company.RegistrationNumber" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Company.Email" class="form-label"></label>
<input asp-for="Company.Email" class="form-control" />
<span asp-validation-for="Company.Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.Bank" class="form-label"></label>
<input asp-for="Company.Bank" class="form-control" />
<span asp-validation-for="Company.Bank" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.Iban" class="form-label"></label>
<input asp-for="Company.Iban" class="form-control" />
<span asp-validation-for="Company.Iban" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.SwiftBic" class="form-label"></label>
<input asp-for="Company.SwiftBic" class="form-control" />
<span asp-validation-for="Company.SwiftBic" class="text-danger"></span>
</div>
<div class="form-group mb-0">
<label asp-for="Company.Ceo" class="form-label"></label>
<input asp-for="Company.Ceo" class="form-control" />
<span asp-validation-for="Company.Ceo" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.LogoFileName" class="form-label"></label>
<input asp-for="Company.LogoFileName" class="form-control" />
<span asp-validation-for="Company.LogoFileName" class="text-danger"></span>
</div>
</div>
<div class="card-footer py-3 text-right">
<button type="submit" class="btn btn-primary">Dodaj podjetje</button>
<a asp-page="Index" class="btn btn-default">Prekliči</a>
</div>
</div>
</div>
</div>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using EveryThing.Data;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.Logging;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.AdministrationCompanies
{
[Authorize(Roles = "Administrator")]
public class CreateModel : PageModel
{
private readonly ApplicationDbContext _context;
public CreateModel(ApplicationDbContext context)
{
_context = context;
}
[BindProperty]
public CodeTableCompany Company { get; set; }
public IActionResult OnGet()
{
ViewData["IdCountryFk"] = new SelectList(_context.CodeTableCountries, "IdCountry", "Title");
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
ViewData["IdCountryFk"] = new SelectList(_context.CodeTableCountries, "IdCountry", "Title");
return Page();
}
Company.Active = true;
_context.CodeTableCompanies.Add(Company);
await _context.SaveChangesAsync();
return RedirectToPage("./Index");
}
}
}

View File

@@ -0,0 +1,168 @@
@page
@model EveryThing.Pages.AdministrationCompanies.EditModel
@{
ViewData["Title"] = "Urejanje podjetja";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<form method="post">
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Podjetja /</span> Urejanje
</span>
</h4>
<div class="row">
<div class="col-6">
<div class="card">
<h6 class="card-header">
Podatki podjetja
</h6>
<div class="card-body">
<input type="hidden" asp-for="Company.IdCompany" />
<div class="form-group">
<label asp-for="Company.Title" class="form-label"></label>
<input asp-for="Company.Title" class="form-control" />
<span asp-validation-for="Company.Title" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.ShortTitle" class="form-label"></label>
<input asp-for="Company.ShortTitle" class="form-control" />
<span asp-validation-for="Company.ShortTitle" class="text-danger"></span>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Company.IdCountryFk" class="form-label"></label>
<select asp-for="Company.IdCountryFk" class="form-control" asp-items="ViewBag.IdCountryFk"></select>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Company.City" class="form-label"></label>
<input asp-for="Company.City" class="form-control" />
<span asp-validation-for="Company.City" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Company.Street" class="form-label"></label>
<input asp-for="Company.Street" class="form-control" />
<span asp-validation-for="Company.Street" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Company.HouseNumber" class="form-label"></label>
<input asp-for="Company.HouseNumber" class="form-control" />
<span asp-validation-for="Company.HouseNumber" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Company.PostNumber" class="form-label"></label>
<input asp-for="Company.PostNumber" class="form-control" />
<span asp-validation-for="Company.PostNumber" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Company.Post" class="form-label"></label>
<input asp-for="Company.Post" class="form-control" />
<span asp-validation-for="Company.Post" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Company.TaxNumber" class="form-label"></label>
<input asp-for="Company.TaxNumber" class="form-control" />
<span asp-validation-for="Company.TaxNumber" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Company.RegistrationNumber" class="form-label"></label>
<input asp-for="Company.RegistrationNumber" class="form-control" />
<span asp-validation-for="Company.RegistrationNumber" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Company.Email" class="form-label"></label>
<input asp-for="Company.Email" class="form-control" />
<span asp-validation-for="Company.Email" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.Ceo" class="form-label"></label>
<input asp-for="Company.Ceo" class="form-control" />
<span asp-validation-for="Company.Ceo" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.SwiftBic" class="form-label"></label>
<input asp-for="Company.SwiftBic" class="form-control" />
<span asp-validation-for="Company.SwiftBic" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.Iban" class="form-label"></label>
<input asp-for="Company.Iban" class="form-control" />
<span asp-validation-for="Company.Iban" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.Bank" class="form-label"></label>
<input asp-for="Company.Bank" class="form-control" />
<span asp-validation-for="Company.Bank" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.Phone" class="form-label"></label>
<input asp-for="Company.Phone" class="form-control" />
<span asp-validation-for="Company.Phone" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Company.LogoFileName" class="form-label"></label>
<input asp-for="Company.LogoFileName" class="form-control" />
<span asp-validation-for="Company.LogoFileName" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="Company.Active" /> @Html.DisplayNameFor(model => model.Company.Active)
</label>
</div>
</div>
<div class="card-footer py-3 text-right">
<button type="submit" class="btn btn-primary">Shrani</button>
<a asp-page="Index" class="btn btn-default">Prekliči</a>
</div>
</div>
</div>
<div class="col-6">
<div class="card">
<h6 class="card-header">
Uporabniki podjetja
</h6>
<partial name="AdministrationUsers/IndexFrame" model="Model.User" />
<div class="card-footer py-3 text-right">
<a asp-page="/AdministrationUsers/Create" asp-route-idCompany="@Model.Company.IdCompany" class="btn btn-primary">Vnos uporabnika</a>
</div>
</div>
</div>
</div>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script>
$('[data-toggle="tooltip"]').tooltip({container: 'table'});
</script>
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.AdministrationCompanies
{
[Authorize(Roles = "Administrator")]
public class EditModel : PageModel
{
private readonly ApplicationDbContext _context;
private readonly UserManager<IdentityApplicationUser> _userManager;
public EditModel(ApplicationDbContext context, UserManager<IdentityApplicationUser> userManager)
{
_context = context;
_userManager = userManager;
}
[BindProperty]
public CodeTableCompany Company { get; set; }
public new IList<IdentityApplicationUser> User { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Company = await _context.CodeTableCompanies.Include(c => c.Country).FirstOrDefaultAsync(m => m.IdCompany == id);
User = await _userManager.Users.Include(x => x.Company).Where(x => x.IdCompanyFk == id).ToListAsync();
ViewData["IdCompany"] = id;
if (Company == null)
{
return NotFound();
}
ViewData["IdCountryFk"] = new SelectList(_context.CodeTableCountries, "IdCountry", "TranslationSlovenian");
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
_context.Attach(Company).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!CompanyExists(Company.IdCompany))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToPage("./Index");
}
private bool CompanyExists(int id)
{
return _context.CodeTableCompanies.Any(e => e.IdCompany == id);
}
}
}

View File

@@ -0,0 +1,108 @@
@page
@model EveryThing.Pages.AdministrationCompanies.IndexModel
@{
ViewData["Title"] = "Podjetja";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Podjetja /</span> Pregled
</span>
</h4>
<div class="row">
<div class="col-12 mb-2 text-right">
<form method="get">
<div class="btn-group">
<input class="form-control" type="text" name="searchString" value="@ViewData["SearchString"]" placeholder="Iskanje..." autocomplete="off">
<button type="submit" class="btn btn-secondary" aria-label="Osveži" title="Osveži">
<i class="opacity-75 ion ion-md-refresh"></i>
</button>
<div class="btn-group" title="Columns">
<button class="btn btn-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-label="Nastavitve" title="Nastavitve">
<i class="opacity-75 ion ion-md-apps"></i>
<span class="caret"></span>
</button>
<div class="dropdown-menu dropdown-menu-right">
<label class="dropdown-item">
<input type="checkbox" name="inactiveCompanies" @ViewData["InactiveCompanies"]> <span>Neaktivna podjetja</span>
</label>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<h6 class="card-header">
Seznam podjetij
</h6>
<table class="table card-table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Company[0].Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].City)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].Street)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].Post)
</th>
<th style="width: 140px;">
@Html.DisplayNameFor(model => model.Company[0].TaxNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].Email)
</th>
<th style="width: 80px;"></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Company)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
@if (!item.Active) {<span class='badge badge-danger'>Neaktivno</span>}
</td>
<td>
@Html.DisplayFor(modelItem => item.City)
</td>
<td>
@Html.DisplayFor(modelItem => item.Street) @Html.DisplayFor(modelItem => item.HouseNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.PostNumber) @Html.DisplayFor(modelItem => item.Post)
</td>
<td>
@Html.DisplayFor(modelItem => item.RegistrationNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td class="text-right">
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="Edit" asp-route-id="@item.IdCompany" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
}
</tbody>
</table>
<div class="card-footer py-3 text-right">
<a asp-page="Create" class="btn btn-primary">Vnos podjetja</a>
</div>
</div>
@section Scripts {
<script>
$('[data-toggle="tooltip"]').tooltip({container: 'table'});
</script>
}

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.AdministrationCompanies
{
[Authorize(Roles = "Administrator")]
public class IndexModel : PageModel
{
private readonly ApplicationDbContext _context;
public IndexModel(ApplicationDbContext context)
{
_context = context;
}
public IList<CodeTableCompany> Company { get;set; }
public async Task OnGetAsync(string searchString, string inactiveCompanies)
{
ViewData["SearchString"] = searchString;
ViewData["InactiveCompanies"] = inactiveCompanies == "on" ? "checked" : "";
Company = await _context.CodeTableCompanies
.Include(c => c.Country).ToListAsync();
// Active companies
if (string.IsNullOrEmpty(inactiveCompanies) || inactiveCompanies != "on")
{
Company = Company.Where(s => s.Active).ToList();
}
// Search string
if (!string.IsNullOrEmpty(searchString))
{
Company = Company.Where(s => s.ShortTitle.Contains(searchString) || s.Title.Contains(searchString)).ToList();
}
}
}
}

View File

@@ -0,0 +1,6 @@
@page
@model EveryThing.Pages.AdministrationCompanies.SetupModel
@{
ViewData["Title"] = "Odjava";
Layout = "~/Pages/Layouts/_LayoutBlank.cshtml";
}

View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace EveryThing.Pages.AdministrationCompanies
{
[Authorize(Roles = "Administrator")]
public class SetupModel : PageModel
{
private readonly UserManager<IdentityApplicationUser> _userManager;
private readonly SignInManager<IdentityApplicationUser> _signInManager;
private readonly RoleManager<IdentityApplicationRole> _roleManager;
private readonly ILogger<SetupModel> _logger;
public SetupModel(UserManager<IdentityApplicationUser> userManager, SignInManager<IdentityApplicationUser> signInManager, ILogger<SetupModel> logger, RoleManager<IdentityApplicationRole> roleManager)
{
_userManager = userManager;
_signInManager = signInManager;
_logger = logger;
_roleManager = roleManager;
}
public async Task<IActionResult> OnGetAsync()
{
//TODO osnovno podjetje?
var rolesDefinitions = new List<(string RoleName, string RoleDescription)>
{
("TransportThingUser", "TransporThing uporabniki"),
("ProjecThingUser", "ProjecThing uporabniki"),
("InvoicingUser", "Fakturiranje uporabniki"),
("Administrator", "Administratorji"),
};
foreach (var roleDefinition in rolesDefinitions)
{
if (!_roleManager.RoleExistsAsync(roleDefinition.RoleName).Result)
{
var role = new IdentityApplicationRole
{
Name = roleDefinition.RoleName,
Description = roleDefinition.RoleDescription
};
_roleManager.CreateAsync(role).Wait();
}
}
if (_userManager.FindByNameAsync("admin") == null)
{
IdentityApplicationUser identityApplicationUser = new IdentityApplicationUser
{
Name = "Master",
Surname = "Admin",
UserName = "admin",
NormalizedUserName = "admin",
Email = "admin@domain.com",
NormalizedEmail = "admin@domain.com",
EmailConfirmed = true,
DateCreated = DateTime.Now,
DateValidUntil = DateTime.MaxValue,
PhoneNumber = "123456789",
PhoneNumberConfirmed = true,
Active = true,
IdCompanyFk = 1
};
var result = await _userManager.CreateAsync(identityApplicationUser, "Master#Admin22!");
if (result.Succeeded)
{
_userManager.AddToRoleAsync(identityApplicationUser, "Administrator").Wait();
//return RedirectToPage("/Administration/Users/Index");
}
else
{
//ModelState.AddModelError("", string.Join(",", identityResult.Errors.Select(x => x.Description)));
}
}
return RedirectToPage("/User/Login");
}
//public async Task<IActionResult> OnPostAsync(string returnUrl = null)
//{
// var user = await _userManager.GetUserAsync(User);
// await _signInManager.SignOutAsync();
// _logger.LogInformation($"Logout: {user.Name} {user.Surname} - {user.Company.Title}");
// if (returnUrl != null)
// {
// return LocalRedirect(returnUrl);
// }
// return RedirectToPage();
//}
}
}

View File

@@ -0,0 +1,93 @@
@page
@model EveryThing.Pages.AdministrationUsers.CreateModel
@{
ViewData["Title"] = "Vnos uporabnika";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<form method="post">
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Uporabniki /</span> Nov
</span>
</h4>
<div class="row">
<div class="col-6">
<div class="card">
<h6 class="card-header">
Podatki uporabnika
</h6>
<div class="card-body">
<input type="hidden" asp-for="Input.IdCompanyFk" />
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Input.Name" class="form-label"></label>
<input asp-for="Input.Name" class="form-control" />
<span asp-validation-for="Input.Name" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Input.LastName" class="form-label"></label>
<input asp-for="Input.LastName" class="form-control" />
<span asp-validation-for="Input.LastName" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Input.UserName" class="form-label"></label>
<input asp-for="Input.UserName" class="form-control" />
<span asp-validation-for="Input.UserName" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Input.Password" class="form-label"></label>
<input asp-for="Input.Password" type="password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
<div class="form-group">
<label asp-for="Input.Email" class="form-label"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
</div>
<div class="col-4">
<div class="form-group">
<label asp-for="Input.Phone" class="form-label"></label>
<input asp-for="Input.Phone" class="form-control" />
<span asp-validation-for="Input.Phone" class="text-danger"></span>
</div>
</div>
<div class="col-4">
<div class="form-group">
<label asp-for="Input.DateValidUntil" class="form-label"></label>
<input asp-for="Input.DateValidUntil" class="form-control" />
<span asp-validation-for="Input.DateValidUntil" class="text-danger"></span>
</div>
</div>
</div>
</div>
<div class="card-footer py-3 text-right">
<button type="submit" class="btn btn-primary">Dodaj uporabnika</button>
<a asp-page="/AdministrationCompanies/Edit" asp-route-id="@ViewBag.IdCompany" class="btn btn-default">Prekliči</a>
</div>
</div>
</div>
</div>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Data;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace EveryThing.Pages.AdministrationUsers
{
[Authorize(Roles = "Administrator")]
public class CreateModel : PageModel
{
private readonly ApplicationDbContext _context;
private readonly UserManager<IdentityApplicationUser> _userManager;
private readonly SignInManager<IdentityApplicationUser> _loginManager;
private readonly RoleManager<IdentityApplicationRole> _roleManager;
public CreateModel(ApplicationDbContext context, UserManager<IdentityApplicationUser> userManager, SignInManager<IdentityApplicationUser> loginManager, RoleManager<IdentityApplicationRole> roleManager)
{
_context = context;
_userManager = userManager;
_loginManager = loginManager;
_roleManager = roleManager;
}
[BindProperty]
public InputModel Input { get; set; }
public IActionResult OnGet(int idCompany)
{
ViewData["IdCompanyFk"] = new SelectList(_context.CodeTableCompanies, "IdCompany", "Title");
ViewData["IdCompany"] = idCompany;
Input = new InputModel()
{
IdCompanyFk = idCompany
};
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
if (ModelState.IsValid)
{
IdentityApplicationUser identityApplicationUser = new IdentityApplicationUser
{
Name = Input.Name,
Surname = Input.LastName,
UserName = Input.UserName,
NormalizedUserName = Input.UserName.ToLower(),
Email = Input.Email,
NormalizedEmail = Input.Email.ToLower(),
EmailConfirmed = true,
DateCreated = DateTime.Now,
DateValidUntil = Input.DateValidUntil,
PhoneNumber = Input.Phone,
PhoneNumberConfirmed = true,
Active = true,
IdCompanyFk = Input.IdCompanyFk
};
IdentityResult identityResult = await _userManager.CreateAsync(identityApplicationUser, Input.Password);
if (identityResult.Succeeded)
{
//await _userManager.AddToRoleAsync(identityApplicationUser, "NormalUser");
return RedirectToPage("/AdministrationUsers/Edit", new { idCompany = identityApplicationUser.IdCompanyFk, idUser = identityApplicationUser.Id });
//return RedirectToPage("/Administration/Users/Index");
}
else
{
ModelState.AddModelError("", string.Join(",", identityResult.Errors.Select(x => x.Description)));
}
ViewData["IdCompanyFk"] = new SelectList(_context.CodeTableCompanies, "IdCompany", "Title");
}
return Page();
}
public class InputModel
{
public int IdCompanyFk { get; set; }
[Required]
[Display(Name = "Ime")]
public string Name { get; set; }
[Required]
[Display(Name = "Priimek")]
public string LastName { get; set; }
[Required]
[Display(Name = "Uporabniško ime")]
public string UserName { get; set; }
[Required]
[DataType(DataType.Password)]
[Display(Name = "Geslo")]
public string Password { get; set; }
[Required]
[Display(Name = "E-pošta")]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[Display(Name = "Telefon")]
public string Phone { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Veljavnost uporabnika do")]
public DateTime DateValidUntil { get; set; }
}
}
}

View File

@@ -0,0 +1,124 @@
@page
@model EveryThing.Pages.AdministrationUsers.EditModel
@{
ViewData["Title"] = "Urejanje uporabnika";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Uporabniki /</span> Urejanje
</span>
</h4>
<form method="post">
<div class="row">
<div class="col-6">
<div class="card">
<h6 class="card-header">
Podatki uporabnika
</h6>
<div class="card-body">
@*<input type="hidden" asp-for="Input.UserName" />*@
<input type="hidden" asp-for="Input.IdUser" />
<input type="hidden" asp-for="Input.Active" />
<div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Input.Name" class="form-label"></label>
<input asp-for="Input.Name" class="form-control" />
<span asp-validation-for="Input.Name" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Input.LastName" class="form-label"></label>
<input asp-for="Input.LastName" class="form-control" />
<span asp-validation-for="Input.LastName" class="text-danger"></span>
</div>
</div>
</div>
@* <div class="row">
<div class="col-6">
<div class="form-group">
<label asp-for="Input.UserName" class="form-label"></label>
<input asp-for="Input.UserName" class="form-control" />
<span asp-validation-for="Input.UserName" class="text-danger"></span>
</div>
</div>
<div class="col-6">
<div class="form-group">
<label asp-for="Input.Password" class="form-label"></label>
<input asp-for="Input.Password" type="password" class="form-control" />
<span asp-validation-for="Input.Password" class="text-danger"></span>
</div>
</div>
</div>*@
<div class="row">
<div class="col-4">
<div class="form-group">
<label asp-for="Input.Email" class="form-label"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
</div>
<div class="col-4">
<div class="form-group">
<label asp-for="Input.Phone" class="form-label"></label>
<input asp-for="Input.Phone" class="form-control" />
<span asp-validation-for="Input.Phone" class="text-danger"></span>
</div>
</div>
<div class="col-4">
<div class="form-group">
<label asp-for="Input.DateValidUntil" class="form-label"></label>
@Html.TextBoxFor(m => m.Input.DateValidUntil, "{0:yyyy-MM-dd}", new { @class = "form-control", type = "date" })
<span asp-validation-for="Input.DateValidUntil" class="text-danger"></span>
</div>
</div>
</div>
<hr/>
<h5>Pravice</h5>
<div class="row">
<div class="col-12">
<table class="table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Roles[0].RoleDescription)
</th>
<th>
@Html.DisplayNameFor(model => model.Roles[0].InRole)
</th>
</tr>
</thead>
<tbody>
@for (int i = 0; i < Model.Roles.Count; i++)
{
<tr>
<td>
@Html.DisplayFor(x => Model.Roles[i].RoleDescription)
@Html.HiddenFor(x => Model.Roles[i].RoleName)
</td>
<td>
@Html.CheckBoxFor(x => Model.Roles[i].InRole)
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
</div>
<div class="card-footer py-3 text-right">
<button type="submit" class="btn btn-primary">Shrani</button>
<a asp-page="/AdministrationCompanies/Edit" asp-route-id="@ViewBag.IdCompany" class="btn btn-default">Prekliči</a>
</div>
</div>
</div>
</div>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
</form>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -0,0 +1,218 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Data;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
namespace EveryThing.Pages.AdministrationUsers
{
[Authorize(Roles = "Administrator")]
public class EditModel : PageModel
{
private readonly ApplicationDbContext _context;
private readonly UserManager<IdentityApplicationUser> _userManager;
private readonly SignInManager<IdentityApplicationUser> _loginManager;
private readonly RoleManager<IdentityApplicationRole> _roleManager;
public EditModel(ApplicationDbContext context, UserManager<IdentityApplicationUser> userManager, SignInManager<IdentityApplicationUser> loginManager, RoleManager<IdentityApplicationRole> roleManager)
{
_context = context;
_userManager = userManager;
_loginManager = loginManager;
_roleManager = roleManager;
}
[BindProperty]
public InputModel Input { get; set; }
[BindProperty]
public List<InputRole> Roles { get; set; }
public async Task<IActionResult> OnGetAsync(int? idCompany, int? idUser)
{
if (idUser == null || idCompany == null)
{
return NotFound();
}
var user = await _userManager.Users.FirstAsync(x => x.IdCompanyFk == idCompany && x.Id == idUser);
if (user == null)
{
return NotFound();
}
var userRoles = await _userManager.GetRolesAsync(user);
ViewData["IdCompany"] = user.IdCompanyFk;
Input = new()
{
//UserName = user.UserName,
Name = user.Name,
LastName = user.Surname,
Email = user.Email,
Phone = user.PhoneNumber,
DateValidUntil = user.DateValidUntil,
Active = user.Active,
IdUser = user.Id
};
Roles = _roleManager.Roles.Select(x => new InputRole
{
RoleName = x.Name,
RoleDescription = x.Description,
InRole = userRoles.Contains(x.Name)
}).ToList();
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
var user = await _userManager.FindByIdAsync(Input.IdUser.ToString());
if (user == null)
{
ModelState.AddModelError("", "Napaka uporabnika");
return Page();
}
user.Name = Input.Name;
user.Surname = Input.LastName;
user.Email = Input.Email;
user.NormalizedEmail = Input.Email.ToUpper();
user.PhoneNumber = Input.Phone;
user.DateValidUntil = Input.DateValidUntil;
user.Active = Input.Active;
var result = await _userManager.UpdateAsync(user);
var userRoles = await _userManager.GetRolesAsync(user);
if (!result.Succeeded)
{
ModelState.AddModelError("", "Napaka uporabnika");
return Page();
}
foreach (var role in Roles)
{
if (role.InRole)
{
//Dodam ce se ni
if (!userRoles.Contains(role.RoleName))
await _userManager.AddToRoleAsync(user, role.RoleName);
}
else
{
//Ce je v roli ga odstranim
if (userRoles.Contains(role.RoleName))
await _userManager.RemoveFromRoleAsync(user, role.RoleName);
}
}
//if (!string.IsNullOrEmpty(Input.Password))
//{
// var token = await _userManager.GeneratePasswordResetTokenAsync(user);
// result = await _userManager.ResetPasswordAsync(user, token, Input.Password);
// if (!result.Succeeded)
// {
// ModelState.AddModelError("", "Napaka shranjevanje novega gesla");
// }
//}
return RedirectToPage("/AdministrationCompanies/Edit", new { id = user.IdCompanyFk});
//if (identityResult.Succeeded)
//{
// if (!_roleManager.RoleExistsAsync("NormalUser").Result)
// {
// IdentityApplicationRole normalUserRole = new IdentityApplicationRole
// {
// Name = "NormalUser",
// Description = "Splo<6C>ni uporabniki"
// };
// await _roleManager.CreateAsync(normalUserRole);
// }
// await _userManager.AddToRoleAsync(identityApplicationUser, "NormalUser");
// return RedirectToPage("/Administration/Users/Index");
//}
//else
//{
// ModelState.AddModelError("", string.Join(",", identityResult.Errors.Select(x => x.Description)));
//}
//ViewData["IdCompanyFk"] = new SelectList(_context.Companies, "IdCompany", "Title");
//await _userService.UpdateDisplayName(User, Input.DisplayName);
//return RedirectToPage("/User/Login");
}
public class InputModel
{
[Required]
public int IdUser { get; set; }
[Required]
[Display(Name = "Ime")]
public string Name { get; set; }
[Required]
[Display(Name = "Priimek")]
public string LastName { get; set; }
//[Required]
//[Display(Name = "Uporabniško ime")]
//public string UserName { get; set; }
//[Required]
//[DataType(DataType.Password)]
//[Display(Name = "Geslo")]
//public string Password { get; set; }
[Required]
[Display(Name = "E-pošta")]
[DataType(DataType.EmailAddress)]
public string Email { get; set; }
[Display(Name = "Telefon")]
public string Phone { get; set; }
[Required]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd.MM.yyyy}", ApplyFormatInEditMode = true)]
[Display(Name = "Veljavnost uporabnika do")]
public DateTime DateValidUntil { get; set; }
[Required]
[Display(Name = "Aktiven")]
public bool Active { get; set; }
}
public class InputRole
{
public string RoleName { get; set; }
[Display(Name = "Pravica")]
public string RoleDescription{ get; set; }
[Display(Name = "Omogoči")]
public bool InRole { get; set; }
}
}
}

View File

@@ -0,0 +1,76 @@
@page
@model EveryThing.Pages.AdministrationUsers.IndexModel
@{
ViewData["Title"] = "Index";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<div class="card">
<div class="card-header">
<h5 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-0 mb-0">
Pregled podjetij
<a asp-page="Create" class="btn btn-sm btn-primary"><span class="ion ion-md-add"></span>&nbsp; Vnos novega podjetja</a>
</h5>
</div>
test
@*<table class="table card-table">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.Company[0].Title)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].City)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].Street)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].Post)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].TaxNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.Company[0].Email)
</th>
<th style="width: 80px;"></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Company)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.City)
</td>
<td>
@Html.DisplayFor(modelItem => item.Street) @Html.DisplayFor(modelItem => item.HouseNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.PostNumber) @Html.DisplayFor(modelItem => item.Post)
</td>
<td>
@Html.DisplayFor(modelItem => item.RegistrationNumber)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
<a class="btn btn-xs icon-btn btn-outline-primary borderless" asp-page="./Details" asp-route-id="@item.IdCompany" data-toggle="tooltip" data-placement="top" title="Podrobnosti" data-state="primary"><i class="fas fa-info"></i></a>
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="./Edit" asp-route-id="@item.IdCompany" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
}
</tbody>
</table>*@
</div>
@section Scripts {
<script>
$('[data-toggle="tooltip"]').tooltip({container: 'table'});
</script>
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EveryThing.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
namespace EveryThing.Pages.AdministrationUsers
{
[Authorize(Roles = "Administrator")]
public class IndexModel : PageModel
{
private readonly Data.ApplicationDbContext _context;
private readonly UserManager<IdentityApplicationUser> _userManager;
public IndexModel(Data.ApplicationDbContext context, UserManager<IdentityApplicationUser> userManager)
{
_context = context;
_userManager = userManager;
}
public new IList<IdentityApplicationUser> User { get; set; }
public async Task OnGetAsync()
{
User = await _userManager.Users.ToListAsync();
}
public IActionResult OnGetFrame()
{
User = _userManager.Users.ToList();
return Partial("IndexFrame");
}
}
}

View File

@@ -0,0 +1,37 @@
@model IList<EveryThing.Models.IdentityApplicationUser>
<table class="table card-table">
<thead>
<tr>
<th>
Ime
</th>
<th>
Priimek
</th>
<th style="width: 140px;">
Uporabniško ime
</th>
<th style="width: 30px;"></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Surname)
</td>
<td>
@Html.DisplayFor(modelItem => item.UserName)
</td>
<td class="text-right">
<a class="btn btn-xs icon-btn btn-outline-secondary borderless" asp-page="/AdministrationUsers/Edit" asp-route-idCompany="@ViewBag.IdCompany" asp-route-idUser="@item.Id" data-toggle="tooltip" data-placement="top" title="Urejanje" data-state="secondary"><i class="fas fa-pencil-alt"></i></a>
</td>
</tr>
}
</tbody>
</table>

View File

@@ -0,0 +1,185 @@
@page
@model EveryThing.Pages.CodeTableEmployees.CreateModel
@{
ViewData["Title"] = "Vnos delavca";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
}
<form enctype="multipart/form-data" method="post">
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Zaposleni /</span> Nov
</span>
<span class="text-right">
<a asp-page="Index" class="btn btn-default"><span class="fa fas fa-times"></span>&nbsp; Prekliči</a>
<button type="submit" class="btn btn-primary"><span class="fa fas fa-plus"></span>&nbsp; Dodaj delavca</button>
</span>
</h4>
<div class="row">
<div class="col-md-4">
<div class="card">
<h6 class="card-header">
Osnovni podatki
</h6>
<div class="card-body">
<div class="row">
<div class="col-md-4 text-center">
<img id="btn-profile-image" src="~/img/img_avatar.png" style="cursor: pointer;" />
<input id="profile-image" asp-for="Employee.ProfileImage" class="form-control" type="file" style="display: none" />
</div>
<div class="col-md-8">
<div class="form-group">
<label asp-for="Employee.FirstName" class="form-label"></label>
<input asp-for="Employee.FirstName" class="form-control" />
</div>
<div class="form-group">
<label asp-for="Employee.LastName" class="form-label"></label>
<input asp-for="Employee.LastName" class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.Gender" class="form-label"></label>
<select asp-for="Employee.Gender" class="form-control selectpicker" data-style="btn-default" asp-items="Html.GetEnumSelectList<Models.CodeTable.CodeTableEmployeeGender>()">
<option value="">Izberite spol</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.BirthDate" class="form-label"></label>
<input asp-for="Employee.BirthDate" type="text" class="form-control dtp-datenotime" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.EmploymentDate" class="form-label"></label>
<input asp-for="Employee.EmploymentDate" type="text" class="form-control dtp-datenotime" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.CitizenIdNumber" class="form-label"></label>
<input asp-for="Employee.CitizenIdNumber" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.TaxNumber" class="form-label"></label>
<input asp-for="Employee.TaxNumber" class="form-control" />
</div>
</div>
</div>
<div class="form-group mb-0">
<label asp-for="Employee.BankAccount" class="form-label"></label>
<input asp-for="Employee.BankAccount" class="form-control" />
</div>
</div>
<hr class="mb-0 mt-0" />
<div class="card-body">
<div class="text-light small font-weight-semibold mb-3">Kontaktni podatki</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.Telephone" class="form-label"></label>
<input asp-for="Employee.Telephone" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.MobileTelephone" class="form-label"></label>
<input asp-for="Employee.MobileTelephone" class="form-control" />
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Employee.Email" class="form-label"></label>
<input asp-for="Employee.Email" class="form-control" />
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<h6 class="card-header">
Podatki o prebivališču
</h6>
<div class="card-body">
<div class="text-light small font-weight-semibold mb-3">Stalni naslov</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label asp-for="Employee.Street" class="form-label"></label>
<input asp-for="Employee.Street" class="form-control" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.HouseNumber" class="form-label"></label>
<input asp-for="Employee.HouseNumber" class="form-control" />
</div>
</div>
</div>
<div class="form-group mb-0">
<label asp-for="Employee.City" class="form-label"></label>
<input asp-for="Employee.City" class="form-control" />
</div>
</div>
<hr class="mb-0 mt-0" />
<div class="card-body">
<div class="text-light small font-weight-semibold mb-3">Začasni naslov</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label asp-for="Employee.TemporaryStreet" class="form-label"></label>
<input asp-for="Employee.TemporaryStreet" class="form-control" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.TemporaryHouseNumber" class="form-label"></label>
<input asp-for="Employee.TemporaryHouseNumber" class="form-control" />
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Employee.TemporaryCity" class="form-label"></label>
<input asp-for="Employee.TemporaryCity" class="form-control" />
</div>
</div>
</div>
</div>
</div>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
</form>
<!-- Modal placeholder -->
<div id="modal-placeholder"></div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script>
$('#btn-profile-image').on('click', function () {
$('#profile-image').trigger('click');
});
</script>
}

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using EveryThing.Data;
using EveryThing.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableEmployees
{
[Authorize]
public class CreateModel : PageModel
{
private readonly ApplicationDbContext _context;
private readonly UserManager<IdentityApplicationUser> _userManager;
[BindProperty]
public CodeTableEmployee Employee { get; set; }
public CreateModel(ApplicationDbContext context, UserManager<IdentityApplicationUser> userManager)
{
_context = context;
_userManager = userManager;
}
public async Task<IActionResult> OnGetAsync()
{
var user = await _userManager.GetUserAsync(User);
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
//if (ModelState.IsValid)
//{
// _context.Add(employee);
// await _context.SaveChangesAsync();
// //Izbrana profilna slika
// if (employee.ProfileImage != null)
// {
// var file = employee.ProfileImage;
// var parsedContentDisposition = ContentDispositionHeaderValue.Parse(file.ContentDisposition);
// //Pot datoteke
// var fileName = employee.IdEmployee + Path.GetExtension(parsedContentDisposition.FileName.ToString());
// var filePath = Path.Combine(_hostingEnvironment.WebRootPath, "uploads", "profile-images", fileName);
// //Nalaganje
// using (var stream = System.IO.File.OpenWrite(filePath))
// {
// await file.CopyToAsync(stream);
// }
// }
// return RedirectToAction(nameof(Index));
//}
if (!ModelState.IsValid)
{
return Page();
}
var user = _userManager.GetUserAsync(User).Result;
Employee.IdCompanyFk = user.IdCompanyFk;
Employee.Active = true;
_context.CodeTableEmployees.Add(Employee);
await _context.SaveChangesAsync();
return RedirectToPage("./Index");
}
}
}

View File

@@ -0,0 +1,137 @@
@page
@model EveryThing.Pages.CodeTableEmployees.DeleteModel
@{
ViewData["Title"] = "Delete";
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete this?</h3>
<div>
<h4>Employee</h4>
<hr />
<dl class="row">
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.IdCompanyFk)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.IdCompanyFk)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.FirstName)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.FirstName)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.LastName)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.LastName)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.Gender)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.Gender)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.BirthDate)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.BirthDate)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.City)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.City)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.Street)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.Street)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.HouseNumber)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.HouseNumber)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.TemporaryCity)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.TemporaryCity)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.TemporaryStreet)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.TemporaryStreet)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.TemporaryHouseNumber)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.TemporaryHouseNumber)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.CitizenIdNumber)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.CitizenIdNumber)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.Telephone)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.Telephone)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.MobileTelephone)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.MobileTelephone)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.Email)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.Email)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.TaxNumber)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.TaxNumber)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.BankAccount)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.BankAccount)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.EmploymentDate)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.EmploymentDate)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Employee.Active)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Employee.Active)
</dd>
</dl>
<form method="post">
<input type="hidden" asp-for="Employee.IdEmployee" />
<input type="submit" value="Delete" class="btn btn-danger" /> |
<a asp-page="./Index">Back to List</a>
</form>
</div>

View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableEmployees
{
[Authorize]
public class DeleteModel : PageModel
{
private readonly ApplicationDbContext _context;
public DeleteModel(ApplicationDbContext context)
{
_context = context;
}
[BindProperty]
public CodeTableEmployee Employee { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Employee = await _context.CodeTableEmployees.FirstOrDefaultAsync(m => m.IdEmployee == id);
if (Employee == null)
{
return NotFound();
}
return Page();
}
public async Task<IActionResult> OnPostAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Employee = await _context.CodeTableEmployees.FindAsync(id);
if (Employee != null)
{
_context.CodeTableEmployees.Remove(Employee);
await _context.SaveChangesAsync();
}
return RedirectToPage("./Index");
}
}
}

View File

@@ -0,0 +1,189 @@
@page
@model EveryThing.Pages.CodeTableEmployees.EditModel
@{
Layout = "~/Pages/Layouts/_Layout.cshtml";
}
@section Styles {
<link rel="stylesheet" href="~/vendor/libs/bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.css">
}
<form enctype="multipart/form-data" method="post">
<h4 class="d-flex justify-content-between align-items-center w-100 font-weight-bold py-1 mb-4">
<span>
<span class="text-muted font-weight-light">Zaposleni /</span> Urejanje
</span>
<button type="submit" class="btn btn-secondary"><span class="ion ion-md-save"></span>&nbsp; Shrani delavca</button>
</h4>
<div class="row">
<div class="col-md-4">
<div class="card">
<h6 class="card-header">
Osnovni podatki
</h6>
<div class="card-body">
<div class="row">
<div class="col-md-4 text-center">
<img id="btn-profile-image" src="~/img/img_avatar.png" style="cursor: pointer;" />
<input id="profile-image" asp-for="Employee.ProfileImage" class="form-control" type="file" style="display: none" />
</div>
<div class="col-md-8">
<div class="form-group">
<label asp-for="Employee.FirstName" class="form-label"></label>
<input asp-for="Employee.FirstName" class="form-control" />
</div>
<div class="form-group">
<label asp-for="Employee.LastName" class="form-label"></label>
<input asp-for="Employee.LastName" class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.Gender" class="form-label"></label>
<select asp-for="Employee.Gender" class="form-control selectpicker" data-style="btn-default" asp-items="Html.GetEnumSelectList<Models.CodeTable.CodeTableEmployeeGender>()">
<option value="">Izberite spol</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.BirthDate" class="form-label"></label>
<input asp-for="Employee.BirthDate" type="text" class="form-control dtp-datenotime" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.EmploymentDate" class="form-label"></label>
<input asp-for="Employee.EmploymentDate" type="text" class="form-control dtp-datenotime" />
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.CitizenIdNumber" class="form-label"></label>
<input asp-for="Employee.CitizenIdNumber" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.TaxNumber" class="form-label"></label>
<input asp-for="Employee.TaxNumber" class="form-control" />
</div>
</div>
</div>
<div class="form-group mb-0">
<label asp-for="Employee.BankAccount" class="form-label"></label>
<input asp-for="Employee.BankAccount" class="form-control" />
</div>
</div>
<hr class="mb-0 mt-0" />
<div class="card-body">
<div class="text-light small font-weight-semibold mb-3">Kontaktni podatki</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.Telephone" class="form-label"></label>
<input asp-for="Employee.Telephone" class="form-control" />
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label asp-for="Employee.MobileTelephone" class="form-label"></label>
<input asp-for="Employee.MobileTelephone" class="form-control" />
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Employee.Email" class="form-label"></label>
<input asp-for="Employee.Email" class="form-control" />
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<h6 class="card-header">
Podatki o prebivališču
</h6>
<div class="card-body">
<div class="text-light small font-weight-semibold mb-3">Stalni naslov</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label asp-for="Employee.Street" class="form-label"></label>
<input asp-for="Employee.Street" class="form-control" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.HouseNumber" class="form-label"></label>
<input asp-for="Employee.HouseNumber" class="form-control" />
</div>
</div>
</div>
<div class="form-group mb-0">
<label asp-for="Employee.City" class="form-label"></label>
<input asp-for="Employee.City" class="form-control" />
</div>
</div>
<hr class="mb-0 mt-0" />
<div class="card-body">
<div class="text-light small font-weight-semibold mb-3">Začasni naslov</div>
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label asp-for="Employee.TemporaryStreet" class="form-label"></label>
<input asp-for="Employee.TemporaryStreet" class="form-control" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label asp-for="Employee.TemporaryHouseNumber" class="form-label"></label>
<input asp-for="Employee.TemporaryHouseNumber" class="form-control" />
</div>
</div>
</div>
<div class="form-group">
<label asp-for="Employee.TemporaryCity" class="form-label"></label>
<input asp-for="Employee.TemporaryCity" class="form-control" />
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<h6 class="card-header">
Dokumenti
</h6>
<div class="card-body">
<partial name="Documents/IndexModal" model="Model.Document" />
</div>
</div>
</div>
</div>
</form>
<!-- Modal placeholder -->
<div id="modal-placeholder"></div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
<script src="~/vendor/libs/moment/moment.js"></script>
<script src="~/vendor/libs/bootstrap-material-datetimepicker/bootstrap-material-datetimepicker.js"></script>
<script>
$('#btn-profile-image').on('click', function () {
$('#profile-image').trigger('click');
});
</script>
}

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.EntityFrameworkCore;
using EveryThing.Data;
using EveryThing.Models;
using EveryThing.Models.CodeTable;
namespace EveryThing.Pages.CodeTableEmployees
{
public class EditModel : PageModel
{
private readonly ApplicationDbContext _context;
public EditModel(ApplicationDbContext context)
{
_context = context;
}
[BindProperty]
public CodeTableEmployee Employee { get; set; }
public IList<Document> Document { get; set; }
public async Task<IActionResult> OnGetAsync(int? id)
{
if (id == null)
{
return NotFound();
}
Employee = await _context.CodeTableEmployees.FirstOrDefaultAsync(m => m.IdEmployee == id);
Document = await _context.Documents.Include(d => d.DocumentType).ToListAsync();
if (Employee == null)
{
return NotFound();
}
return Page();
}
public async Task<IActionResult> OnPostAsync()
{
if (!ModelState.IsValid)
{
return Page();
}
_context.Attach(Employee).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!EmployeeExists(Employee.IdEmployee))
{
return NotFound();
}
else
{
throw;
}
}
return RedirectToPage("./Index");
}
private bool EmployeeExists(int id)
{
return _context.CodeTableEmployees.Any(e => e.IdEmployee == id);
}
}
}

Some files were not shown because too many files have changed in this diff Show More