Arne Diekmann 4 năm trước cách đây
mục cha
commit
395f9aa518

+ 96 - 0
GreenTree.Maschinenbestellungen.Domain/Migrations/20210921220939_InitialCreate.Designer.cs

@@ -0,0 +1,96 @@
+// <auto-generated />
+using System;
+using GreenTree.Maschinenbestellungen.Domain.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace GreenTree.Maschinenbestellungen.Domain.Migrations
+{
+    [DbContext(typeof(OrderDbContext))]
+    [Migration("20210921220939_InitialCreate")]
+    partial class InitialCreate
+    {
+        protected override void BuildTargetModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "3.1.5")
+                .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.Policy", b =>
+                {
+                    b.Property<string>("Name")
+                        .HasColumnType("varchar(255) CHARACTER SET utf8mb4");
+
+                    b.HasKey("Name");
+
+                    b.ToTable("Policies");
+                });
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.User", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Accountname")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<bool?>("Activated")
+                        .IsRequired()
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("tinyint(1)")
+                        .HasDefaultValue(true);
+
+                    b.Property<DateTime?>("Birthdate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<string>("Forename")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<string>("Lastname")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<string>("MailAddress")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Users");
+                });
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.UserPolicy", b =>
+                {
+                    b.Property<int>("UserId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("PolicyName")
+                        .HasColumnType("varchar(255) CHARACTER SET utf8mb4");
+
+                    b.HasKey("UserId", "PolicyName");
+
+                    b.ToTable("UserPolicies");
+                });
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.UserPolicy", b =>
+                {
+                    b.HasOne("GreenTree.Maschinenbestellungen.Core.Domain.Rights.User", "User")
+                        .WithMany("Policies")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 72 - 0
GreenTree.Maschinenbestellungen.Domain/Migrations/20210921220939_InitialCreate.cs

@@ -0,0 +1,72 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+namespace GreenTree.Maschinenbestellungen.Domain.Migrations
+{
+    public partial class InitialCreate : Migration
+    {
+        protected override void Up(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.CreateTable(
+                name: "Policies",
+                columns: table => new
+                {
+                    Name = table.Column<string>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Policies", x => x.Name);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "Users",
+                columns: table => new
+                {
+                    Id = table.Column<int>(nullable: false)
+                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+                    Accountname = table.Column<string>(nullable: false),
+                    Forename = table.Column<string>(nullable: false),
+                    Lastname = table.Column<string>(nullable: false),
+                    MailAddress = table.Column<string>(nullable: false),
+                    Password = table.Column<string>(nullable: false),
+                    Birthdate = table.Column<DateTime>(nullable: true),
+                    Activated = table.Column<bool>(nullable: false, defaultValue: true)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_Users", x => x.Id);
+                });
+
+            migrationBuilder.CreateTable(
+                name: "UserPolicies",
+                columns: table => new
+                {
+                    PolicyName = table.Column<string>(nullable: false),
+                    UserId = table.Column<int>(nullable: false)
+                },
+                constraints: table =>
+                {
+                    table.PrimaryKey("PK_UserPolicies", x => new { x.UserId, x.PolicyName });
+                    table.ForeignKey(
+                        name: "FK_UserPolicies_Users_UserId",
+                        column: x => x.UserId,
+                        principalTable: "Users",
+                        principalColumn: "Id",
+                        onDelete: ReferentialAction.Cascade);
+                });
+        }
+
+        protected override void Down(MigrationBuilder migrationBuilder)
+        {
+            migrationBuilder.DropTable(
+                name: "Policies");
+
+            migrationBuilder.DropTable(
+                name: "UserPolicies");
+
+            migrationBuilder.DropTable(
+                name: "Users");
+        }
+    }
+}

+ 94 - 0
GreenTree.Maschinenbestellungen.Domain/Migrations/OrderDbContextModelSnapshot.cs

@@ -0,0 +1,94 @@
+// <auto-generated />
+using System;
+using GreenTree.Maschinenbestellungen.Domain.Model;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+namespace GreenTree.Maschinenbestellungen.Domain.Migrations
+{
+    [DbContext(typeof(OrderDbContext))]
+    partial class OrderDbContextModelSnapshot : ModelSnapshot
+    {
+        protected override void BuildModel(ModelBuilder modelBuilder)
+        {
+#pragma warning disable 612, 618
+            modelBuilder
+                .HasAnnotation("ProductVersion", "3.1.5")
+                .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.Policy", b =>
+                {
+                    b.Property<string>("Name")
+                        .HasColumnType("varchar(255) CHARACTER SET utf8mb4");
+
+                    b.HasKey("Name");
+
+                    b.ToTable("Policies");
+                });
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.User", b =>
+                {
+                    b.Property<int>("Id")
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("int");
+
+                    b.Property<string>("Accountname")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<bool?>("Activated")
+                        .IsRequired()
+                        .ValueGeneratedOnAdd()
+                        .HasColumnType("tinyint(1)")
+                        .HasDefaultValue(true);
+
+                    b.Property<DateTime?>("Birthdate")
+                        .HasColumnType("datetime(6)");
+
+                    b.Property<string>("Forename")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<string>("Lastname")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<string>("MailAddress")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.Property<string>("Password")
+                        .IsRequired()
+                        .HasColumnType("longtext CHARACTER SET utf8mb4");
+
+                    b.HasKey("Id");
+
+                    b.ToTable("Users");
+                });
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.UserPolicy", b =>
+                {
+                    b.Property<int>("UserId")
+                        .HasColumnType("int");
+
+                    b.Property<string>("PolicyName")
+                        .HasColumnType("varchar(255) CHARACTER SET utf8mb4");
+
+                    b.HasKey("UserId", "PolicyName");
+
+                    b.ToTable("UserPolicies");
+                });
+
+            modelBuilder.Entity("GreenTree.Maschinenbestellungen.Core.Domain.Rights.UserPolicy", b =>
+                {
+                    b.HasOne("GreenTree.Maschinenbestellungen.Core.Domain.Rights.User", "User")
+                        .WithMany("Policies")
+                        .HasForeignKey("UserId")
+                        .OnDelete(DeleteBehavior.Cascade)
+                        .IsRequired();
+                });
+#pragma warning restore 612, 618
+        }
+    }
+}

+ 0 - 2
GreenTree.Maschinenbestellungen.Domain/Model/OrderDbContext.cs

@@ -6,8 +6,6 @@ using System;
 using System.Collections.Generic;
 using System.Reflection;
 using System.Text;
-using GreenTree.Maschinenbestellungen.Core.Domain.Business;
-using GreenTree.Maschinenbestellungen.Domain.Model.Business;
 
 namespace GreenTree.Maschinenbestellungen.Domain.Model
 {

+ 1 - 0
GreenTree.Maschinenbestellungen.Web/GreenTree.Maschinenbestellungen.Web.csproj

@@ -30,6 +30,7 @@
   </ItemGroup>
 
   <ItemGroup>
+    <Folder Include="Helper\" />
     <Folder Include="Models\Business\" />
   </ItemGroup>
 

+ 0 - 116
GreenTree.Maschinenbestellungen.Web/Helper/ImportHelper.cs

@@ -1,116 +0,0 @@
-using CsvHelper;
-using GreenTree.Maschinenbestellungen.Web.Models.Import;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace GreenTree.Maschinenbestellungen.Web.Helper
-{
-    public static class ImportHelper
-    {
-        /// <summary>
-        /// Checks an ImportModel instance for a valid import file for the specified data type <typeparamref name="T"/>
-        /// </summary>
-        /// <typeparam name="TEntity">The data type.</typeparam>
-        /// <param name="model">The import model.</param>
-        public static void CheckImport<TEntity>(ImportModel model)
-        {
-            CheckImport<TEntity, TEntity>(model);
-        }
-
-        /// <summary>
-        /// Checks an ImportModel instance for a valid import file for the specified data type <typeparamref name="T"/>
-        /// </summary>
-        /// <typeparam name="TEntity">The data type.</typeparam>
-        /// <typeparam name="TMap">The data map type.</typeparam>
-        /// <param name="model">The import model.</param>
-        public static void CheckImport<TEntity, TMap>(ImportModel model)
-        {
-            if (model == null)
-                throw new ArgumentNullException("model", "The importModel must not be NULL.");
-
-            if (model.ImportFile == null)
-                throw new ArgumentException("The importModel does not contain a file.", "model");
-
-            var tempfile = Path.GetTempFileName();
-
-            using var writer = new FileStream(tempfile, FileMode.Append);
-
-            model.ImportFile.CopyTo(writer);
-
-            writer.Close();
-
-            using (var reader = new StreamReader(tempfile))
-            {
-                using var csv = new CsvReader(reader, CultureInfo.InvariantCulture);
-
-                csv.Configuration.Delimiter = ";";
-                csv.Configuration.BadDataFound = null;
-
-                if (typeof(TEntity) != typeof(TMap))
-                    csv.Configuration.RegisterClassMap(typeof(TMap));
-
-                csv.Read();
-                csv.ReadHeader();
-
-                csv.ValidateHeader<TEntity>();
-            }
-        }
-
-        /// <summary>
-        /// Gets an object collection of <typeparamref name="T"/> from the import file
-        /// </summary>
-        /// <typeparam name="TEntity">The data type.</typeparam>
-        /// <param name="model">The import model.</param>
-        public static IEnumerable<TEntity> GetFromImport<TEntity>(ImportModel model)
-        {
-            return GetFromImport<TEntity, TEntity>(model);
-        }
-
-        /// <summary>
-        /// Gets an object collection of <typeparamref name="T"/> from the import file
-        /// </summary>
-        /// <typeparam name="TEntity">The data type.</typeparam>
-        /// <typeparam name="TMap">The data map type.</typeparam>
-        /// <param name="model">The import model.</param>
-        public static IEnumerable<TEntity> GetFromImport<TEntity, TMap>(ImportModel model)
-        {
-            if (model == null)
-                throw new ArgumentNullException("model", "The importModel must not be NULL.");
-
-            if (model.ImportFile == null)
-                throw new ArgumentException("The importModel does not contain a file.", "model");
-
-            var tempfile = Path.GetTempFileName();
-
-            using var writer = new FileStream(tempfile, FileMode.Append);
-
-            model.ImportFile.CopyTo(writer);
-
-            writer.Close();
-
-            using (var reader = new StreamReader(tempfile))
-            {
-                using var csv = new CsvReader(reader, CultureInfo.InvariantCulture);
-
-                csv.Configuration.Delimiter = ";";
-                csv.Configuration.BadDataFound = null;
-
-                if (typeof(TEntity) != typeof(TMap))
-                    csv.Configuration.RegisterClassMap(typeof(TMap));
-
-                csv.Read();
-                csv.ReadHeader();
-
-                csv.ValidateHeader<TEntity>();
-
-                var result = csv.GetRecords<TEntity>().ToArray();
-
-                return result;
-            }
-        }
-    }
-}

+ 0 - 43
GreenTree.Maschinenbestellungen.Web/ImportMaps/CustomerMap.cs

@@ -1,43 +0,0 @@
-using CsvHelper.Configuration;
-using GreenTree.Maschinenbestellungen.Core.Domain.Business;
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace GreenTree.Maschinenbestellungen.Web.ImportMaps
-{
-    public sealed class CustomerMap : ClassMap<Customer>
-    {
-        #region Ctor
-
-        /// <summary>
-        /// Initialzes a new instnce of the CustomerMap class
-        /// </summary>
-        public CustomerMap()
-        {
-            AutoMap(CultureInfo.InvariantCulture);
-
-            Map(m => m.Title.Id).Name("TitleId").Default(1);
-            Map(m => m.Title.Name).Ignore();
-
-            Map(m => m.Tax.Id).Name("TaxId").Default(-1);
-            Map(m => m.Tax.Name).Ignore();
-            Map(m => m.Tax.ShortName).Ignore();
-            Map(m => m.Tax.Value).Ignore();
-
-            Map(m => m.CreatedOn).Ignore();
-            Map(m => m.CreatedBy).Ignore();
-
-            Map(m => m.ChangedOn).Ignore();
-            Map(m => m.ChangedBy).Ignore();
-
-            Map(m => m.CreationStatus).Ignore();
-
-            Map(m => m.Crafts).Ignore();
-        }
-
-        #endregion
-    }
-}

+ 1 - 1
GreenTree.Maschinenbestellungen.Web/Startup.cs

@@ -132,7 +132,7 @@ namespace GreenTree.Maschinenbestellungen.Web
             // Add Counter DbContext
             services.AddDbContextPool<OrderDbContext>(options =>
             {
-                options.UseMySql(Configuration.GetConnectionString("ERPDatabase"));
+                options.UseMySql(Configuration.GetConnectionString("OrderDatabase"));
                 options.UseLazyLoadingProxies();
             });
 

+ 2 - 2
GreenTree.Maschinenbestellungen.Web/Views/Shared/_Layout.cshtml

@@ -82,7 +82,7 @@
 
         <!-- Sidebar -->
         <div class="bg-light border-right" id="sidebar-wrapper">
-            <div class="sidebar-heading">Strohrmann ERP</div>
+            <div class="sidebar-heading">Schweerbau</div>
             <div class="list-group list-group-flush">
                 <h5 class="list-group-item">Dashboard</h5>
                 <a asp-controller="Home" asp-action="Index" class="list-group-item list-group-item-action bg-light">
@@ -113,7 +113,7 @@
                         </nav>
                     </div>
                     <div class="d-none d-lg-inline p-2">
-                        <img class="align-middle mt-1" src="~/img/strohrmann_logo.png" title="Strohrmann" height="30" />
+                        <img class="align-middle mt-1" src="~/img/logo.png" title="Schweerbau" height="30" />
                     </div>
                     <div class="d-flex user-logo-container">
                         <img class="align-self-center mr-1 ml-3" src="~/img/user_logo.png" title="@User.Identity.Name" height="40" />

+ 0 - 1
GreenTree.Maschinenbestellungen.Web/Views/_ViewImports.cshtml

@@ -2,6 +2,5 @@
 @using GreenTree.Maschinenbestellungen.Web
 @using GreenTree.Maschinenbestellungen.Web.Models
 @using GreenTree.Maschinenbestellungen.Web.Extension
-@using GreenTree.Maschinenbestellungen.Web.Models.Business
 @using GreenTree.Maschinenbestellungen.Core.Extension
 @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

+ 1 - 1
GreenTree.Maschinenbestellungen.Web/appsettings.json

@@ -8,7 +8,7 @@
     },
     "AllowedHosts": "*",
     "ConnectionStrings": {
-        "ERPDatabase": "Server=lynx-solutions.org;Port=33306;Database=Maschinenbestellungen;User Id=root;Password=dV84HTb68?s,;"
+        "OrderDatabase": "Server=lynx-solutions.org;Port=33306;Database=Maschinenbestellungen;User Id=root;Password=dV84HTb68?s,;"
     },
     "SessionOptions": {
         "IdleTimeout": "01:00:00",

+ 2 - 2
GreenTree.Maschinenbestellungen.Web/wwwroot/css/site.css

@@ -126,8 +126,8 @@ body {
 /* NavBar */
 
 .user-logo-container {
-    border-left-color: #F29000;
-    background-color: #F29000;
+    border-left-color: #e20816;
+    background-color: #e20816;
     border-bottom-left-radius: 20px;
     border-top-left-radius: 0;
 }

BIN
GreenTree.Maschinenbestellungen.Web/wwwroot/img/logo.png


BIN
GreenTree.Maschinenbestellungen.Web/wwwroot/img/strohrmann_logo.png