lab3 done
This commit is contained in:
parent
5e59750290
commit
4326593e9c
@ -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<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||
|
@ -16,7 +16,7 @@ optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseNpgsql("Host = localhost; Port = 5432; Database = SoftwareInstallation; Username = postgres; Password = postgres");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-QA8P9OJ;Initial Catalog=SogtwareInstallation;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -14,6 +14,19 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
{
|
||||
public class OrderStorage : IOrderStorage
|
||||
{
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
var element = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Orders.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
@ -41,12 +54,16 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Orders.Include(x => x.Package).Select(x => x.GetViewModel).ToList();
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
{
|
||||
var newOrder = Order.Create(model);
|
||||
|
||||
if (newOrder == null)
|
||||
{
|
||||
return null;
|
||||
@ -55,6 +72,7 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return context.Orders.Include(x => x.Package).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel;
|
||||
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -67,19 +85,7 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
return context.Orders.Include(x => x.Package).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
var element = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Orders.Remove(element);
|
||||
context.SaveChanges();
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
return context.Orders.Include(x => x.Package).FirstOrDefault(x => x.Id == order.Id)?.GetViewModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,19 +14,15 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
{
|
||||
public class PackageStorage : IPackageStorage
|
||||
{
|
||||
public PackageViewModel? GetElement(PackageSearchModel model)
|
||||
public List<PackageViewModel> GetFullList()
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PackageName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Packages.Include(x => x.Softwares)
|
||||
.ThenInclude(x => x.Software)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.PackageName) &&
|
||||
x.PackageName == model.PackageName) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
return context.Packages
|
||||
.Include(x => x.Softwares)
|
||||
.ThenInclude(x => x.Software)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<PackageViewModel> GetFilteredList(PackageSearchModel model)
|
||||
@ -37,86 +33,74 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Packages
|
||||
.Include(x => x.Softwares)
|
||||
.ThenInclude(x => x.Software)
|
||||
.Where(x => x.PackageName.Contains(model.PackageName))
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
.Include(x => x.Softwares)
|
||||
.ThenInclude(x => x.Software)
|
||||
.Where(x => x.PackageName.Contains(model.PackageName))
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<PackageViewModel> GetFullList()
|
||||
public PackageViewModel? GetElement(PackageSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.PackageName) &&
|
||||
!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Packages
|
||||
.Include(x => x.Softwares)
|
||||
.ThenInclude(x => x.Software)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
.Include(x => x.Softwares)
|
||||
.ThenInclude(x => x.Software)
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.PackageName)
|
||||
&& x.PackageName == model.PackageName)
|
||||
|| (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public PackageViewModel? Insert(PackageBindingModel model)
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
var newPackage = Package.Create(context, model);
|
||||
if (newPackage == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var newDoc = Package.Create(context, model);
|
||||
if (newDoc == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
context.Packages.Add(newDoc);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return newDoc.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
context.Packages.Add(newPackage);
|
||||
context.SaveChanges();
|
||||
return newPackage.GetViewModel;
|
||||
}
|
||||
|
||||
public PackageViewModel? Update(PackageBindingModel model)
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
using var transaction = context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
try
|
||||
var Package = context.Packages.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (Package == null)
|
||||
{
|
||||
var Package = context.Packages.FirstOrDefault(x => x.Id == model.Id);
|
||||
if (Package == null)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
|
||||
Package.Update(model);
|
||||
Package.UpdateSoftwares(context, model);
|
||||
|
||||
context.SaveChanges();
|
||||
context.Database.CommitTransaction();
|
||||
|
||||
return Package.GetViewModel;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
Package.Update(model);
|
||||
context.SaveChanges();
|
||||
Package.UpdateSoftwares(context, model);
|
||||
transaction.Commit();
|
||||
return Package.GetViewModel;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public PackageViewModel? Delete(PackageBindingModel model)
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
var element = context.Packages.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
var element = context.Packages
|
||||
.Include(x => x.Softwares)
|
||||
.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
if (element != null)
|
||||
{
|
||||
context.Packages.Remove(element);
|
||||
|
@ -13,17 +13,12 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
{
|
||||
public class SoftwareStorage : ISoftwareStorage
|
||||
{
|
||||
public SoftwareViewModel? GetElement(SoftwareSearchModel model)
|
||||
public List<SoftwareViewModel> GetFullList()
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.SoftwareName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Softwares.FirstOrDefault(x =>
|
||||
(!string.IsNullOrEmpty(model.SoftwareName) && x.SoftwareName == model.SoftwareName)
|
||||
|| (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
|
||||
return context.Softwares
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<SoftwareViewModel> GetFilteredList(SoftwareSearchModel model)
|
||||
@ -34,16 +29,23 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Softwares
|
||||
.Where(x => x.SoftwareName.Contains(model.SoftwareName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
.Where(x => x.SoftwareName.Contains(model.SoftwareName))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<SoftwareViewModel> GetFullList()
|
||||
public SoftwareViewModel? GetElement(SoftwareSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.SoftwareName) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Softwares.Select(x => x.GetViewModel).ToList();
|
||||
return context.Softwares
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.SoftwareName)
|
||||
&& x.SoftwareName == model.SoftwareName)
|
||||
|| (model.Id.HasValue && x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public SoftwareViewModel? Insert(SoftwareBindingModel model)
|
||||
@ -57,7 +59,6 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
context.Softwares.Add(newSoftware);
|
||||
context.SaveChanges();
|
||||
return newSoftware.GetViewModel;
|
||||
|
||||
}
|
||||
|
||||
public SoftwareViewModel? Update(SoftwareBindingModel model)
|
||||
@ -72,6 +73,7 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
context.SaveChanges();
|
||||
return Software.GetViewModel;
|
||||
}
|
||||
|
||||
public SoftwareViewModel? Delete(SoftwareBindingModel model)
|
||||
{
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
@ -83,9 +85,6 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
return element.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -3,17 +3,17 @@ using System;
|
||||
using AbstractSoftwareInstallationDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(AbstractSoftwareInstallationDatabase))]
|
||||
[Migration("20230409100744_Initial")]
|
||||
partial class Initial
|
||||
[Migration("20230419141439_Init")]
|
||||
partial class Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@ -21,36 +21,35 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.IsRequired()
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -63,16 +62,16 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PackageName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -83,18 +82,18 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SoftwareId")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -109,16 +108,16 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("SoftwareName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
public partial class Init : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
@ -16,10 +15,10 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
name: "Packages",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PackageName = table.Column<string>(type: "text", nullable: false),
|
||||
Price = table.Column<double>(type: "double precision", nullable: false)
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PackageName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Price = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -30,10 +29,10 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
name: "Softwares",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
SoftwareName = table.Column<string>(type: "text", nullable: false),
|
||||
Cost = table.Column<double>(type: "double precision", nullable: false)
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
SoftwareName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Cost = table.Column<double>(type: "float", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -44,14 +43,14 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
name: "Orders",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PackageId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false),
|
||||
Sum = table.Column<double>(type: "double precision", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PackageId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateImplement = table.Column<DateTime>(type: "datetime2", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
@ -68,11 +67,11 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
name: "PackageSoftwares",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
PackageId = table.Column<int>(type: "integer", nullable: false),
|
||||
SoftwareId = table.Column<int>(type: "integer", nullable: false),
|
||||
Count = table.Column<int>(type: "integer", nullable: false)
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
PackageId = table.Column<int>(type: "int", nullable: false),
|
||||
SoftwareId = table.Column<int>(type: "int", nullable: false),
|
||||
Count = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
@ -3,8 +3,8 @@ using System;
|
||||
using AbstractSoftwareInstallationDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
@ -18,80 +18,79 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.IsRequired()
|
||||
.HasColumnType("timestamp with time zone");
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("double precision");
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.ToTable("Orders", (string)null);
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PackageName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("double precision");
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Packages", (string)null);
|
||||
b.ToTable("Packages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SoftwareId")
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@ -99,27 +98,27 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
|
||||
b.HasIndex("SoftwareId");
|
||||
|
||||
b.ToTable("PackageSoftwares", (string)null);
|
||||
b.ToTable("PackageSoftwares");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
.HasColumnType("int");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("double precision");
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("SoftwareName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Softwares", (string)null);
|
||||
b.ToTable("Softwares");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b =>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using AbstractSoftwareInstallationContracts.BindingModels;
|
||||
using AbstractSoftwareInstallationContracts.ViewModels;
|
||||
using AbstractSoftwareInstallationDatabaseImplement;
|
||||
using AbstractSoftwareInstallationDatabaseImplement.Models;
|
||||
using AbstractSoftwareInstallationDataModels;
|
||||
using AbstractSoftwareInstallationDataModels.Models;
|
||||
@ -43,7 +44,7 @@ namespace AbstractPackageInstallationDatabaseImplement.Models
|
||||
Status = model.Status,
|
||||
DateCreate = model.DateCreate,
|
||||
DateImplement = model.DateImplement,
|
||||
Id = model.Id,
|
||||
Id = model.Id
|
||||
};
|
||||
}
|
||||
|
||||
@ -59,13 +60,13 @@ namespace AbstractPackageInstallationDatabaseImplement.Models
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
PackageId = PackageId,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
Status = Status,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement,
|
||||
Id = Id,
|
||||
Status = Status,
|
||||
PackageName = Package.PackageName
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
using AbstractPackageInstallationDatabaseImplement.Models;
|
||||
using AbstractSoftwareInstallationContracts.BindingModels;
|
||||
using AbstractSoftwareInstallationContracts.ViewModels;
|
||||
using AbstractSoftwareInstallationDatabaseImplement.Models;
|
||||
using AbstractSoftwareInstallationDataModels;
|
||||
using AbstractSoftwareInstallationDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -14,47 +16,50 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
|
||||
{
|
||||
public class Package : IPackageModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
public string PackageName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public double Price { get; set; }
|
||||
private Dictionary<int, (ISoftwareModel, int)>? _PackageSoftwares =
|
||||
null;
|
||||
public double Price { get; private set; }
|
||||
|
||||
private Dictionary<int, (ISoftwareModel, int)>? _packageSoftwares = null;
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<int, (ISoftwareModel, int)> PackageSoftware
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_PackageSoftwares == null)
|
||||
if (_packageSoftwares == null)
|
||||
{
|
||||
_PackageSoftwares = Softwares
|
||||
.ToDictionary(recPC => recPC.SoftwareId, recPC =>
|
||||
(recPC.Software as ISoftwareModel, recPC.Count));
|
||||
_packageSoftwares = Softwares.ToDictionary(recPC => recPC.SoftwareId, recPC => (recPC.Software as ISoftwareModel, recPC.Count));
|
||||
}
|
||||
return _PackageSoftwares;
|
||||
return _packageSoftwares;
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("PackageId")]
|
||||
public virtual List<PackageSoftware> Softwares { get; set; } = new();
|
||||
[ForeignKey("PackageId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
public static Package Create(AbstractSoftwareInstallationDatabase context,
|
||||
PackageBindingModel model)
|
||||
|
||||
|
||||
public static Package? Create(AbstractSoftwareInstallationDatabase context, PackageBindingModel model)
|
||||
{
|
||||
var Softwares = context.Softwares;
|
||||
|
||||
return new Package()
|
||||
{
|
||||
Id = model.Id,
|
||||
PackageName = model.PackageName,
|
||||
Price = model.Price,
|
||||
Softwares = model.PackageSoftware.Select(x => new
|
||||
PackageSoftware
|
||||
Softwares = model.PackageSoftware.Select(x => new PackageSoftware
|
||||
{
|
||||
Software = context.Softwares.First(y => y.Id == x.Key),
|
||||
Count = x.Value.Item2
|
||||
}).ToList()
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(PackageBindingModel model)
|
||||
{
|
||||
PackageName = model.PackageName;
|
||||
@ -67,37 +72,35 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
|
||||
Price = Price,
|
||||
PackageSoftware = PackageSoftware
|
||||
};
|
||||
public void UpdateSoftwares(AbstractSoftwareInstallationDatabase context,
|
||||
PackageBindingModel model)
|
||||
|
||||
public void UpdateSoftwares(AbstractSoftwareInstallationDatabase context, PackageBindingModel model)
|
||||
{
|
||||
var PackageSoftwares = context.PackageSoftwares.Where(rec =>
|
||||
rec.PackageId == model.Id).ToList();
|
||||
if (PackageSoftwares != null && PackageSoftwares.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.PackageSoftwares.RemoveRange(PackageSoftwares.Where(rec
|
||||
=> !model.PackageSoftware.ContainsKey(rec.SoftwareId)));
|
||||
var packageSoftwares = context.PackageSoftwares
|
||||
.Where(rec => rec.PackageId == model.Id).ToList();
|
||||
if (packageSoftwares != null && packageSoftwares.Count > 0)
|
||||
{ // удалили те, которых нет в модели
|
||||
context.PackageSoftwares.RemoveRange(packageSoftwares.Where(rec => !model.PackageSoftware.ContainsKey(rec.SoftwareId)));
|
||||
context.SaveChanges();
|
||||
// обновили количество у существующих записей
|
||||
foreach (var updateSoftware in PackageSoftwares)
|
||||
foreach (var updateSoftware in packageSoftwares)
|
||||
{
|
||||
updateSoftware.Count =
|
||||
model.PackageSoftware[updateSoftware.SoftwareId].Item2;
|
||||
updateSoftware.Count = model.PackageSoftware[updateSoftware.SoftwareId].Item2;
|
||||
model.PackageSoftware.Remove(updateSoftware.SoftwareId);
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
var Package = context.Packages.First(x => x.Id == Id);
|
||||
var package = context.Packages.First(x => x.Id == Id);
|
||||
foreach (var pc in model.PackageSoftware)
|
||||
{
|
||||
context.PackageSoftwares.Add(new PackageSoftware
|
||||
{
|
||||
Package = Package,
|
||||
Package = package,
|
||||
Software = context.Softwares.First(x => x.Id == pc.Key),
|
||||
Count = pc.Value.Item2
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
_PackageSoftwares = null;
|
||||
_packageSoftwares = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,13 +15,12 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public string SoftwareName { get; private set; } = string.Empty;
|
||||
public string SoftwareName { get; private set; } = String.Empty;
|
||||
[Required]
|
||||
public double Cost { get; set; }
|
||||
[ForeignKey("SoftwareId")]
|
||||
public virtual List<PackageSoftware> PackageSoftwares { get; set; } =
|
||||
new();
|
||||
public static Software? Create(SoftwareBindingModel model)
|
||||
public virtual List<PackageSoftware> PackageSoftwares { get; set; } = new();
|
||||
public static Software? Create(SoftwareBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -34,16 +33,7 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
public static Software Create(SoftwareViewModel model)
|
||||
{
|
||||
return new Software
|
||||
{
|
||||
Id = model.Id,
|
||||
SoftwareName = model.SoftwareName,
|
||||
Cost = model.Cost
|
||||
};
|
||||
}
|
||||
public void Update(SoftwareBindingModel model)
|
||||
public void Update(SoftwareBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
|
@ -15,9 +15,7 @@ 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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractShopDatabaseImplement", "AbstractShopDatabaseImplement\AbstractShopDatabaseImplement.csproj", "{208C1A2E-1969-4842-BE32-13FE9A8802B0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbstractSoftwareInstallationDatabaseImplement", "AbstractSoftwareInstallationDatabaseImplement\AbstractSoftwareInstallationDatabaseImplement.csproj", "{7631EF04-BAD9-44D7-80C5-6017EDEA7E14}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AbstractSoftwareInstallationDatabaseImplement", "AbstractSoftwareInstallationDatabaseImplement\AbstractSoftwareInstallationDatabaseImplement.csproj", "{7631EF04-BAD9-44D7-80C5-6017EDEA7E14}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -49,10 +47,6 @@ 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
|
||||
{208C1A2E-1969-4842-BE32-13FE9A8802B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{208C1A2E-1969-4842-BE32-13FE9A8802B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{208C1A2E-1969-4842-BE32-13FE9A8802B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{208C1A2E-1969-4842-BE32-13FE9A8802B0}.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
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.comboBoxPackage = new System.Windows.Forms.ComboBox();
|
||||
this.textBoxCount = new System.Windows.Forms.TextBox();
|
||||
|
@ -12,7 +12,7 @@ namespace SoftwareInstallationView
|
||||
private readonly IOrderLogic _logicO;
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPackageLogic logicP, IOrderLogic logicO)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_logger = logger;
|
||||
_logicP = logicP;
|
||||
_logicO = logicO;
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||
|
@ -21,7 +21,7 @@ namespace SoftwareInstallationView
|
||||
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||
this.textBoxPrice = new System.Windows.Forms.TextBox();
|
||||
|
@ -17,7 +17,7 @@ namespace SoftwareInstallationView
|
||||
|
||||
public FormPackage(ILogger<FormPackage> logger, IPackageLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
_packageSoftwares = new Dictionary<int, (ISoftwareModel, int)>();
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.comboBoxSoftware = new System.Windows.Forms.ComboBox();
|
||||
|
@ -46,7 +46,7 @@ namespace SoftwareInstallationView
|
||||
|
||||
public FormPackageSoftware(ISoftwareLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_list = logic.ReadList(null);
|
||||
if (_list != null)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.ColumnId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
|
@ -11,7 +11,7 @@ namespace SoftwareInstallationView
|
||||
private readonly IPackageLogic _logic;
|
||||
public FormPackages(ILogger<FormPackages> logger, IPackageLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
LoadData();
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.textBoxName = new System.Windows.Forms.TextBox();
|
||||
this.textBoxCost = new System.Windows.Forms.TextBox();
|
||||
|
@ -13,7 +13,7 @@ namespace SoftwareInstallation
|
||||
public int Id { set { _id = value; } }
|
||||
public FormSoftware(ILogger<FormSoftware> logger, ISoftwareLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.ComponentModel.IContainer Softwares = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
@ -13,9 +13,9 @@
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
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.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
private void InitializeSoftware()
|
||||
{
|
||||
this.buttonAdd = new System.Windows.Forms.Button();
|
||||
this.buttonEdit = new System.Windows.Forms.Button();
|
||||
|
@ -9,7 +9,7 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
public FormSoftwares(ILogger<FormSoftwares> logger, ISoftwareLogic logic)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeSoftware();
|
||||
_logger = logger;
|
||||
_logic = logic;
|
||||
LoadData();
|
||||
|
Loading…
Reference in New Issue
Block a user