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