lab1 hard

This commit is contained in:
aleksandr chegodaev 2024-06-16 21:52:07 +04:00
parent d1ab88d0e7
commit 0d47736421
6 changed files with 111 additions and 81 deletions

View File

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

View File

@ -164,5 +164,35 @@ 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

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

View File

@ -6,16 +6,9 @@ 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,16 +6,9 @@ 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

@ -12,12 +12,14 @@ 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<Law> Laws { get; set; } public List<Document> Documents { 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>();
Laws = new List<Law>(); Documents = new List<Document>();
Shops = new List<Shop>();
} }
public static DataListSingleton GetInstance() public static DataListSingleton GetInstance()
{ {