Compare commits

...

2 Commits

Author SHA1 Message Date
3b6e90b6f6 // 2023-09-08 08:44:01 +04:00
33556278cf . 2023-09-08 08:44:01 +04:00
23 changed files with 347 additions and 244 deletions

3
.gitignore vendored
View File

@ -14,6 +14,9 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# dll files
*.dll
# Mono auto generated files
mono_crash.*

View File

@ -20,5 +20,7 @@ namespace AbstractSoftwareInstallationContracts.BindingModels
public string Subject { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty;
}
public int Id => throw new NotImplementedException();
}
}

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace AbstractSoftwareInstallationContracts.DI
{
public class ServiceProviderLoader
public static partial class ServiceProviderLoader
{
/// Загрузка всех классов-реализаций IImplementationExtension
public static IImplementationExtension? GetImplementationExtensions()

View File

@ -1,16 +1,12 @@
using AbstractSoftwareInstallationDataModels.Models;
using System.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AbstractSoftwareInstallationContracts.Attributes;
using AbstractSoftwareInstallationContracts.Attributes;
using AbstractSoftwareInstallationDataModels.Models;
namespace AbstractSoftwareInstallationContracts.ViewModels
{
public class PackageViewModel : IPackageModel
{
[Column(visible: false)]
public int ColumnId { get; set; }
[Column(visible: false)]
public int Id { get; set; }
[Column("Имя пакета", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]

View File

@ -1,16 +1,14 @@
using AbstractSoftwareInstallationDataModels.Models;
using System.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using AbstractSoftwareInstallationContracts.Attributes;
using AbstractSoftwareInstallationDataModels.Models;
namespace AbstractSoftwareInstallationContracts.ViewModels
{
public class SoftwareViewModel : ISoftwareModel
{
[Column(visible: false)]
public int ColumnId { get; set; }
[Column(visible: false)]
public int Id { get; set; }
[Column("Название ПО", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace AbstractSoftwareInstallationDataModels.Models
{
public interface IMessageInfoModel
public interface IMessageInfoModel : IId
{
string MessageId { get; }
int? ClientId { get; }

View File

@ -16,7 +16,7 @@ optionsBuilder)
{
if (optionsBuilder.IsConfigured == false)
{
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-QA8P9OJ;Initial Catalog=SoftwareInstallation1;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
optionsBuilder.UseSqlServer(@"Data Source=DANYAXREN\SQLEXPRESS;Initial Catalog=SoftwareInstallation1;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
}
base.OnConfiguring(optionsBuilder);
}

View File

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

View File

@ -56,5 +56,7 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
SenderName = SenderName,
DateDelivery = DateDelivery,
};
}
public int Id => throw new NotImplementedException();
}
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@ -11,4 +11,8 @@
<ProjectReference Include="..\AbstractSoftwareInstallationDataModels\AbstractSoftwareInstallationDataModels.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project>

View File

@ -10,7 +10,7 @@ namespace AbstractSoftwareInstallationFileImplement
private readonly string SoftwareFileName = "Software.xml";
private readonly string OrderFileName = "Order.xml";
private readonly string PackageFileName = "Package.xml";
private readonly string ClientFileName = "Package.xml";
private readonly string ClientFileName = "Client.xml";
private readonly string ImplementerFileName = "Implementer.xml";
private readonly string MessageFileName = "Message.xml";
public List<Software> Softwares { get; private set; }

View File

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

View File

@ -0,0 +1,112 @@
using AbstractSoftwareInstallationContracts.BindingModels;
using AbstractSoftwareInstallationContracts.SearchModels;
using AbstractSoftwareInstallationContracts.StoragesContracts;
using AbstractSoftwareInstallationContracts.ViewModels;
using AbstractSoftwareInstallationListImplement.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AbstractSoftwareInstallationListImplement.Implements
{
public class ImplementerStorage : IImplementerStorage
{
private readonly DataListSingleton _source;
public ImplementerStorage()
{
_source = DataListSingleton.GetInstance();
}
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
{
foreach (var x in _source.Implementers)
{
if (model.Id.HasValue && x.Id == model.Id)
return x.GetViewModel;
if (model.ImplementerFIO != null && model.Password != null &&
x.ImplementerFIO.Equals(model.ImplementerFIO) && x.Password.Equals(model.Password))
return x.GetViewModel;
if (model.ImplementerFIO != null && x.ImplementerFIO.Equals(model.ImplementerFIO))
return x.GetViewModel;
}
return null;
}
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
{
if (model == null)
{
return new();
}
List<ImplementerViewModel> list = new();
if (model.ImplementerFIO != null)
{
foreach (var implementer in _source.Implementers)
{
if (implementer.ImplementerFIO.Contains(model.ImplementerFIO))
{
list.Add(implementer.GetViewModel);
}
}
}
return list;
}
public List<ImplementerViewModel> GetFullList()
{
var result = new List<ImplementerViewModel>();
foreach (var implementer in _source.Implementers)
{
result.Add(implementer.GetViewModel);
}
return result;
}
public ImplementerViewModel? Insert(ImplementerBindingModel model)
{
model.Id = 1;
foreach (var implementer in _source.Implementers)
{
if (model.Id <= implementer.Id)
{
model.Id = implementer.Id + 1;
}
}
var res = Implementer.Create(model);
if (res != null)
{
_source.Implementers.Add(res);
}
return res?.GetViewModel;
}
public ImplementerViewModel? Update(ImplementerBindingModel model)
{
foreach (var implementer in _source.Implementers)
{
if (implementer.Id == model.Id)
{
implementer.Update(model);
return implementer.GetViewModel;
}
}
return null;
}
public ImplementerViewModel? Delete(ImplementerBindingModel model)
{
for (int i = 0; i < _source.Implementers.Count; ++i)
{
if (_source.Implementers[i].Id == model.Id)
{
var element = _source.Implementers[i];
_source.Implementers.RemoveAt(i);
return element.GetViewModel;
}
}
return null;
}
}
}

View File

@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace AbstractSoftwareInstallationListImplement
{
public class FileImplementationExtension : IImplementationExtension
public class ListImplementationExtension : IImplementationExtension
{
public int Priority => 1;

View File

@ -1,4 +1,5 @@
using SoftwareInstallation;

using SoftwareInstallation;
namespace SoftwareInstallationView
{
@ -30,192 +31,187 @@ namespace SoftwareInstallationView
/// </summary>
private void InitializeComponent()
{
this.dataGridView = new System.Windows.Forms.DataGridView();
this.buttonCreateOrder = new System.Windows.Forms.Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button();
this.buttonRef = new System.Windows.Forms.Button();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.guideToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.packageToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.storageToolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.clientToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.implementerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.reportsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.packagesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.packageSoftwaresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.startWorksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.бэкапToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
dataGridView = new DataGridView();
buttonCreateOrder = new Button();
buttonIssuedOrder = new Button();
buttonRef = new Button();
menuStrip1 = new MenuStrip();
guideToolStripMenuItem = new ToolStripMenuItem();
packageToolStripMenuItem2 = new ToolStripMenuItem();
storageToolStripMenuItem3 = new ToolStripMenuItem();
clientToolStripMenuItem = new ToolStripMenuItem();
implementerToolStripMenuItem = new ToolStripMenuItem();
письмаToolStripMenuItem = new ToolStripMenuItem();
reportsToolStripMenuItem = new ToolStripMenuItem();
packagesToolStripMenuItem = new ToolStripMenuItem();
packageSoftwaresToolStripMenuItem = new ToolStripMenuItem();
ordersToolStripMenuItem = new ToolStripMenuItem();
startWorksToolStripMenuItem = new ToolStripMenuItem();
бэкапToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip1.SuspendLayout();
SuspendLayout();
//
// dataGridView
//
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(1, 31);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(890, 230);
this.dataGridView.TabIndex = 0;
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(1, 41);
dataGridView.Margin = new Padding(3, 4, 3, 4);
dataGridView.Name = "dataGridView";
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(1017, 307);
dataGridView.TabIndex = 0;
//
// buttonCreateOrder
//
this.buttonCreateOrder.Location = new System.Drawing.Point(915, 31);
this.buttonCreateOrder.Name = "buttonCreateOrder";
this.buttonCreateOrder.Size = new System.Drawing.Size(153, 23);
this.buttonCreateOrder.TabIndex = 2;
this.buttonCreateOrder.Text = "Создать заказ";
this.buttonCreateOrder.UseVisualStyleBackColor = true;
this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click);
buttonCreateOrder.Location = new Point(1046, 41);
buttonCreateOrder.Margin = new Padding(3, 4, 3, 4);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(175, 31);
buttonCreateOrder.TabIndex = 2;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
buttonCreateOrder.Click += buttonCreateOrder_Click;
//
// buttonIssuedOrder
//
this.buttonIssuedOrder.Location = new System.Drawing.Point(915, 60);
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
this.buttonIssuedOrder.Size = new System.Drawing.Size(153, 23);
this.buttonIssuedOrder.TabIndex = 5;
this.buttonIssuedOrder.Text = "Заказ выдан";
this.buttonIssuedOrder.UseVisualStyleBackColor = true;
this.buttonIssuedOrder.Click += new System.EventHandler(this.buttonIssuedOrder_Click);
buttonIssuedOrder.Location = new Point(1046, 80);
buttonIssuedOrder.Margin = new Padding(3, 4, 3, 4);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(175, 31);
buttonIssuedOrder.TabIndex = 5;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
buttonIssuedOrder.Click += buttonIssuedOrder_Click;
//
// buttonRef
//
this.buttonRef.Location = new System.Drawing.Point(915, 89);
this.buttonRef.Name = "buttonRef";
this.buttonRef.Size = new System.Drawing.Size(153, 23);
this.buttonRef.TabIndex = 6;
this.buttonRef.Text = "Обновить список";
this.buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.buttonRef_Click);
buttonRef.Location = new Point(1046, 119);
buttonRef.Margin = new Padding(3, 4, 3, 4);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(175, 31);
buttonRef.TabIndex = 6;
buttonRef.Text = "Обновить список";
buttonRef.UseVisualStyleBackColor = true;
buttonRef.Click += buttonRef_Click;
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.guideToolStripMenuItem,
this.reportsToolStripMenuItem,
this.startWorksToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1098, 24);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "Справочники";
menuStrip1.ImageScalingSize = new Size(20, 20);
menuStrip1.Items.AddRange(new ToolStripItem[] { guideToolStripMenuItem, reportsToolStripMenuItem, startWorksToolStripMenuItem, бэкапToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new Padding(7, 3, 0, 3);
menuStrip1.Size = new Size(1255, 30);
menuStrip1.TabIndex = 1;
menuStrip1.Text = "Справочники";
//
// guideToolStripMenuItem
//
this.guideToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.packageToolStripMenuItem2,
this.storageToolStripMenuItem3,
this.clientToolStripMenuItem,
this.implementerToolStripMenuItem,
this.письмаToolStripMenuItem,
this.бэкапToolStripMenuItem});
this.guideToolStripMenuItem.Name = "guideToolStripMenuItem";
this.guideToolStripMenuItem.Size = new System.Drawing.Size(94, 20);
this.guideToolStripMenuItem.Text = "Справочники";
guideToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { packageToolStripMenuItem2, storageToolStripMenuItem3, clientToolStripMenuItem, implementerToolStripMenuItem, письмаToolStripMenuItem });
guideToolStripMenuItem.Name = "guideToolStripMenuItem";
guideToolStripMenuItem.Size = new Size(117, 24);
guideToolStripMenuItem.Text = "Справочники";
//
// packageToolStripMenuItem2
//
this.packageToolStripMenuItem2.Name = "packageToolStripMenuItem2";
this.packageToolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
this.packageToolStripMenuItem2.Text = "Пакеты";
this.packageToolStripMenuItem2.Click += new System.EventHandler(this.packageToolStripMenuItem_Click);
packageToolStripMenuItem2.Name = "packageToolStripMenuItem2";
packageToolStripMenuItem2.Size = new Size(224, 26);
packageToolStripMenuItem2.Text = "Пакеты";
packageToolStripMenuItem2.Click += packageToolStripMenuItem_Click;
//
// storageToolStripMenuItem3
//
this.storageToolStripMenuItem3.Name = "storageToolStripMenuItem3";
this.storageToolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
this.storageToolStripMenuItem3.Text = "ПО";
this.storageToolStripMenuItem3.Click += new System.EventHandler(this.softwareToolStripMenuItem_Click);
storageToolStripMenuItem3.Name = "storageToolStripMenuItem3";
storageToolStripMenuItem3.Size = new Size(224, 26);
storageToolStripMenuItem3.Text = "ПО";
storageToolStripMenuItem3.Click += softwareToolStripMenuItem_Click;
//
// clientToolStripMenuItem
//
this.clientToolStripMenuItem.Name = "clientToolStripMenuItem";
this.clientToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.clientToolStripMenuItem.Text = "Клиенты";
this.clientToolStripMenuItem.Click += new System.EventHandler(this.clientToolStripMenuItem_Click);
clientToolStripMenuItem.Name = "clientToolStripMenuItem";
clientToolStripMenuItem.Size = new Size(224, 26);
clientToolStripMenuItem.Text = "Клиенты";
clientToolStripMenuItem.Click += clientToolStripMenuItem_Click;
//
// implementerToolStripMenuItem
//
this.implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
this.implementerToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.implementerToolStripMenuItem.Text = "Исполнитель";
this.implementerToolStripMenuItem.Click += new System.EventHandler(this.implementerToolStripMenuItem_Click);
implementerToolStripMenuItem.Name = "implementerToolStripMenuItem";
implementerToolStripMenuItem.Size = new Size(224, 26);
implementerToolStripMenuItem.Text = "Исполнитель";
implementerToolStripMenuItem.Click += implementerToolStripMenuItem_Click;
//
// письмаToolStripMenuItem
//
this.письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
this.письмаToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.письмаToolStripMenuItem.Text = "Письма";
this.письмаToolStripMenuItem.Click += new System.EventHandler(this.mailsToolStripMenuItem_Click);
письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
письмаToolStripMenuItem.Size = new Size(224, 26);
письмаToolStripMenuItem.Text = "Письма";
письмаToolStripMenuItem.Click += mailsToolStripMenuItem_Click;
//
// reportsToolStripMenuItem
//
this.reportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.packagesToolStripMenuItem,
this.packageSoftwaresToolStripMenuItem,
this.ordersToolStripMenuItem});
this.reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
this.reportsToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.reportsToolStripMenuItem.Text = "Отчеты";
reportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { packagesToolStripMenuItem, packageSoftwaresToolStripMenuItem, ordersToolStripMenuItem });
reportsToolStripMenuItem.Name = "reportsToolStripMenuItem";
reportsToolStripMenuItem.Size = new Size(73, 24);
reportsToolStripMenuItem.Text = "Отчеты";
//
// packagesToolStripMenuItem
//
this.packagesToolStripMenuItem.Name = "packagesToolStripMenuItem";
this.packagesToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.packagesToolStripMenuItem.Text = "Список пакетов";
this.packagesToolStripMenuItem.Click += new System.EventHandler(this.packagesToolStripMenuItem_Click);
packagesToolStripMenuItem.Name = "packagesToolStripMenuItem";
packagesToolStripMenuItem.Size = new Size(201, 26);
packagesToolStripMenuItem.Text = "Список пакетов";
packagesToolStripMenuItem.Click += packagesToolStripMenuItem_Click;
//
// packageSoftwaresToolStripMenuItem
//
this.packageSoftwaresToolStripMenuItem.Name = "packageSoftwaresToolStripMenuItem";
this.packageSoftwaresToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.packageSoftwaresToolStripMenuItem.Text = "ПО по пакетам";
this.packageSoftwaresToolStripMenuItem.Click += new System.EventHandler(this.packageSoftwaresToolStripMenuItem_Click);
packageSoftwaresToolStripMenuItem.Name = "packageSoftwaresToolStripMenuItem";
packageSoftwaresToolStripMenuItem.Size = new Size(201, 26);
packageSoftwaresToolStripMenuItem.Text = "ПО по пакетам";
packageSoftwaresToolStripMenuItem.Click += packageSoftwaresToolStripMenuItem_Click;
//
// ordersToolStripMenuItem
//
this.ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
this.ordersToolStripMenuItem.Size = new System.Drawing.Size(161, 22);
this.ordersToolStripMenuItem.Text = "Список заказов";
this.ordersToolStripMenuItem.Click += new System.EventHandler(this.ordersToolStripMenuItem_Click);
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
ordersToolStripMenuItem.Size = new Size(201, 26);
ordersToolStripMenuItem.Text = "Список заказов";
ordersToolStripMenuItem.Click += ordersToolStripMenuItem_Click;
//
// startWorksToolStripMenuItem
//
this.startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem";
this.startWorksToolStripMenuItem.Size = new System.Drawing.Size(92, 20);
this.startWorksToolStripMenuItem.Text = "Запуск работ";
this.startWorksToolStripMenuItem.Click += new System.EventHandler(this.startWorksToolStripMenuItem_Click);
startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem";
startWorksToolStripMenuItem.Size = new Size(114, 24);
startWorksToolStripMenuItem.Text = "Запуск работ";
startWorksToolStripMenuItem.Click += startWorksToolStripMenuItem_Click;
//
// бэкапToolStripMenuItem
//
this.бэкапToolStripMenuItem.Name = "бэкапToolStripMenuItem";
this.бэкапToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.бэкапToolStripMenuItem.Text = "Бэкап";
this.бэкапToolStripMenuItem.Click += new System.EventHandler(this.CreateBackupStripMenuItem_Click);
бэкапToolStripMenuItem.Name = "бэкапToolStripMenuItem";
бэкапToolStripMenuItem.Size = new Size(63, 24);
бэкапToolStripMenuItem.Text = "Бэкап";
бэкапToolStripMenuItem.Click += CreateBackupStripMenuItem_Click;
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1098, 263);
this.Controls.Add(this.buttonRef);
this.Controls.Add(this.buttonIssuedOrder);
this.Controls.Add(this.buttonCreateOrder);
this.Controls.Add(this.dataGridView);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMain";
this.Text = "Магазин программного обеспечения";
this.Load += new System.EventHandler(this.FormMain_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1255, 351);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonCreateOrder);
Controls.Add(dataGridView);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Margin = new Padding(3, 4, 3, 4);
Name = "FormMain";
Text = "Магазин программного обеспечения";
Load += FormMain_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion

View File

@ -39,10 +39,11 @@ namespace SoftwareInstallationView
}
private void LoadData()
{
_logger.LogInformation("Загрузка заказов");
try
{
dataGridView.FillAndConfigGrid(_orderLogic.ReadList(null));
_logger.LogInformation("Загрузка заказов");
}
catch (Exception ex)
{
@ -58,7 +59,7 @@ namespace SoftwareInstallationView
form.ShowDialog();
LoadData();
}
private void buttonIssuedOrder_Click(object sender, EventArgs e)
{
if (dataGridView.SelectedRows.Count == 1)
@ -93,7 +94,7 @@ namespace SoftwareInstallationView
}
private void packageToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormPackage>();
var form = DependencyManager.Instance.Resolve<FormPackages>();
form.ShowDialog();
}
@ -117,6 +118,16 @@ namespace SoftwareInstallationView
{
var form = DependencyManager.Instance.Resolve<FormPackages>();
form.ShowDialog();
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SavePackagesToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void clientToolStripMenuItem_Click(object sender, EventArgs e)
@ -133,7 +144,7 @@ namespace SoftwareInstallationView
{
var form = DependencyManager.Instance.Resolve<FormImplementers>();
form.ShowDialog();
}
}
private void startWorksToolStripMenuItem_Click(object sender, EventArgs e)
{
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>(), _orderLogic);

View File

@ -1,5 +1,6 @@
using AbstractSoftwareInstallationContracts.BindingModels;
using AbstractSoftwareInstallationContracts.BusinessLogicsContracts;
using AbstractSoftwareInstallationContracts.DI;
using AbstractSoftwareInstallationContracts.SearchModels;
using AbstractSoftwareInstallationDataModels.Models;
using Microsoft.Extensions.Logging;
@ -79,31 +80,27 @@ namespace SoftwareInstallationView
private void buttonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormPackageSoftware));
if (service is FormPackageSoftware form)
var form = DependencyManager.Instance.Resolve<FormPackageSoftware>();
if (form.ShowDialog() == DialogResult.OK)
{
if (form.ShowDialog() == DialogResult.OK)
if (form.SoftwareModel == null)
{
if (form.SoftwareModel == null)
{
return;
}
_logger.LogInformation("Добавление нового ПО: { SoftwareName} - { Count}", form.SoftwareModel.SoftwareName, form.Count);
if (_packageSoftwares.ContainsKey(form.Id))
{
_packageSoftwares[form.Id] = (form.SoftwareModel, form.Count);
}
else
{
_packageSoftwares.Add(form.Id, (form.SoftwareModel, form.Count));
}
LoadData();
return;
}
_logger.LogInformation("Добавление нового ПО: { SoftwareName} - { Count}", form.SoftwareModel.SoftwareName, form.Count);
if (_packageSoftwares.ContainsKey(form.Id))
{
_packageSoftwares[form.Id] = (form.SoftwareModel, form.Count);
}
else
{
_packageSoftwares.Add(form.Id, (form.SoftwareModel, form.Count));
}
LoadData();
}
}
@ -111,25 +108,22 @@ namespace SoftwareInstallationView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormPackageSoftware));
var form = DependencyManager.Instance.Resolve<FormPackageSoftware>();
if (service is FormPackageSoftware form)
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
form.Id = id;
form.Count = _packageSoftwares[id].Item2;
if (form.ShowDialog() == DialogResult.OK)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
form.Id = id;
form.Count = _packageSoftwares[id].Item2;
if (form.ShowDialog() == DialogResult.OK)
if (form.SoftwareModel == null)
{
if (form.SoftwareModel == null)
{
return;
}
_logger.LogInformation("Изменение ПО: { SoftwareName} - { Count}", form.SoftwareModel.SoftwareName, form.Count);
_packageSoftwares[form.Id] = (form.SoftwareModel, form.Count);
LoadData();
return;
}
_logger.LogInformation("Изменение ПО: { SoftwareName} - { Count}", form.SoftwareModel.SoftwareName, form.Count);
_packageSoftwares[form.Id] = (form.SoftwareModel, form.Count);
LoadData();
}
}
}

View File

@ -111,6 +111,7 @@
this.Text = "FormPackages";
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);
this.Load += new System.EventHandler(this.FormPackages_Load);
}

View File

@ -1,5 +1,6 @@
using AbstractSoftwareInstallationContracts.BindingModels;
using AbstractSoftwareInstallationContracts.BusinessLogicsContracts;
using AbstractSoftwareInstallationContracts.DI;
using Microsoft.Extensions.Logging;
using SoftwareInstallation;
@ -14,7 +15,6 @@ namespace SoftwareInstallationView
InitializeComponent();
_logger = logger;
_logic = logic;
LoadData();
}
private void FormPackages_Load(object sender, EventArgs e)
{
@ -24,14 +24,7 @@ namespace SoftwareInstallationView
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["PackageName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
dataGridView.Columns["PackageSoftware"].Visible = false;
}
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
_logger.LogInformation("Загрузка пакетов");
}
catch (Exception ex)
@ -42,14 +35,10 @@ namespace SoftwareInstallationView
}
private void ButtonAdd_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormPackage));
if (service is FormPackage form)
var form = DependencyManager.Instance.Resolve<FormPackage>();
if (form.ShowDialog() == DialogResult.OK)
{
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
LoadData();
}
}
private void ButtonUpd_Click(object sender, EventArgs e)
@ -90,16 +79,13 @@ namespace SoftwareInstallationView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormPackage));
var form = DependencyManager.Instance.Resolve<FormPackage>();
if (service is FormPackage form)
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
LoadData();
}
}
}

View File

@ -109,6 +109,7 @@
this.Controls.Add(this.buttonAdd);
this.Name = "FormSoftwares";
this.Text = "Программные обеспечения";
this.Load += new System.EventHandler(this.FormSoftwares_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
this.ResumeLayout(false);

View File

@ -1,6 +1,7 @@
using AbstractSoftwareInstallationContracts.BindingModels;
using AbstractSoftwareInstallationContracts.BusinessLogicsContracts;
using AbstractSoftwareInstallationContracts.DI;
using AbstractSoftwareInstallationContracts.ViewModels;
using Microsoft.Extensions.Logging;
using SoftwareInstallation;
@ -13,7 +14,8 @@ namespace SoftwareInstallationView
public FormSoftwares(ILogger<FormSoftwares> logger, ISoftwareLogic logic)
{
InitializeComponent();
LoadData();
_logger = logger;
_logic = logic;
}
private void FormSoftwares_Load(object sender, EventArgs e)
@ -79,16 +81,13 @@ namespace SoftwareInstallationView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSoftware));
var form = DependencyManager.Instance.Resolve<FormSoftware>();
if (service is FormSoftware form)
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK)
{
LoadData();
}
LoadData();
}
}
}

View File

@ -1,4 +1,3 @@
using AbstractSoftwareInstallationDatabaseImplement.Implements;
using AbstractSoftwareInstallationBusinessLogic;
using AbstractSoftwareInstallationBusinessLogic.BusinessLogic;
using AbstractSoftwareInstallationContracts.BusinessLogicsContracts;
@ -17,10 +16,6 @@ namespace SoftwareInstallation
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
/// <summary>
/// The main entry point for the application.
/// </summary>
@ -54,21 +49,15 @@ namespace SoftwareInstallation
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
}
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
private static void InitDependency()
{
DependencyManager.InitDependency();
DependencyManager.Instance.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
DependencyManager.Instance.RegisterType<ISoftwareStorage, SoftwareStorage>();
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IPackageStorage, PackageStorage>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
@ -82,7 +71,7 @@ namespace SoftwareInstallation
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(isSingle: true);
DependencyManager.Instance.RegisterType<FormMails>();
DependencyManager.Instance.RegisterType<FormImplementers>();

View File

@ -37,6 +37,7 @@
<ProjectReference Include="..\AbstractSoftwareInstallationBusinessLogic\AbstractSoftwareInstallationBusinessLogic.csproj" />
<ProjectReference Include="..\AbstractSoftwareInstallationContracts\AbstractSoftwareInstallationContracts.csproj" />
<ProjectReference Include="..\AbstractSoftwareInstallationDatabaseImplement\AbstractSoftwareInstallationDatabaseImplement.csproj" />
<ProjectReference Include="..\AbstractSoftwareInstallationFileImplement\AbstractSoftwareInstallationFileImplement.csproj" />
<ProjectReference Include="..\AbstractSoftwareInstallationListImplement\AbstractSoftwareInstallationListImplement.csproj" />
</ItemGroup>