diff --git a/SoftwareInstallation/AbstractSoftwareInstallationBusinessLogic/BusinessLogic/OrderLogic.cs b/SoftwareInstallation/AbstractSoftwareInstallationBusinessLogic/BusinessLogic/OrderLogic.cs index e10fa1b..d815dd4 100644 --- a/SoftwareInstallation/AbstractSoftwareInstallationBusinessLogic/BusinessLogic/OrderLogic.cs +++ b/SoftwareInstallation/AbstractSoftwareInstallationBusinessLogic/BusinessLogic/OrderLogic.cs @@ -39,7 +39,7 @@ namespace AbstractSoftwareInstallationBusinessLogic.BusinessLogic { throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum)); } - _logger.LogInformation("Order. OrderID:{Id}. Sum:{ Sum}. SushiId: { SushiId}", model.Id, model.Sum, model.PackageId); + _logger.LogInformation("Order. OrderID:{Id}. Sum:{ Sum}. PackageId: { PackageId}", model.Id, model.Sum, model.PackageId); } public List? ReadList(OrderSearchModel? model) diff --git a/SoftwareInstallation/AbstractSoftwareInstallationContracts/BindingModels/PackageBindingModel.cs b/SoftwareInstallation/AbstractSoftwareInstallationContracts/BindingModels/PackageBindingModel.cs index a37e76f..4128929 100644 --- a/SoftwareInstallation/AbstractSoftwareInstallationContracts/BindingModels/PackageBindingModel.cs +++ b/SoftwareInstallation/AbstractSoftwareInstallationContracts/BindingModels/PackageBindingModel.cs @@ -12,7 +12,6 @@ namespace AbstractSoftwareInstallationContracts.BindingModels public int Id { get; set; } public string PackageName { get; set; } = string.Empty; public double Price { get; set; } - public Dictionary PackageSoftware { get; set; } = new(); - + public Dictionary PackageSoftware{get;set;} = new(); } } \ No newline at end of file diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/ClientStorage.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/ClientStorage.cs new file mode 100644 index 0000000..a7496be --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/ClientStorage.cs @@ -0,0 +1,89 @@ +using AbstractSoftwareInstallationContracts.BindingModels; +using AbstractSoftwareInstallationContracts.SearchModels; +using AbstractSoftwareInstallationContracts.StoragesContracts; +using AbstractSoftwareInstallationContracts.ViewModels; +using AbstractSoftwareInstallationDatabaseImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractSoftwareInstallationDatabaseImplement.Implements +{ + public class ClientStorage : IClientStorage + { + public ClientViewModel? GetElement(ClientSearchModel model) + { + if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue) + { + return null; + } + using var context = new AbstractSoftwareInstallationDatabase(); + return context.Clients + .FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email) + && x.Email == model.Email) + || (model.Id.HasValue && x.Id == model.Id)) + ?.GetViewModel; + } + + public List GetFilteredList(ClientSearchModel model) + { + if (string.IsNullOrEmpty(model.Email)) + { + return new(); + } + using var context = new AbstractSoftwareInstallationDatabase(); + return context.Clients + .Where(x => x.Email.Contains(model.Email)) + .Select(x => x.GetViewModel) + .ToList(); + } + + public List GetFullList() + { + using var context = new AbstractSoftwareInstallationDatabase(); + return context.Clients + .Select(x => x.GetViewModel) + .ToList(); + } + + public ClientViewModel? Insert(ClientBindingModel model) + { + var newClient = Client.Create(model); + if (newClient == null) + { + return null; + } + using var context = new AbstractSoftwareInstallationDatabase(); + context.Clients.Add(newClient); + context.SaveChanges(); + return newClient.GetViewModel; + } + + public ClientViewModel? Update(ClientBindingModel model) + { + using var context = new AbstractSoftwareInstallationDatabase(); + var Client = context.Clients.FirstOrDefault(x => x.Id == model.Id); + if (Client == null) + { + return null; + } + Client.Update(model); + context.SaveChanges(); + return Client.GetViewModel; + } + public ClientViewModel? Delete(ClientBindingModel model) + { + using var context = new AbstractSoftwareInstallationDatabase(); + var element = context.Clients.FirstOrDefault(rec => rec.Id == model.Id); + if (element != null) + { + context.Clients.Remove(element); + context.SaveChanges(); + return element.GetViewModel; + } + return null; + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/ImplementerStorage.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/ImplementerStorage.cs new file mode 100644 index 0000000..e010416 --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Implements/ImplementerStorage.cs @@ -0,0 +1,84 @@ +using AbstractSoftwareInstallationContracts.BindingModels; +using AbstractSoftwareInstallationContracts.SearchModels; +using AbstractSoftwareInstallationContracts.StoragesContracts; +using AbstractSoftwareInstallationContracts.ViewModels; +using AbstractSoftwareInstallationDatabaseImplement.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractSoftwareInstallationDatabaseImplement.Implements +{ + public class ImplementerStorage : IImplementerStorage + { + + public ImplementerViewModel? GetElement(ImplementerSearchModel model) + { + using var context = new AbstractSoftwareInstallationDatabase(); + if (model.Id.HasValue) return context.Implementers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel; + if (model.ImplementerFIO != null && model.Password != null) return context.Implementers.FirstOrDefault(x => x.ImplementerFIO.Equals(model.ImplementerFIO) && x.Password.Equals(model.Password))?.GetViewModel; + if (model.ImplementerFIO != null) return context.Implementers.FirstOrDefault(x => x.ImplementerFIO.Equals(model.ImplementerFIO))?.GetViewModel; + return null; + } + + public List GetFilteredList(ImplementerSearchModel model) + { + if (model == null) + { + return new(); + } + if (model.ImplementerFIO != null) + { + using var context = new AbstractSoftwareInstallationDatabase(); + return context.Implementers + .Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO)) + .Select(x => x.GetViewModel) + .ToList(); + } + return new(); + } + + public List GetFullList() + { + using var context = new AbstractSoftwareInstallationDatabase(); + return context.Implementers.Select(x => x.GetViewModel).ToList(); + } + + public ImplementerViewModel? Insert(ImplementerBindingModel model) + { + using var context = new AbstractSoftwareInstallationDatabase(); + var res = Implementer.Create(model); + if (res != null) + { + context.Implementers.Add(res); + context.SaveChanges(); + } + return res?.GetViewModel; + } + + public ImplementerViewModel? Update(ImplementerBindingModel model) + { + using var context = new AbstractSoftwareInstallationDatabase(); + var res = context.Implementers.FirstOrDefault(x => x.Id == model.Id); + if (res != null) + { + res.Update(model); + context.SaveChanges(); + } + return res?.GetViewModel; + } + public ImplementerViewModel? Delete(ImplementerBindingModel model) + { + using var context = new AbstractSoftwareInstallationDatabase(); + var res = context.Implementers.FirstOrDefault(x => x.Id == model.Id); + if (res != null) + { + context.Implementers.Remove(res); + context.SaveChanges(); + } + return res?.GetViewModel; + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230422195123_Client.Designer.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230422195123_Client.Designer.cs new file mode 100644 index 0000000..4f61cbf --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230422195123_Client.Designer.cs @@ -0,0 +1,214 @@ +// +using System; +using AbstractSoftwareInstallationDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AbstractSoftwareInstallationDatabaseImplement.Migrations +{ + [DbContext(typeof(AbstractSoftwareInstallationDatabase))] + [Migration("20230422195123_Client")] + partial class Client + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("PackageId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("PackageId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PackageName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("PackageId") + .HasColumnType("int"); + + b.Property("SoftwareId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("SoftwareId"); + + b.ToTable("PackageSoftwares"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("SoftwareName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Softwares"); + }); + + modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b => + { + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package") + .WithMany("Orders") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Package"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b => + { + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package") + .WithMany("Softwares") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Software", "Software") + .WithMany("PackageSoftwares") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Package"); + + b.Navigation("Software"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b => + { + b.Navigation("Orders"); + + b.Navigation("Softwares"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b => + { + b.Navigation("PackageSoftwares"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230422195123_Client.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230422195123_Client.cs new file mode 100644 index 0000000..1e199b5 --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230422195123_Client.cs @@ -0,0 +1,68 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AbstractSoftwareInstallationDatabaseImplement.Migrations +{ + /// + public partial class Client : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ClientId", + table: "Orders", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.CreateTable( + name: "Clients", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientFIO = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Clients", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ClientId", + table: "Orders", + column: "ClientId"); + + migrationBuilder.AddForeignKey( + name: "FK_Orders_Clients_ClientId", + table: "Orders", + column: "ClientId", + principalTable: "Clients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Orders_Clients_ClientId", + table: "Orders"); + + migrationBuilder.DropTable( + name: "Clients"); + + migrationBuilder.DropIndex( + name: "IX_Orders_ClientId", + table: "Orders"); + + migrationBuilder.DropColumn( + name: "ClientId", + table: "Orders"); + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423193329_Implementer.Designer.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423193329_Implementer.Designer.cs new file mode 100644 index 0000000..f5b9aae --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423193329_Implementer.Designer.cs @@ -0,0 +1,255 @@ +// +using System; +using AbstractSoftwareInstallationDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AbstractSoftwareInstallationDatabaseImplement.Migrations +{ + [DbContext(typeof(AbstractSoftwareInstallationDatabase))] + [Migration("20230423193329_Implementer")] + partial class Implementer + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("ImplementerId") + .HasColumnType("int"); + + b.Property("PackageId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("ImplementerId"); + + b.HasIndex("PackageId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ImplementerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("WorkExperience") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Implementers"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PackageName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("PackageId") + .HasColumnType("int"); + + b.Property("SoftwareId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("SoftwareId"); + + b.ToTable("PackageSoftwares"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("SoftwareName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Softwares"); + }); + + modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b => + { + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", null) + .WithMany("Orders") + .HasForeignKey("ImplementerId"); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package") + .WithMany("Orders") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Package"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b => + { + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package") + .WithMany("Softwares") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Software", "Software") + .WithMany("PackageSoftwares") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Package"); + + b.Navigation("Software"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b => + { + b.Navigation("Orders"); + + b.Navigation("Softwares"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b => + { + b.Navigation("PackageSoftwares"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423193329_Implementer.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423193329_Implementer.cs new file mode 100644 index 0000000..9c24aaf --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423193329_Implementer.cs @@ -0,0 +1,67 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AbstractSoftwareInstallationDatabaseImplement.Migrations +{ + /// + public partial class Implementer : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ImplementerId", + table: "Orders", + type: "int", + nullable: true); + + migrationBuilder.CreateTable( + name: "Implementers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Qualification = table.Column(type: "int", nullable: false), + ImplementerFIO = table.Column(type: "nvarchar(max)", nullable: false), + WorkExperience = table.Column(type: "int", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Implementers", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_ImplementerId", + table: "Orders", + column: "ImplementerId"); + + migrationBuilder.AddForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + table: "Orders", + column: "ImplementerId", + principalTable: "Implementers", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + table: "Orders"); + + migrationBuilder.DropTable( + name: "Implementers"); + + migrationBuilder.DropIndex( + name: "IX_Orders_ImplementerId", + table: "Orders"); + + migrationBuilder.DropColumn( + name: "ImplementerId", + table: "Orders"); + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423205115_OrderUPDATE.Designer.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423205115_OrderUPDATE.Designer.cs new file mode 100644 index 0000000..3e8fb73 --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423205115_OrderUPDATE.Designer.cs @@ -0,0 +1,259 @@ +// +using System; +using AbstractSoftwareInstallationDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AbstractSoftwareInstallationDatabaseImplement.Migrations +{ + [DbContext(typeof(AbstractSoftwareInstallationDatabase))] + [Migration("20230423205115_OrderUPDATE")] + partial class OrderUPDATE + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateImplement") + .HasColumnType("datetime2"); + + b.Property("ImplementerId") + .HasColumnType("int"); + + b.Property("PackageId") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("Sum") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.HasIndex("ImplementerId"); + + b.HasIndex("PackageId"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Clients"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ImplementerFIO") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("WorkExperience") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Implementers"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PackageName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Price") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.ToTable("Packages"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("PackageId") + .HasColumnType("int"); + + b.Property("SoftwareId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("SoftwareId"); + + b.ToTable("PackageSoftwares"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Cost") + .HasColumnType("float"); + + b.Property("SoftwareName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Softwares"); + }); + + modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b => + { + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Client", "Client") + .WithMany("Orders") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", "Implementer") + .WithMany("Orders") + .HasForeignKey("ImplementerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package") + .WithMany("Orders") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Client"); + + b.Navigation("Implementer"); + + b.Navigation("Package"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b => + { + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package") + .WithMany("Softwares") + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Software", "Software") + .WithMany("PackageSoftwares") + .HasForeignKey("SoftwareId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Package"); + + b.Navigation("Software"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b => + { + b.Navigation("Orders"); + + b.Navigation("Softwares"); + }); + + modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b => + { + b.Navigation("PackageSoftwares"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423205115_OrderUPDATE.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423205115_OrderUPDATE.cs new file mode 100644 index 0000000..cb79582 --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Migrations/20230423205115_OrderUPDATE.cs @@ -0,0 +1,59 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AbstractSoftwareInstallationDatabaseImplement.Migrations +{ + /// + public partial class OrderUPDATE : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + table: "Orders"); + + migrationBuilder.AlterColumn( + name: "ImplementerId", + table: "Orders", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + table: "Orders", + column: "ImplementerId", + principalTable: "Implementers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + table: "Orders"); + + migrationBuilder.AlterColumn( + name: "ImplementerId", + table: "Orders", + type: "int", + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AddForeignKey( + name: "FK_Orders_Implementers_ImplementerId", + table: "Orders", + column: "ImplementerId", + principalTable: "Implementers", + principalColumn: "Id"); + } + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Models/Client.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Models/Client.cs new file mode 100644 index 0000000..f53311f --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Models/Client.cs @@ -0,0 +1,59 @@ +using AbstractPackageInstallationDatabaseImplement.Models; +using AbstractSoftwareInstallationContracts.BindingModels; +using AbstractSoftwareInstallationContracts.ViewModels; +using AbstractSoftwareInstallationDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractSoftwareInstallationDatabaseImplement.Models +{ + public class Client : IClientModel + { + public int Id { get; private set; } + [Required] + public string ClientFIO { get; private set; } = string.Empty; + [Required] + public string Email { get; private set; } = string.Empty; + [Required] + public string Password { get; private set; } = string.Empty; + [ForeignKey("ClientId")] + public virtual List Orders { get; set; } = new(); + + public static Client? Create(ClientBindingModel? model) + { + if (model == null) + { + return null; + } + return new Client() + { + Id = model.Id, + ClientFIO = model.ClientFIO, + Email = model.Email, + Password = model.Password + }; + } + public void Update(ClientBindingModel? model) + { + if (model == null) + { + return; + } + ClientFIO = model.ClientFIO; + Email = model.Email; + Password = model.Password; + } + public ClientViewModel GetViewModel => new() + { + Id = Id, + ClientFIO = ClientFIO, + Email = Email, + Password = Password + }; + } +} diff --git a/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Models/Implementer.cs b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Models/Implementer.cs new file mode 100644 index 0000000..a8ef5b3 --- /dev/null +++ b/SoftwareInstallation/AbstractSoftwareInstallationDatabaseImplement/Models/Implementer.cs @@ -0,0 +1,64 @@ +using AbstractPackageInstallationDatabaseImplement.Models; +using AbstractSoftwareInstallationContracts.BindingModels; +using AbstractSoftwareInstallationContracts.ViewModels; +using AbstractSoftwareInstallationDataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AbstractSoftwareInstallationDatabaseImplement.Models +{ + public class Implementer : IImplementerModel + { + public int Id { get; private set; } + [Required] + public int Qualification { get; private set; } + [Required] + public string ImplementerFIO { get; private set; } = string.Empty; + [Required] + public int WorkExperience { get; private set; } + [Required] + public string Password { get; private set; } = string.Empty; + [ForeignKey("ImplementerId")] + public virtual List Orders { get; set; } = new(); + + public static Implementer? Create(ImplementerBindingModel? model) + { + if (model == null) + { + return null; + } + return new Implementer() + { + Id = model.Id, + Qualification = model.Qualification, + ImplementerFIO = model.ImplementerFIO, + WorkExperience = model.WorkExperience, + Password = model.Password + }; + } + public void Update(ImplementerBindingModel? model) + { + if (model == null) + { + return; + } + Qualification = model.Qualification; + ImplementerFIO = model.ImplementerFIO; + WorkExperience = model.WorkExperience; + Password = model.Password; + } + public ImplementerViewModel GetViewModel => new() + { + Id = Id, + Qualification = Qualification, + ImplementerFIO = ImplementerFIO, + WorkExperience = WorkExperience, + Password = Password + }; + } +} diff --git a/SoftwareInstallation/SoftwareInstallation.sln b/SoftwareInstallation/SoftwareInstallation.sln index 500f0a9..059cf38 100644 --- a/SoftwareInstallation/SoftwareInstallation.sln +++ b/SoftwareInstallation/SoftwareInstallation.sln @@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSoftwareInstallatio EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSoftwareInstallationFileImplement", "AbstractSoftwareInstallationFileImplement\AbstractSoftwareInstallationFileImplement.csproj", "{BEE13C3F-1BB8-46B4-BC87-CFC367E52A77}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSoftwareInstallationDatabaseImplement", "AbstractSoftwareInstallationDatabaseImplement\AbstractSoftwareInstallationDatabaseImplement.csproj", "{7631EF04-BAD9-44D7-80C5-6017EDEA7E14}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ Global {BEE13C3F-1BB8-46B4-BC87-CFC367E52A77}.Debug|Any CPU.Build.0 = Debug|Any CPU {BEE13C3F-1BB8-46B4-BC87-CFC367E52A77}.Release|Any CPU.ActiveCfg = Release|Any CPU {BEE13C3F-1BB8-46B4-BC87-CFC367E52A77}.Release|Any CPU.Build.0 = Release|Any CPU + {7631EF04-BAD9-44D7-80C5-6017EDEA7E14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7631EF04-BAD9-44D7-80C5-6017EDEA7E14}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7631EF04-BAD9-44D7-80C5-6017EDEA7E14}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7631EF04-BAD9-44D7-80C5-6017EDEA7E14}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs index 585201a..e1a69d6 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.comboBoxPackage = new System.Windows.Forms.ComboBox(); this.textBoxCount = new System.Windows.Forms.TextBox(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs index 7767d69..b7ac619 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormCreateOrder.cs @@ -12,7 +12,7 @@ namespace SoftwareInstallationView private readonly IOrderLogic _logicO; public FormCreateOrder(ILogger logger, IPackageLogic logicP, IOrderLogic logicO) { - InitializeComponent(); + InitializeSoftware(); _logger = logger; _logicP = logicP; _logicO = logicO; diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs index bf25c66..a850436 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.dataGridView = new System.Windows.Forms.DataGridView(); this.buttonCreateOrder = new System.Windows.Forms.Button(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormMain.cs b/SoftwareInstallation/SoftwareInstallation/FormMain.cs index 7151148..0113608 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormMain.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormMain.cs @@ -21,7 +21,7 @@ namespace SoftwareInstallationView public FormMain(ILogger logger, IOrderLogic orderLogic) { - InitializeComponent(); + InitializeSoftware(); _logger = logger; _orderLogic = orderLogic; } diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs index edd7ce3..db57d10 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackage.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxPrice = new System.Windows.Forms.TextBox(); @@ -201,7 +201,7 @@ this.groupBoxSoftware.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); - + this.Load += new System.EventHandler(this.FormPackage_Load); } #endregion diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackage.cs b/SoftwareInstallation/SoftwareInstallation/FormPackage.cs index 0bc945a..64ed87d 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackage.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackage.cs @@ -17,7 +17,7 @@ namespace SoftwareInstallationView public FormPackage(ILogger logger, IPackageLogic logic) { - InitializeComponent(); + InitializeSoftware(); _logger = logger; _logic = logic; _packageSoftwares = new Dictionary(); @@ -189,6 +189,7 @@ namespace SoftwareInstallationView Id = _id ?? 0, PackageName = textBoxName.Text, Price = Convert.ToDouble(textBoxPrice.Text), + PackageSoftware = _packageSoftwares }; var operationResult = _id.HasValue ? _logic.Update(model) : _logic.Create(model); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs index e6e5ead..129e20e 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.textBox1 = new System.Windows.Forms.TextBox(); this.comboBoxSoftware = new System.Windows.Forms.ComboBox(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs index 0374af1..9ae7451 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackageSoftware.cs @@ -46,7 +46,7 @@ namespace SoftwareInstallationView public FormPackageSoftware(ISoftwareLogic logic) { - InitializeComponent(); + InitializeSoftware(); _list = logic.ReadList(null); if (_list != null) { diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs index e1bb352..66e6372 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackages.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.dataGridView = new System.Windows.Forms.DataGridView(); this.ColumnId = new System.Windows.Forms.DataGridViewTextBoxColumn(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormPackages.cs b/SoftwareInstallation/SoftwareInstallation/FormPackages.cs index acf6220..25e04ed 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormPackages.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormPackages.cs @@ -11,7 +11,7 @@ namespace SoftwareInstallationView private readonly IPackageLogic _logic; public FormPackages(ILogger logger, IPackageLogic logic) { - InitializeComponent(); + InitializeSoftware(); _logger = logger; _logic = logic; LoadData(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs index 3fba4c6..34da41f 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftware.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.textBoxName = new System.Windows.Forms.TextBox(); this.textBoxCost = new System.Windows.Forms.TextBox(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs index 95bf8d3..1e1b2cc 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftware.cs @@ -13,7 +13,7 @@ namespace SoftwareInstallation public int Id { set { _id = value; } } public FormSoftware(ILogger logger, ISoftwareLogic logic) { - InitializeComponent(); + InitializeSoftware(); _logger = logger; _logic = logic; } diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs index a1a85ce..043b06e 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.Designer.cs @@ -5,7 +5,7 @@ /// /// Required designer variable. /// - private System.ComponentModel.IContainer components = null; + private System.ComponentModel.IContainer Softwares = null; /// /// Clean up any resources being used. @@ -13,9 +13,9 @@ /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { - if (disposing && (components != null)) + if (disposing && (Softwares != null)) { - components.Dispose(); + Softwares.Dispose(); } base.Dispose(disposing); } @@ -26,7 +26,7 @@ /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// - private void InitializeComponent() + private void InitializeSoftware() { this.buttonAdd = new System.Windows.Forms.Button(); this.buttonEdit = new System.Windows.Forms.Button(); diff --git a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs index cffd2b8..c7d456f 100644 --- a/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs +++ b/SoftwareInstallation/SoftwareInstallation/FormSoftwares.cs @@ -9,7 +9,7 @@ namespace SoftwareInstallationView { public FormSoftwares(ILogger logger, ISoftwareLogic logic) { - InitializeComponent(); + InitializeSoftware(); _logger = logger; _logic = logic; LoadData(); diff --git a/SoftwareInstallation/SoftwareInstallation/Program.cs b/SoftwareInstallation/SoftwareInstallation/Program.cs index 1b6b0b8..cf7b6fb 100644 --- a/SoftwareInstallation/SoftwareInstallation/Program.cs +++ b/SoftwareInstallation/SoftwareInstallation/Program.cs @@ -1,4 +1,4 @@ -using AbstractSoftwareInstallationFileImplement.Implements; +using AbstractSoftwareInstallationDatabaseImplement.Implements; using AbstractSoftwareInstallationBusinessLogic; using AbstractSoftwareInstallationBusinessLogic.BusinessLogic; using AbstractSoftwareInstallationContracts.BusinessLogicsContracts; diff --git a/SoftwareInstallation/SoftwareInstallation/SoftwareInstallationView.csproj b/SoftwareInstallation/SoftwareInstallation/SoftwareInstallationView.csproj index e5ca85c..9b0ae37 100644 --- a/SoftwareInstallation/SoftwareInstallation/SoftwareInstallationView.csproj +++ b/SoftwareInstallation/SoftwareInstallation/SoftwareInstallationView.csproj @@ -21,6 +21,7 @@ +