прмежуточный коммит

This commit is contained in:
AnnZhimol 2023-05-05 10:20:32 +04:00
parent 63f11d87c2
commit 2109fcaa73
8 changed files with 56 additions and 428 deletions

View File

@ -2,6 +2,7 @@
using Microsoft.Extensions.Logging;
using System.Windows.Forms;
using SofrwareInstallationContracts.ViewModels;
using SofrwareInstallationContracts.DI;
namespace SoftwareInstallationView
{
@ -84,13 +85,10 @@ namespace SoftwareInstallationView
private void DataGridView_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReplyMail));
if (service is FormReplyMail form)
{
form.MessageId = (string)DataGridView.Rows[e.RowIndex].Cells["MessageId"].Value;
form.ShowDialog();
LoadData();
}
var form = DependencyManager.Instance.Resolve<FormReplyMail>();
form.MessageId = (string)DataGridView.Rows[e.RowIndex].Cells["MessageId"].Value;
form.ShowDialog();
LoadData();
}
}
}

View File

@ -1,6 +1,8 @@
using Microsoft.Extensions.Logging;
using SofrwareInstallationContracts.BindingModels;
using SofrwareInstallationContracts.BusinessLogicsContracts;
using SofrwareInstallationContracts.DI;
using System.Windows.Forms;
namespace SoftwareInstallationView
{
@ -24,16 +26,7 @@ namespace SoftwareInstallationView
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
DataGridView.DataSource = list;
DataGridView.Columns["Id"].Visible = false;
DataGridView.Columns["StoreName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
DataGridView.Columns["StorePackages"].Visible = false;
}
DataGridView.FillandConfigGrid(_logic.ReadList(null));
_logger.LogInformation("Загрузка магазинов");
}
@ -83,7 +76,7 @@ namespace SoftwareInstallationView
{
if (DataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormStore));
var service = DependencyManager.Instance.Resolve<FormStore>();
if (service is FormStore form)
{
@ -99,14 +92,10 @@ namespace SoftwareInstallationView
private void AddButton_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormStore));
if (service is FormStore form)
var form = DependencyManager.Instance.Resolve<FormStore>();
if (form.ShowDialog() == DialogResult.OK)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
}
}
}

View File

@ -52,23 +52,6 @@ namespace SoftwareInstallationView
option.AddNLog("nlog.config");
});
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<IPackageLogic, PackageLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IStoreLogic, StoreLogic>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
DependencyManager.Instance.RegisterType<FormMain>();
DependencyManager.Instance.RegisterType<FormComponent>();
DependencyManager.Instance.RegisterType<FormComponents>();

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SoftwareInstallationBusinessLogic.BusinessLogic;
using SoftwareInstallationBusinessLogic.MailWorker;
using SoftwareInstallationBusinessLogic.OfficePackage.Implements;
using SoftwareInstallationBusinessLogic.OfficePackage;
using SofrwareInstallationContracts.BusinessLogicsContracts;
using SofrwareInstallationContracts.DI;
namespace SoftwareInstallationBusinessLogic
{
public class ImplementationBusinessLogicExtension : IImplementationBusinessLogicExtension
{
public int Priority => 0;
public void RegisterServices()
{
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<IPackageLogic, PackageLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
DependencyManager.Instance.RegisterType<IStoreLogic, StoreLogic>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
}
}
}

View File

@ -46,4 +46,8 @@
<ProjectReference Include="..\SofrwareInstallationContracts\SofrwareInstallationContracts.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project>

View File

@ -1,387 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SoftwareInstallationDataBaseImplement;
#nullable disable
namespace SoftwareInstallationDataBaseImplement.Migrations
{
[DbContext(typeof(SoftwareInstallationDataBase))]
partial class SoftwareInstallationDataBaseModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Cost")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Message", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.IsRequired()
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<bool>("HasRead")
.HasColumnType("bit");
b.Property<string>("Reply")
.HasColumnType("nvarchar(max)");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("Messages");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("PackageId")
.HasColumnType("int");
b.Property<string>("PackageName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("PackageId");
b.ToTable("Orders");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Package", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("PackageName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Packages");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.PackageComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("PackageId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("PackageId");
b.ToTable("PackageComponents");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Store", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("OpeningDate")
.HasColumnType("datetime2");
b.Property<int>("PackageMaxCount")
.HasColumnType("int");
b.Property<string>("StoreAdress")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("StoreName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Stores");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.StorePackage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("PackageId")
.HasColumnType("int");
b.Property<int>("StoreId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("PackageId");
b.HasIndex("StoreId");
b.ToTable("StorePackages");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Message", b =>
{
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Client", "Client")
.WithMany("Messages")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Order", b =>
{
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
.WithMany("Orders")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Package");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.PackageComponent", b =>
{
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Component", "Component")
.WithMany("PackageComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
.WithMany("Components")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Package");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.StorePackage", b =>
{
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Package", "Package")
.WithMany("StorePackages")
.HasForeignKey("PackageId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("SoftwareInstallationDataBaseImplement.Models.Store", "Store")
.WithMany("Packages")
.HasForeignKey("StoreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Package");
b.Navigation("Store");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Client", b =>
{
b.Navigation("Messages");
b.Navigation("Orders");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Component", b =>
{
b.Navigation("PackageComponents");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Package", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
b.Navigation("StorePackages");
});
modelBuilder.Entity("SoftwareInstallationDataBaseImplement.Models.Store", b =>
{
b.Navigation("Packages");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -17,6 +17,7 @@ namespace SoftwareInstallationFileImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IPackageStorage, PackageStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IStoreStorage, StoreStorage>();
}
}
}

View File

@ -17,6 +17,7 @@ namespace SoftwareInstallationListImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IPackageStorage, PackageStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IStoreStorage, StoreStorage>();
}
}