лпншгпг
This commit is contained in:
commit
79212f9f2a
@ -11,25 +11,24 @@ namespace ShoeStore.Entities;
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int StorageProductId { get; private set; }
|
||||
//public int StorageProductId { get; private set; }
|
||||
public string NameOfShoes { get; private set; }
|
||||
public ManufacturingCompany ManufacturingCompany { get; private set; }
|
||||
public int Price { get; private set; }
|
||||
public ProductType ProductType { get; private set; }
|
||||
public int StorageSize { get; private set; }
|
||||
//public ProductType ProductType { get; private set; }
|
||||
//public int StorageSize { get; private set; }
|
||||
|
||||
public static Product CreateEntity(int id, int storageProductId, string nameOfShoes, ManufacturingCompany manufacturingCompany, int price,
|
||||
ProductType productType, int storageSize)
|
||||
public static Product CreateEntity(int id, string nameOfShoes, ManufacturingCompany manufacturingCompany, int price)
|
||||
{
|
||||
return new Product
|
||||
{
|
||||
Id = id,
|
||||
StorageProductId = storageProductId,
|
||||
//StorageProductId = storageProductId,
|
||||
NameOfShoes = nameOfShoes,
|
||||
ManufacturingCompany = manufacturingCompany,
|
||||
Price = price,
|
||||
ProductType = productType,
|
||||
StorageSize = storageSize
|
||||
//ProductType = productType,
|
||||
//StorageSize = storageSize
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ShoeStore.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -9,24 +10,25 @@ namespace ShoeStore.Entities;
|
||||
public class Receipt
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ProductId { get; private set; }
|
||||
public int StorageProductId { get; private set; }
|
||||
public int ReceiptNumber {get; private set; }
|
||||
//public int ProductId { get; private set; }
|
||||
//public int StorageProductId { get; private set; }
|
||||
//public int ReceiptNumber {get; private set; }
|
||||
public int ProductType { get; private set; }
|
||||
public DateTime DateOfReceipt { get; private set; }
|
||||
public int NumberOfPairsReceived { get; private set; }
|
||||
public int StorageSize { get; private set; }
|
||||
//public int StorageSize { get; private set; }
|
||||
|
||||
public static Receipt CreateOperation(int id, int productId, int storageProductId, int receiptNumber, int numberOfPairsReceived, int storageSize)
|
||||
public static Receipt CreateOperation(int id, int productType, int numberOfPairsReceived)
|
||||
{
|
||||
return new Receipt
|
||||
{
|
||||
Id = id,
|
||||
ProductId = productId,
|
||||
StorageProductId = storageProductId,
|
||||
ReceiptNumber = receiptNumber,
|
||||
ProductType = productType,
|
||||
//StorageProductId = storageProductId,
|
||||
//ReceiptNumber = receiptNumber,
|
||||
DateOfReceipt = DateTime.Now,
|
||||
NumberOfPairsReceived = numberOfPairsReceived,
|
||||
StorageSize = storageSize
|
||||
//StorageSize = storageSize
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ShoeStore.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -9,27 +10,29 @@ namespace ShoeStore.Entities;
|
||||
public class Sale
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ProductId { get; private set; }
|
||||
public int StorageProductId { get; private set; }
|
||||
//public int ProductId { get; private set; }
|
||||
//public int StorageProductId { get; private set; }
|
||||
public DateTime DateOfSale { get; private set; }
|
||||
//public ProductType ProductType { get; private set; }
|
||||
|
||||
public int SalesNumber { get; private set; }
|
||||
public int StorageSize { get; private set; }
|
||||
//public int StorageSize { get; private set; }
|
||||
public IEnumerable<ProductSale> productSales
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
} = [];
|
||||
|
||||
public static Sale CreateOperation (int id, int productId, int storageProductId, int salesNumber, int storageSize)
|
||||
public static Sale CreateOperation (int id, int salesNumber)
|
||||
{
|
||||
return new Sale
|
||||
{
|
||||
Id = id,
|
||||
ProductId = productId,
|
||||
StorageProductId = storageProductId,
|
||||
//ProductType = productType,
|
||||
//StorageProductId = storageProductId,
|
||||
DateOfSale = DateTime.Now,
|
||||
SalesNumber = salesNumber,
|
||||
StorageSize = storageSize
|
||||
//StorageSize = storageSize
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using ShoeStore.Entities;
|
||||
using ShoeStore.Repositories;
|
||||
using ShoeStore.Repositories.Implementations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -40,15 +41,23 @@ public partial class FormEmployee : Form
|
||||
}
|
||||
}
|
||||
|
||||
public FormEmployee()
|
||||
public FormEmployee(IEmployeeRepository employeeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_employeeRepository = employeeRepository ?? throw new ArgumentNullException(nameof(employeeRepository));
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSave_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (numericUpDownNumStorage.Value <= 0 || numericUpDownStorageSize.Value <= 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_employeeId.HasValue)
|
||||
{
|
||||
_employeeRepository.UpdateEmployee(CreateEmployee(_employeeId.Value));
|
||||
|
119
ShoeStore/Forms/FormProduct.Designer.cs
generated
119
ShoeStore/Forms/FormProduct.Designer.cs
generated
@ -28,63 +28,21 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
comboBoxProduct = new ComboBox();
|
||||
comboBoxStorageProductId = new ComboBox();
|
||||
label5 = new Label();
|
||||
numericUpDownPrice = new NumericUpDown();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
comboBoxType = new ComboBox();
|
||||
label6 = new Label();
|
||||
label7 = new Label();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
checkedListBoxManufactoringCompany = new CheckedListBox();
|
||||
textBoxNameShoe = new TextBox();
|
||||
numericUpDownStorage = new NumericUpDown();
|
||||
label1 = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorage).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(24, 38);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(76, 15);
|
||||
label1.TabIndex = 10;
|
||||
label1.Text = "ID Продукта:";
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(244, 38);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(121, 23);
|
||||
comboBoxProduct.TabIndex = 9;
|
||||
//
|
||||
// comboBoxStorageProductId
|
||||
//
|
||||
comboBoxStorageProductId.FormattingEnabled = true;
|
||||
comboBoxStorageProductId.Location = new Point(244, 84);
|
||||
comboBoxStorageProductId.Name = "comboBoxStorageProductId";
|
||||
comboBoxStorageProductId.Size = new Size(121, 23);
|
||||
comboBoxStorageProductId.TabIndex = 16;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(24, 84);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(132, 15);
|
||||
label5.TabIndex = 15;
|
||||
label5.Text = "ID Продуктa на складе:";
|
||||
//
|
||||
// numericUpDownPrice
|
||||
//
|
||||
numericUpDownPrice.Location = new Point(241, 297);
|
||||
numericUpDownPrice.Location = new Point(259, 218);
|
||||
numericUpDownPrice.Name = "numericUpDownPrice";
|
||||
numericUpDownPrice.Size = new Size(120, 23);
|
||||
numericUpDownPrice.TabIndex = 18;
|
||||
@ -92,7 +50,7 @@
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(24, 132);
|
||||
label2.Location = new Point(38, 52);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(98, 15);
|
||||
label2.TabIndex = 20;
|
||||
@ -101,7 +59,7 @@
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(24, 182);
|
||||
label3.Location = new Point(38, 102);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(154, 15);
|
||||
label3.TabIndex = 21;
|
||||
@ -110,41 +68,15 @@
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(20, 297);
|
||||
label4.Location = new Point(38, 218);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(38, 15);
|
||||
label4.TabIndex = 22;
|
||||
label4.Text = "Цена:";
|
||||
//
|
||||
// comboBoxType
|
||||
//
|
||||
comboBoxType.FormattingEnabled = true;
|
||||
comboBoxType.Location = new Point(240, 347);
|
||||
comboBoxType.Name = "comboBox1";
|
||||
comboBoxType.Size = new Size(121, 23);
|
||||
comboBoxType.TabIndex = 23;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
label6.AutoSize = true;
|
||||
label6.Location = new Point(20, 355);
|
||||
label6.Name = "label6";
|
||||
label6.Size = new Size(83, 15);
|
||||
label6.TabIndex = 25;
|
||||
label6.Text = "Тип продукта:";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
label7.AutoSize = true;
|
||||
label7.Location = new Point(20, 403);
|
||||
label7.Name = "label7";
|
||||
label7.Size = new Size(106, 15);
|
||||
label7.TabIndex = 26;
|
||||
label7.Text = "Размер на складе:";
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(245, 464);
|
||||
buttonCancel.Location = new Point(254, 323);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(102, 23);
|
||||
buttonCancel.TabIndex = 28;
|
||||
@ -154,7 +86,7 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(45, 464);
|
||||
buttonSave.Location = new Point(54, 323);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(100, 23);
|
||||
buttonSave.TabIndex = 27;
|
||||
@ -165,71 +97,56 @@
|
||||
// checkedListBoxManufactoringCompany
|
||||
//
|
||||
checkedListBoxManufactoringCompany.FormattingEnabled = true;
|
||||
checkedListBoxManufactoringCompany.Location = new Point(240, 182);
|
||||
checkedListBoxManufactoringCompany.Location = new Point(254, 102);
|
||||
checkedListBoxManufactoringCompany.Name = "checkedListBoxManufactoringCompany";
|
||||
checkedListBoxManufactoringCompany.Size = new Size(120, 94);
|
||||
checkedListBoxManufactoringCompany.TabIndex = 29;
|
||||
//
|
||||
// textBoxNameShoe
|
||||
//
|
||||
textBoxNameShoe.Location = new Point(128, 132);
|
||||
textBoxNameShoe.Location = new Point(142, 52);
|
||||
textBoxNameShoe.Name = "textBoxNameShoe";
|
||||
textBoxNameShoe.Size = new Size(237, 23);
|
||||
textBoxNameShoe.TabIndex = 31;
|
||||
//
|
||||
// numericUpDownStorage
|
||||
// label1
|
||||
//
|
||||
numericUpDownStorage.Location = new Point(240, 401);
|
||||
numericUpDownStorage.Name = "numericUpDownStorage";
|
||||
numericUpDownStorage.Size = new Size(120, 23);
|
||||
numericUpDownStorage.TabIndex = 32;
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(39, 33);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(0, 15);
|
||||
label1.TabIndex = 33;
|
||||
//
|
||||
// FormProduct
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(403, 545);
|
||||
Controls.Add(numericUpDownStorage);
|
||||
ClientSize = new Size(403, 374);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBoxNameShoe);
|
||||
Controls.Add(checkedListBoxManufactoringCompany);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(label7);
|
||||
Controls.Add(label6);
|
||||
Controls.Add(comboBoxType);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(numericUpDownPrice);
|
||||
Controls.Add(comboBoxStorageProductId);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Name = "FormProduct";
|
||||
Text = "FormProduct";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownPrice).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorage).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private ComboBox comboBoxProduct;
|
||||
private ComboBox comboBoxStorageProductId;
|
||||
private Label label5;
|
||||
private NumericUpDown numericUpDownPrice;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private ComboBox comboBoxType;
|
||||
private Label label6;
|
||||
private Label label7;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private CheckedListBox checkedListBoxManufactoringCompany;
|
||||
private TextBox textBoxNameShoe;
|
||||
private NumericUpDown numericUpDownStorage;
|
||||
private Label label1;
|
||||
}
|
||||
}
|
@ -46,9 +46,9 @@ namespace ShoeStore.Forms
|
||||
|
||||
textBoxNameShoe.Text = product.NameOfShoes;
|
||||
numericUpDownPrice.Value = product.Price;
|
||||
comboBoxStorageProductId.SelectedItem = product.StorageProductId;
|
||||
comboBoxType.SelectedItem = product.ProductType;
|
||||
numericUpDownStorage.Value = product.StorageSize;
|
||||
//comboBoxStorageProductId.SelectedItem = product.StorageProductId;
|
||||
//comboBoxType.SelectedItem = product.ProductType;
|
||||
//numericUpDownStorage.Value = product.StorageSize;
|
||||
|
||||
_productId = value;
|
||||
}
|
||||
@ -63,7 +63,6 @@ namespace ShoeStore.Forms
|
||||
{
|
||||
InitializeComponent();
|
||||
_productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
|
||||
comboBoxType.DataSource = Enum.GetValues(typeof(ProductType));
|
||||
foreach (var elem in Enum.GetValues(typeof(ManufacturingCompany)))
|
||||
{
|
||||
checkedListBoxManufactoringCompany.Items.Add(elem);
|
||||
@ -74,7 +73,7 @@ namespace ShoeStore.Forms
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxProduct.SelectedIndex < 0 || comboBoxStorageProductId.SelectedIndex < 0 || checkedListBoxManufactoringCompany.CheckedItems.Count == 0)
|
||||
if (checkedListBoxManufactoringCompany.CheckedItems.Count == 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
@ -97,8 +96,8 @@ namespace ShoeStore.Forms
|
||||
{
|
||||
manufacturingCompany |= (ManufacturingCompany)elem;
|
||||
}
|
||||
return Product.CreateEntity(id, (int)comboBoxStorageProductId.SelectedValue!,
|
||||
textBoxNameShoe.Text, manufacturingCompany, Convert.ToInt32(numericUpDownPrice.Value), (ProductType)comboBoxType.SelectedItem!, (int)numericUpDownStorage.Value!);
|
||||
return Product.CreateEntity(id,
|
||||
textBoxNameShoe.Text, manufacturingCompany, Convert.ToInt32(numericUpDownPrice.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
ShoeStore/Forms/FormProducts.Designer.cs
generated
1
ShoeStore/Forms/FormProducts.Designer.cs
generated
@ -101,6 +101,7 @@
|
||||
Controls.Add(dataGridViewProduct);
|
||||
Name = "FormProducts";
|
||||
Text = "FormProducts";
|
||||
Load += FormProducts_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewProduct).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
|
@ -106,5 +106,19 @@ namespace ShoeStore.Forms
|
||||
Convert.ToInt32(dataGridViewProduct.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void FormProducts_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//_container.Resolve<FormStorages>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
132
ShoeStore/Forms/FormReceipt.Designer.cs
generated
132
ShoeStore/Forms/FormReceipt.Designer.cs
generated
@ -28,108 +28,34 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
comboBoxProduct = new ComboBox();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
numericUpDownStorageNumber = new NumericUpDown();
|
||||
label5 = new Label();
|
||||
comboBoxStorageProductId = new ComboBox();
|
||||
numericUpDownStorageSize = new NumericUpDown();
|
||||
numericUpDownNumOfPairs = new NumericUpDown();
|
||||
buttonCancel = new Button();
|
||||
buttonSave = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).BeginInit();
|
||||
label = new Label();
|
||||
comboBox1 = new ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumOfPairs).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(232, 33);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(121, 23);
|
||||
comboBoxProduct.TabIndex = 7;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 36);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(56, 15);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "Продукт:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 135);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(122, 15);
|
||||
label2.TabIndex = 9;
|
||||
label2.Text = "Номер поступления:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 182);
|
||||
label3.Location = new Point(26, 160);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(169, 15);
|
||||
label3.Size = new Size(68, 15);
|
||||
label3.TabIndex = 10;
|
||||
label3.Text = "Колиество поступивших пар:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(12, 237);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(106, 15);
|
||||
label4.TabIndex = 11;
|
||||
label4.Text = "Размер на складе:";
|
||||
//
|
||||
// numericUpDownStorageNumber
|
||||
//
|
||||
numericUpDownStorageNumber.Location = new Point(232, 135);
|
||||
numericUpDownStorageNumber.Name = "numericUpDownStorageNumber";
|
||||
numericUpDownStorageNumber.Size = new Size(120, 23);
|
||||
numericUpDownStorageNumber.TabIndex = 12;
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(12, 80);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(112, 15);
|
||||
label5.TabIndex = 13;
|
||||
label5.Text = "Продукт на складе:";
|
||||
//
|
||||
// comboBoxStorageProductId
|
||||
//
|
||||
comboBoxStorageProductId.FormattingEnabled = true;
|
||||
comboBoxStorageProductId.Location = new Point(232, 80);
|
||||
comboBoxStorageProductId.Name = "comboBoxStorageProductId";
|
||||
comboBoxStorageProductId.Size = new Size(121, 23);
|
||||
comboBoxStorageProductId.TabIndex = 14;
|
||||
//
|
||||
// numericUpDownStorageSize
|
||||
//
|
||||
numericUpDownStorageSize.Location = new Point(232, 237);
|
||||
numericUpDownStorageSize.Name = "numericUpDownStorageSize";
|
||||
numericUpDownStorageSize.Size = new Size(120, 23);
|
||||
numericUpDownStorageSize.TabIndex = 15;
|
||||
label3.Text = "Колиество:";
|
||||
//
|
||||
// numericUpDownNumOfPairs
|
||||
//
|
||||
numericUpDownNumOfPairs.Location = new Point(232, 182);
|
||||
numericUpDownNumOfPairs.Location = new Point(246, 160);
|
||||
numericUpDownNumOfPairs.Name = "numericUpDownNumOfPairs";
|
||||
numericUpDownNumOfPairs.Size = new Size(120, 23);
|
||||
numericUpDownNumOfPairs.TabIndex = 16;
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
buttonCancel.Location = new Point(244, 301);
|
||||
buttonCancel.Location = new Point(258, 255);
|
||||
buttonCancel.Name = "buttonCancel";
|
||||
buttonCancel.Size = new Size(102, 23);
|
||||
buttonCancel.TabIndex = 18;
|
||||
@ -139,7 +65,7 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
buttonSave.Location = new Point(44, 301);
|
||||
buttonSave.Location = new Point(58, 255);
|
||||
buttonSave.Name = "buttonSave";
|
||||
buttonSave.Size = new Size(100, 23);
|
||||
buttonSave.TabIndex = 17;
|
||||
@ -147,45 +73,47 @@
|
||||
buttonSave.UseVisualStyleBackColor = true;
|
||||
buttonSave.Click += buttonSave_Click;
|
||||
//
|
||||
// label
|
||||
//
|
||||
label.AutoSize = true;
|
||||
label.Location = new Point(27, 69);
|
||||
label.Name = "label";
|
||||
label.Size = new Size(70, 15);
|
||||
label.TabIndex = 19;
|
||||
label.Text = "Тип товара:";
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
comboBox1.FormattingEnabled = true;
|
||||
comboBox1.Location = new Point(246, 69);
|
||||
comboBox1.Name = "comboBox1";
|
||||
comboBox1.Size = new Size(121, 23);
|
||||
comboBox1.TabIndex = 20;
|
||||
//
|
||||
// FormReceipt
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(398, 525);
|
||||
ClientSize = new Size(398, 330);
|
||||
Controls.Add(comboBox1);
|
||||
Controls.Add(label);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownNumOfPairs);
|
||||
Controls.Add(numericUpDownStorageSize);
|
||||
Controls.Add(comboBoxStorageProductId);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(numericUpDownStorageNumber);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Name = "FormReceipt";
|
||||
Text = "FormReceipt";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumOfPairs).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxProduct;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private NumericUpDown numericUpDownStorageNumber;
|
||||
private Label label5;
|
||||
private ComboBox comboBoxStorageProductId;
|
||||
private NumericUpDown numericUpDownStorageSize;
|
||||
private NumericUpDown numericUpDownNumOfPairs;
|
||||
private Button buttonCancel;
|
||||
private Button buttonSave;
|
||||
private Label label;
|
||||
private ComboBox comboBox1;
|
||||
}
|
||||
}
|
@ -19,24 +19,24 @@ namespace ShoeStore.Froms
|
||||
//private int? _receiptId;
|
||||
|
||||
|
||||
public FormReceipt()
|
||||
public FormReceipt(IReceiptRepository receiptRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_receiptRepository = receiptRepository ?? throw new ArgumentNullException(nameof(receiptRepository));
|
||||
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxProduct.SelectedIndex < 0 ||
|
||||
comboBoxStorageProductId.SelectedIndex < 0)
|
||||
if (numericUpDownNumOfPairs.Value < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_receiptRepository.CreateReceipt(Receipt.CreateOperation(
|
||||
0, (int)comboBoxProduct.SelectedValue!,
|
||||
(int)comboBoxStorageProductId.SelectedValue!,
|
||||
Convert.ToInt32(numericUpDownStorageNumber.Value), Convert.ToInt32(numericUpDownStorageSize.Value),
|
||||
0,
|
||||
(int)comboBox1.SelectedValue!,
|
||||
Convert.ToInt32(numericUpDownNumOfPairs.Value)));
|
||||
Close();
|
||||
}
|
||||
|
1
ShoeStore/Forms/FormReceipts.Designer.cs
generated
1
ShoeStore/Forms/FormReceipts.Designer.cs
generated
@ -76,6 +76,7 @@
|
||||
Controls.Add(dataGridView1);
|
||||
Name = "FormReceipts";
|
||||
Text = "FormReceipts";
|
||||
Load += FormReceipts_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
ResumeLayout(false);
|
||||
|
@ -39,4 +39,18 @@ public partial class FormReceipts : Form
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridView1.DataSource = _receiptRepository.ReadReceipts();
|
||||
|
||||
private void FormReceipts_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//_container.Resolve<FormStorages>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
122
ShoeStore/Forms/FormSale.Designer.cs
generated
122
ShoeStore/Forms/FormSale.Designer.cs
generated
@ -28,86 +28,31 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label4 = new Label();
|
||||
label5 = new Label();
|
||||
comboBoxProduct = new ComboBox();
|
||||
comboBoxStorageProductId = new ComboBox();
|
||||
numericUpDownStorageNumber = new NumericUpDown();
|
||||
numericUpDownStorageSize = new NumericUpDown();
|
||||
buttonSave = new Button();
|
||||
buttonCancel = new Button();
|
||||
dataGridView1 = new DataGridView();
|
||||
panel1 = new Panel();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).BeginInit();
|
||||
dataGridView1 = new DataGridView();
|
||||
ColumnProduct = new DataGridViewComboBoxColumn();
|
||||
ColumnAmount = new DataGridViewTextBoxColumn();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(38, 37);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(56, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Продукт:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(38, 75);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(112, 15);
|
||||
label2.TabIndex = 1;
|
||||
label2.Text = "Продукт на складе:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(38, 128);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(100, 15);
|
||||
label4.TabIndex = 3;
|
||||
label4.Text = "Номер продажи:";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(38, 173);
|
||||
label5.Location = new Point(38, 82);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(106, 15);
|
||||
label5.Size = new Size(155, 15);
|
||||
label5.TabIndex = 4;
|
||||
label5.Text = "Размер на складе:";
|
||||
//
|
||||
// comboBoxProduct
|
||||
//
|
||||
comboBoxProduct.FormattingEnabled = true;
|
||||
comboBoxProduct.Location = new Point(206, 34);
|
||||
comboBoxProduct.Name = "comboBoxProduct";
|
||||
comboBoxProduct.Size = new Size(121, 23);
|
||||
comboBoxProduct.TabIndex = 6;
|
||||
//
|
||||
// comboBoxStorageProductId
|
||||
//
|
||||
comboBoxStorageProductId.FormattingEnabled = true;
|
||||
comboBoxStorageProductId.Location = new Point(206, 75);
|
||||
comboBoxStorageProductId.Name = "comboBoxStorageProductId";
|
||||
comboBoxStorageProductId.Size = new Size(121, 23);
|
||||
comboBoxStorageProductId.TabIndex = 7;
|
||||
//
|
||||
// numericUpDownStorageNumber
|
||||
//
|
||||
numericUpDownStorageNumber.Location = new Point(207, 126);
|
||||
numericUpDownStorageNumber.Name = "numericUpDownStorageNumber";
|
||||
numericUpDownStorageNumber.Size = new Size(120, 23);
|
||||
numericUpDownStorageNumber.TabIndex = 9;
|
||||
label5.Text = "Колиество купленных пар:";
|
||||
//
|
||||
// numericUpDownStorageSize
|
||||
//
|
||||
numericUpDownStorageSize.Location = new Point(207, 171);
|
||||
numericUpDownStorageSize.Location = new Point(207, 80);
|
||||
numericUpDownStorageSize.Name = "numericUpDownStorageSize";
|
||||
numericUpDownStorageSize.Size = new Size(120, 23);
|
||||
numericUpDownStorageSize.TabIndex = 10;
|
||||
@ -132,15 +77,6 @@
|
||||
buttonCancel.UseVisualStyleBackColor = true;
|
||||
buttonCancel.Click += ButtonCancel_Click_1;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Dock = DockStyle.Fill;
|
||||
dataGridView1.Location = new Point(0, 0);
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.Size = new Size(289, 249);
|
||||
dataGridView1.TabIndex = 13;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(dataGridView1);
|
||||
@ -149,45 +85,53 @@
|
||||
panel1.Size = new Size(289, 249);
|
||||
panel1.TabIndex = 14;
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { ColumnProduct, ColumnAmount });
|
||||
dataGridView1.Dock = DockStyle.Fill;
|
||||
dataGridView1.Location = new Point(0, 0);
|
||||
dataGridView1.Name = "dataGridView1";
|
||||
dataGridView1.Size = new Size(289, 249);
|
||||
dataGridView1.TabIndex = 13;
|
||||
//
|
||||
// ColumnProduct
|
||||
//
|
||||
ColumnProduct.HeaderText = "Продукты";
|
||||
ColumnProduct.Name = "ColumnProduct";
|
||||
//
|
||||
// ColumnAmount
|
||||
//
|
||||
ColumnAmount.HeaderText = "Кол-во";
|
||||
ColumnAmount.Name = "ColumnAmount";
|
||||
//
|
||||
// FormSale
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(377, 497);
|
||||
ClientSize = new Size(377, 493);
|
||||
Controls.Add(panel1);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
Controls.Add(numericUpDownStorageSize);
|
||||
Controls.Add(numericUpDownStorageNumber);
|
||||
Controls.Add(comboBoxStorageProductId);
|
||||
Controls.Add(comboBoxProduct);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Name = "FormSale";
|
||||
Text = "FormSale";
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageNumber).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownStorageSize).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label4;
|
||||
private Label label5;
|
||||
private ComboBox comboBoxProduct;
|
||||
private ComboBox comboBoxStorageProductId;
|
||||
private NumericUpDown numericUpDownStorageNumber;
|
||||
private NumericUpDown numericUpDownStorageSize;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private DataGridView dataGridView1;
|
||||
private Panel panel1;
|
||||
private DataGridView dataGridView1;
|
||||
private DataGridViewComboBoxColumn ColumnProduct;
|
||||
private DataGridViewTextBoxColumn ColumnAmount;
|
||||
}
|
||||
}
|
@ -22,28 +22,24 @@ public partial class FormSale : Form
|
||||
InitializeComponent();
|
||||
_saleRepository = saleRepository ?? throw new ArgumentNullException(nameof(saleRepository));
|
||||
|
||||
comboBoxProduct.DataSource = productRepository.ReadProducts();
|
||||
comboBoxProduct.DisplayMember = "NameOfShoes";
|
||||
comboBoxProduct.ValueMember = "Id";
|
||||
|
||||
//?
|
||||
ColumnProduct.DataSource = productRepository.ReadProducts();
|
||||
ColumnProduct.DisplayMember = "NameOfShoes";
|
||||
ColumnProduct.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void ButtonSave_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxProduct.SelectedIndex < 0 ||
|
||||
comboBoxStorageProductId.SelectedIndex < 0 ||
|
||||
comboBoxProduct.SelectedIndex < 0)
|
||||
if (numericUpDownStorageSize.Value < 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
_saleRepository.CreateSale(Sale.CreateOperation(
|
||||
0,
|
||||
(int)comboBoxProduct.SelectedValue!,
|
||||
(int)comboBoxProduct.SelectedValue!,
|
||||
Convert.ToInt32(numericUpDownStorageNumber.Value), Convert.ToInt32(numericUpDownStorageSize.Value)));
|
||||
|
||||
MessageBox.Show("Данные успешно добавлены!", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
|
||||
_saleRepository.CreateSale(Sale.CreateOperation(0, Convert.ToInt32(numericUpDownStorageSize.Value)));
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -53,6 +49,6 @@ public partial class FormSale : Form
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click_1(object sender, EventArgs e) =>
|
||||
Close();
|
||||
private void ButtonCancel_Click_1(object sender, EventArgs e) => Close();
|
||||
|
||||
}
|
@ -117,4 +117,10 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ColumnProduct.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="ColumnAmount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
20
ShoeStore/Forms/FormStorage.Designer.cs
generated
20
ShoeStore/Forms/FormStorage.Designer.cs
generated
@ -35,7 +35,7 @@
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
numericUpDownSize = new NumericUpDown();
|
||||
comboBoxNalStorage = new ComboBox();
|
||||
checkBoxNalStorage = new CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownNumStorage).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDownSize).BeginInit();
|
||||
SuspendLayout();
|
||||
@ -101,20 +101,22 @@
|
||||
numericUpDownSize.Size = new Size(132, 23);
|
||||
numericUpDownSize.TabIndex = 16;
|
||||
//
|
||||
// comboBoxNalStorage
|
||||
// checkBoxNalStorage
|
||||
//
|
||||
comboBoxNalStorage.FormattingEnabled = true;
|
||||
comboBoxNalStorage.Location = new Point(183, 176);
|
||||
comboBoxNalStorage.Name = "comboBoxNalStorage";
|
||||
comboBoxNalStorage.Size = new Size(121, 23);
|
||||
comboBoxNalStorage.TabIndex = 17;
|
||||
checkBoxNalStorage.AutoSize = true;
|
||||
checkBoxNalStorage.Location = new Point(195, 175);
|
||||
checkBoxNalStorage.Name = "checkBoxNalStorage";
|
||||
checkBoxNalStorage.Size = new Size(129, 19);
|
||||
checkBoxNalStorage.TabIndex = 17;
|
||||
checkBoxNalStorage.Text = "Имеется на складе";
|
||||
checkBoxNalStorage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// FormStorage
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(355, 421);
|
||||
Controls.Add(comboBoxNalStorage);
|
||||
Controls.Add(checkBoxNalStorage);
|
||||
Controls.Add(numericUpDownSize);
|
||||
Controls.Add(buttonCancel);
|
||||
Controls.Add(buttonSave);
|
||||
@ -140,6 +142,6 @@
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
private NumericUpDown numericUpDownSize;
|
||||
private ComboBox comboBoxNalStorage;
|
||||
private CheckBox checkBoxNalStorage;
|
||||
}
|
||||
}
|
@ -42,10 +42,13 @@ namespace ShoeStore.Forms
|
||||
}*/
|
||||
|
||||
numericUpDownSize.Value = storage.Size;
|
||||
comboBoxNalStorage.SelectedItem = storage.QuantityInStock;
|
||||
numericUpDownNumStorage.Value = storage.NumberStorage;
|
||||
|
||||
// Проверяем наличие товара на складе
|
||||
checkBoxNalStorage.Checked = storage.QuantityInStock > 0;
|
||||
|
||||
_productId = value;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -55,22 +58,22 @@ namespace ShoeStore.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public FormStorage()
|
||||
public FormStorage(IStorageRepository storageRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_storageRepository = storageRepository ?? throw new ArgumentNullException(nameof(storageRepository));
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (
|
||||
comboBoxNalStorage.SelectedIndex < 0)
|
||||
if (!checkBoxNalStorage.Checked || numericUpDownSize.Value <= 0 || numericUpDownNumStorage.Value <= 0)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
throw new Exception("Имеются незаполненные поля или товар отсутствует на складе");
|
||||
}
|
||||
_storageRepository.CreateStorage(Storage.CreateEntity(
|
||||
(int)comboBoxNalStorage.SelectedValue!,
|
||||
checkBoxNalStorage.Checked ? 1 : 0, // 1 - есть на складе, 0 - нет
|
||||
|
||||
Convert.ToInt32(numericUpDownSize.Value),
|
||||
Convert.ToInt32(numericUpDownNumStorage.Value)));
|
||||
|
1
ShoeStore/Forms/FormStorages.Designer.cs
generated
1
ShoeStore/Forms/FormStorages.Designer.cs
generated
@ -101,6 +101,7 @@
|
||||
Controls.Add(panel1);
|
||||
Name = "FormStorages";
|
||||
Text = "FormStorages";
|
||||
Load += FormStorages_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewStorages).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
@ -1,4 +1,7 @@
|
||||
using ShoeStore.Repositories;
|
||||
using ShoeStore.Froms;
|
||||
using ShoeStore.Repositories;
|
||||
using ShoeStore.Repositories.Implementations;
|
||||
using System.Windows.Forms;
|
||||
using Unity;
|
||||
|
||||
namespace ShoeStore.Forms
|
||||
@ -8,6 +11,10 @@ namespace ShoeStore.Forms
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IStorageRepository _storageRepository;
|
||||
|
||||
|
||||
private void LoadList() => dataGridViewStorages.DataSource = _storageRepository.ReadStorages();
|
||||
|
||||
|
||||
public FormStorages(IUnityContainer container, IStorageRepository storageRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -15,18 +22,7 @@ namespace ShoeStore.Forms
|
||||
_storageRepository = storageRepository;
|
||||
}
|
||||
|
||||
private void FormEmployees_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
@ -81,7 +77,7 @@ namespace ShoeStore.Forms
|
||||
MessageBox.Show(ex.Message, "Ошибка при удалении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void LoadList() => dataGridViewStorages.DataSource = _storageRepository.ReadStorages();
|
||||
|
||||
private bool TryGetIdentifierFromSelectedRow(out int id)
|
||||
{
|
||||
id = 0;
|
||||
@ -95,5 +91,19 @@ namespace ShoeStore.Forms
|
||||
Convert.ToInt32(dataGridViewStorages.SelectedRows[0].Cells["Id"].Value);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void FormStorages_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//_container.Resolve<FormStorages>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1
ShoeStore/ShoeStore.Designer.cs
generated
1
ShoeStore/ShoeStore.Designer.cs
generated
@ -116,6 +116,7 @@
|
||||
MainMenuStrip = menuStrip1;
|
||||
Name = "ShoeStore";
|
||||
Text = "ShoeStore";
|
||||
//Load += ShoeStore_Load;
|
||||
menuStrip1.ResumeLayout(false);
|
||||
menuStrip1.PerformLayout();
|
||||
ResumeLayout(false);
|
||||
|
@ -83,5 +83,8 @@ namespace ShoeStore
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user