lab1 hard

This commit is contained in:
aleksandr chegodaev 2024-06-16 21:52:02 +04:00
commit d1ab88d0e7
10 changed files with 83 additions and 142 deletions

View File

@ -28,21 +28,20 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.menuStrip1 = new System.Windows.Forms.MenuStrip(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
this.toolStripMenuItemCatalogs = new System.Windows.Forms.ToolStripMenuItem(); toolStrip1 = new ToolStrip();
this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); toolStripDropDownButton1 = new ToolStripDropDownButton();
this.пакетыДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); компонентыToolStripMenuItem = new ToolStripMenuItem();
this.dataGridView = new System.Windows.Forms.DataGridView(); ПутёвкиToolStripMenuItem = new ToolStripMenuItem();
this.buttonCreateOrder = new System.Windows.Forms.Button(); buttonCreateOrder = new Button();
this.buttonTakeOrderInWork = new System.Windows.Forms.Button(); buttonTakeOrderInWork = new Button();
this.buttonOrderReady = new System.Windows.Forms.Button(); buttonOrderReady = new Button();
this.buttonIssuedOrder = new System.Windows.Forms.Button(); buttonIssuedOrder = new Button();
this.buttonRef = new System.Windows.Forms.Button(); buttonRef = new Button();
this.магазиныToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); dataGridView = new DataGridView();
this.buttonSupplyShop = new System.Windows.Forms.Button(); toolStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); SuspendLayout();
this.SuspendLayout();
// //
// menuStrip1 // menuStrip1
// //
@ -56,13 +55,13 @@
// //
// toolStripMenuItemCatalogs // toolStripMenuItemCatalogs
// //
this.toolStripMenuItemCatalogs.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { toolStripDropDownButton1.DisplayStyle = ToolStripItemDisplayStyle.Text;
this.компонентыToolStripMenuItem, toolStripDropDownButton1.DropDownItems.AddRange(new ToolStripItem[] { компонентыToolStripMenuItem, ПутёвкиToolStripMenuItem });
this.пакетыДокументовToolStripMenuItem, toolStripDropDownButton1.Image = (Image)resources.GetObject("toolStripDropDownButton1.Image");
this.магазиныToolStripMenuItem}); toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
this.toolStripMenuItemCatalogs.Name = "toolStripMenuItemCatalogs"; toolStripDropDownButton1.Name = "toolStripDropDownButton1";
this.toolStripMenuItemCatalogs.Size = new System.Drawing.Size(94, 20); toolStripDropDownButton1.Size = new Size(88, 22);
this.toolStripMenuItemCatalogs.Text = "Справочники"; toolStripDropDownButton1.Text = "Справочник";
// //
// компонентыToolStripMenuItem // компонентыToolStripMenuItem
// //
@ -129,54 +128,46 @@
// //
// buttonRef // buttonRef
// //
this.buttonRef.Location = new System.Drawing.Point(742, 158); buttonRef.Location = new Point(800, 222);
this.buttonRef.Name = "buttonRef"; buttonRef.Name = "buttonRef";
this.buttonRef.Size = new System.Drawing.Size(156, 23); buttonRef.Size = new Size(141, 24);
this.buttonRef.TabIndex = 6; buttonRef.TabIndex = 5;
this.buttonRef.Text = "Обновить список"; buttonRef.Text = "Обновить список";
this.buttonRef.UseVisualStyleBackColor = true; buttonRef.UseVisualStyleBackColor = true;
this.buttonRef.Click += new System.EventHandler(this.buttonRef_Click); buttonRef.Click += buttonRef_Click;
// //
// магазиныToolStripMenuItem // dataGridView
// //
this.магазиныToolStripMenuItem.Name = агазиныToolStripMenuItem"; dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.магазиныToolStripMenuItem.Size = new System.Drawing.Size(183, 22); dataGridView.Location = new Point(0, 26);
this.магазиныToolStripMenuItem.Text = "Магазины"; dataGridView.Name = "dataGridView";
this.магазиныToolStripMenuItem.Click += new System.EventHandler(this.магазиныToolStripMenuItem_Click); dataGridView.ReadOnly = true;
// dataGridView.RowHeadersWidth = 51;
// buttonSupplyShop dataGridView.RowTemplate.Height = 24;
// dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.buttonSupplyShop.Location = new System.Drawing.Point(742, 187); dataGridView.Size = new Size(763, 435);
this.buttonSupplyShop.Name = "buttonSupplyShop"; dataGridView.TabIndex = 6;
this.buttonSupplyShop.Size = new System.Drawing.Size(156, 23);
this.buttonSupplyShop.TabIndex = 7;
this.buttonSupplyShop.Text = "Пополнение магазина";
this.buttonSupplyShop.UseVisualStyleBackColor = true;
this.buttonSupplyShop.Click += new System.EventHandler(this.buttonSupplyShop_Click);
// //
// FormMain // FormMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(910, 477); ClientSize = new Size(969, 461);
this.Controls.Add(this.buttonSupplyShop); Controls.Add(dataGridView);
this.Controls.Add(this.buttonRef); Controls.Add(buttonRef);
this.Controls.Add(this.buttonIssuedOrder); Controls.Add(buttonIssuedOrder);
this.Controls.Add(this.buttonOrderReady); Controls.Add(buttonOrderReady);
this.Controls.Add(this.buttonTakeOrderInWork); Controls.Add(buttonTakeOrderInWork);
this.Controls.Add(this.buttonCreateOrder); Controls.Add(buttonCreateOrder);
this.Controls.Add(this.dataGridView); Controls.Add(toolStrip1);
this.Controls.Add(this.menuStrip1); Name = "FormMain";
this.MainMenuStrip = this.menuStrip1; Text = "Юридическая фирма";
this.Name = "FormMain"; Load += FormMain_Load;
this.Text = "FormMain"; toolStrip1.ResumeLayout(false);
this.Load += new System.EventHandler(this.FormMain_Load); toolStrip1.PerformLayout();
this.menuStrip1.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
this.menuStrip1.PerformLayout(); ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
} }
#endregion #endregion
@ -191,7 +182,9 @@
private Button buttonOrderReady; private Button buttonOrderReady;
private Button buttonIssuedOrder; private Button buttonIssuedOrder;
private Button buttonRef; private Button buttonRef;
private ToolStripMenuItem магазиныToolStripMenuItem; private DataGridView dataGridView;
private Button buttonSupplyShop; private ToolStripDropDownButton toolStripDropDownButton1;
private ToolStripMenuItem компонентыToolStripMenuItem;
private ToolStripMenuItem ПутёвкиToolStripMenuItem;
} }
} }

View File

@ -164,35 +164,5 @@ namespace LawFirmView
{ {
LoadData(); LoadData();
} }
private OrderBindingModel CreateBindingModel(int id, bool isDone = false)
{
return new OrderBindingModel
{
Id = id,
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
};
}
private void buttonSupplyShop_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShopSupply));
if (service is FormShopSupply form)
{
form.ShowDialog();
}
}
private void магазиныToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
if (service is FormShops form)
{
form.ShowDialog();
}
}
} }
} }

View File

@ -9,17 +9,12 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LawFirmBusinessLogic\LawFirmBusinessLogic.csproj" /> <ProjectReference Include="..\LawFirmBusinessLogic\LawFirmBusinessLogic.csproj" />
<ProjectReference Include="..\LawFirmContracts\LawFirmContracts.csproj" />
<ProjectReference Include="..\LawFirmListImplement\LawFirmListImplement.csproj" /> <ProjectReference Include="..\LawFirmListImplement\LawFirmListImplement.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -36,22 +36,17 @@ namespace LawFirmView
}); });
services.AddTransient<IComponentStorage, ComponentStorage>(); services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>(); services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IDocumentStorage, DocumentStorage>(); services.AddTransient<ILawStorage, LawStorage>();
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>(); services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IDocumentLogic, DocumentLogic>(); services.AddTransient<ILawLogic, LawLogic>();
services.AddTransient<IShopLogic, ShopLogic>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>(); services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>(); services.AddTransient<FormCreateOrder>();
services.AddTransient<FormDocument>(); services.AddTransient<FormLaw>();
services.AddTransient<FormDocumentComponent>(); services.AddTransient<FormLawComponent>();
services.AddTransient<FormDocuments>(); services.AddTransient<FormLaws>();
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormShopSupply>();
} }
} }

View File

@ -7,17 +7,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LawFirmContracts\LawFirmContracts.csproj" /> <ProjectReference Include="..\LawFirmContracts\LawFirmContracts.csproj" />
<ProjectReference Include="..\LawFirmDataModels\LawFirmDataModels.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -6,15 +6,6 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LawFirmDataModels\LawFirmDataModels.csproj" /> <ProjectReference Include="..\LawFirmDataModels\LawFirmDataModels.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -6,9 +6,16 @@ using System.Threading.Tasks;
namespace LawFirmContracts.SearchModels namespace LawFirmContracts.SearchModels
{ {
<<<<<<<< HEAD:LawFirm/LawFirmContracts/SearchModels/ShopSearchModel.cs
public class ShopSearchModel
{
public int? Id { get; set; }
public string? ShopName { get; set; }
========
public class DocumentSearchModel public class DocumentSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? DocumentName { get; set; } public string? DocumentName { get; set; }
>>>>>>>> lab1:LawFirm/LawFirmContracts/SearchModels/DocumentSearchModel.cs
} }
} }

View File

@ -6,9 +6,16 @@ using System.Threading.Tasks;
namespace LawFirmContracts.SearchModels namespace LawFirmContracts.SearchModels
{ {
<<<<<<<< HEAD:LawFirm/LawFirmContracts/SearchModels/ShopSearchModel.cs
public class ShopSearchModel public class ShopSearchModel
{ {
public int? Id { get; set; } public int? Id { get; set; }
public string? ShopName { get; set; } public string? ShopName { get; set; }
========
public class DocumentSearchModel
{
public int? Id { get; set; }
public string? DocumentName { get; set; }
>>>>>>>> lab1:LawFirm/LawFirmContracts/SearchModels/DocumentSearchModel.cs
} }
} }

View File

@ -6,13 +6,4 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
</ItemGroup>
</Project> </Project>

View File

@ -12,14 +12,12 @@ namespace LawFirmListImplement
private static DataListSingleton? _instance; private static DataListSingleton? _instance;
public List<Component> Components { get; set; } public List<Component> Components { get; set; }
public List<Order> Orders { get; set; } public List<Order> Orders { get; set; }
public List<Document> Documents { get; set; } public List<Law> Laws { get; set; }
public List<Shop> Shops { get; set; }
private DataListSingleton() private DataListSingleton()
{ {
Components = new List<Component>(); Components = new List<Component>();
Orders = new List<Order>(); Orders = new List<Order>();
Documents = new List<Document>(); Laws = new List<Law>();
Shops = new List<Shop>();
} }
public static DataListSingleton GetInstance() public static DataListSingleton GetInstance()
{ {