diff --git a/ProjectGasStation/ProjectGasStation/Entities/Supplier.cs b/ProjectGasStation/ProjectGasStation/Entities/Supplier.cs
index d4c30cc..c9d35ad 100644
--- a/ProjectGasStation/ProjectGasStation/Entities/Supplier.cs
+++ b/ProjectGasStation/ProjectGasStation/Entities/Supplier.cs
@@ -14,7 +14,7 @@ public class Supplier
public string INN { get; private set; } = string.Empty;
- public static Supplier CreateElement(int id, string name, string INN)
+ public static Supplier CreateEntity(int id, string name, string INN)
{
return new Supplier { Id = id, Name = name, INN = INN };
}
diff --git a/ProjectGasStation/ProjectGasStation/Form1.Designer.cs b/ProjectGasStation/ProjectGasStation/FormGasStation.Designer.cs
similarity index 77%
rename from ProjectGasStation/ProjectGasStation/Form1.Designer.cs
rename to ProjectGasStation/ProjectGasStation/FormGasStation.Designer.cs
index 1630d39..6a18626 100644
--- a/ProjectGasStation/ProjectGasStation/Form1.Designer.cs
+++ b/ProjectGasStation/ProjectGasStation/FormGasStation.Designer.cs
@@ -1,6 +1,6 @@
namespace ProjectGasStation
{
- partial class Form1
+ partial class FormGasStation
{
///
/// Required designer variable.
@@ -28,10 +28,10 @@
///
private void InitializeComponent()
{
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
+ components = new System.ComponentModel.Container();
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Text = "Form1";
}
#endregion
diff --git a/ProjectGasStation/ProjectGasStation/Form1.cs b/ProjectGasStation/ProjectGasStation/FormGasStation.cs
similarity index 54%
rename from ProjectGasStation/ProjectGasStation/Form1.cs
rename to ProjectGasStation/ProjectGasStation/FormGasStation.cs
index d014f73..db4aedc 100644
--- a/ProjectGasStation/ProjectGasStation/Form1.cs
+++ b/ProjectGasStation/ProjectGasStation/FormGasStation.cs
@@ -1,8 +1,8 @@
namespace ProjectGasStation
{
- public partial class Form1 : Form
+ public partial class FormGasStation : Form
{
- public Form1()
+ public FormGasStation()
{
InitializeComponent();
}
diff --git a/ProjectGasStation/ProjectGasStation/FormGasStation.resx b/ProjectGasStation/ProjectGasStation/FormGasStation.resx
new file mode 100644
index 0000000..5203d24
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/FormGasStation.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/ProjectGasStation/ProjectGasStation/Forms/FormProduct.Designer.cs b/ProjectGasStation/ProjectGasStation/Forms/FormProduct.Designer.cs
new file mode 100644
index 0000000..933abef
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Forms/FormProduct.Designer.cs
@@ -0,0 +1,146 @@
+namespace ProjectGasStation.Forms
+{
+ partial class FormProduct
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ labelName = new Label();
+ labelPrice = new Label();
+ labelProductType = new Label();
+ textBoxProductName = new TextBox();
+ numericUpDownProductPrice = new NumericUpDown();
+ buttonSave = new Button();
+ buttonCancel = new Button();
+ comboBoxProductType = new ComboBox();
+ ((System.ComponentModel.ISupportInitialize)numericUpDownProductPrice).BeginInit();
+ SuspendLayout();
+ //
+ // labelName
+ //
+ labelName.AutoSize = true;
+ labelName.Location = new Point(26, 31);
+ labelName.Name = "labelName";
+ labelName.Size = new Size(99, 15);
+ labelName.TabIndex = 0;
+ labelName.Text = "Название товара";
+ //
+ // labelPrice
+ //
+ labelPrice.AutoSize = true;
+ labelPrice.Location = new Point(26, 78);
+ labelPrice.Name = "labelPrice";
+ labelPrice.Size = new Size(98, 15);
+ labelPrice.TabIndex = 1;
+ labelPrice.Text = "Цена за единицу";
+ //
+ // labelProductType
+ //
+ labelProductType.AutoSize = true;
+ labelProductType.Location = new Point(26, 123);
+ labelProductType.Name = "labelProductType";
+ labelProductType.Size = new Size(67, 15);
+ labelProductType.TabIndex = 2;
+ labelProductType.Text = "Тип товара";
+ //
+ // textBoxProductName
+ //
+ textBoxProductName.Location = new Point(140, 31);
+ textBoxProductName.Name = "textBoxProductName";
+ textBoxProductName.Size = new Size(100, 23);
+ textBoxProductName.TabIndex = 3;
+ //
+ // numericUpDownProductPrice
+ //
+ numericUpDownProductPrice.DecimalPlaces = 3;
+ numericUpDownProductPrice.Location = new Point(140, 78);
+ numericUpDownProductPrice.Minimum = new decimal(new int[] { 1, 0, 0, 196608 });
+ numericUpDownProductPrice.Name = "numericUpDownProductPrice";
+ numericUpDownProductPrice.Size = new Size(120, 23);
+ numericUpDownProductPrice.TabIndex = 5;
+ numericUpDownProductPrice.Value = new decimal(new int[] { 1, 0, 0, 131072 });
+ //
+ // buttonSave
+ //
+ buttonSave.Location = new Point(41, 228);
+ buttonSave.Name = "buttonSave";
+ buttonSave.Size = new Size(108, 36);
+ buttonSave.TabIndex = 6;
+ buttonSave.Text = "Сохранить";
+ buttonSave.UseVisualStyleBackColor = true;
+ buttonSave.Click += buttonSave_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(203, 228);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(116, 36);
+ buttonCancel.TabIndex = 7;
+ buttonCancel.Text = "Отмена";
+ buttonCancel.UseVisualStyleBackColor = true;
+ buttonCancel.Click += buttonCancel_Click;
+ //
+ // comboBoxProductType
+ //
+ comboBoxProductType.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxProductType.FormattingEnabled = true;
+ comboBoxProductType.Location = new Point(139, 120);
+ comboBoxProductType.Name = "comboBoxProductType";
+ comboBoxProductType.Size = new Size(121, 23);
+ comboBoxProductType.TabIndex = 8;
+ //
+ // FormProduct
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(358, 296);
+ Controls.Add(comboBoxProductType);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonSave);
+ Controls.Add(numericUpDownProductPrice);
+ Controls.Add(textBoxProductName);
+ Controls.Add(labelProductType);
+ Controls.Add(labelPrice);
+ Controls.Add(labelName);
+ Name = "FormProduct";
+ Text = "Товар";
+ ((System.ComponentModel.ISupportInitialize)numericUpDownProductPrice).EndInit();
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Label labelName;
+ private Label labelPrice;
+ private Label labelProductType;
+ private TextBox textBoxProductName;
+ private NumericUpDown numericUpDownProductPrice;
+ private Button buttonSave;
+ private Button buttonCancel;
+ private ComboBox comboBoxProductType;
+ }
+}
\ No newline at end of file
diff --git a/ProjectGasStation/ProjectGasStation/Forms/FormProduct.cs b/ProjectGasStation/ProjectGasStation/Forms/FormProduct.cs
new file mode 100644
index 0000000..16b8239
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Forms/FormProduct.cs
@@ -0,0 +1,94 @@
+using ProjectGasStation.Entities.Enums;
+using ProjectGasStation.Implementations;
+using ProjectGasStation.Repositories;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ProjectGasStation.Forms
+{
+ public partial class FormProduct : Form
+ {
+
+ private readonly IProductRepository _productRepository;
+
+ private int? _productId;
+
+ public int Id
+ {
+ set
+ {
+ try
+ {
+ var product = _productRepository.ReadProductById(value);
+ if (product == null)
+ {
+ throw new InvalidDataException(nameof(product));
+ }
+
+ textBoxProductName.Text = product.Name;
+ numericUpDownProductPrice.Value = (decimal)product.Price;
+ comboBoxProductType.SelectedItem = product.ProductType;
+ _productId = value;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при получении данных", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+ }
+ }
+
+
+
+
+
+
+ public FormProduct(IProductRepository productRepository)
+ {
+ InitializeComponent();
+ _productRepository = productRepository ?? throw new ArgumentNullException(nameof(productRepository));
+
+ comboBoxProductType.DataSource = Enum.GetValues(typeof(ProductType));
+ }
+
+
+
+ private void buttonSave_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (string.IsNullOrWhiteSpace(textBoxProductName.Text) || comboBoxProductType.SelectedIndex < 1)
+ {
+ throw new Exception("Имеются незаполненные поля");
+ }
+ if (_productId.HasValue)
+ {
+ _productRepository.UpdateProduct(CreateP(_productId.Value));
+ }
+ else
+ {
+ _productRepository.CreateProduct(CreateProduct(0));
+ }
+ Close();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка при сохранении",
+ MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+
+ }
+
+ private void buttonCancel_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/ProjectGasStation/ProjectGasStation/Form1.resx b/ProjectGasStation/ProjectGasStation/Forms/FormProduct.resx
similarity index 93%
rename from ProjectGasStation/ProjectGasStation/Form1.resx
rename to ProjectGasStation/ProjectGasStation/Forms/FormProduct.resx
index 1af7de1..a395bff 100644
--- a/ProjectGasStation/ProjectGasStation/Form1.resx
+++ b/ProjectGasStation/ProjectGasStation/Forms/FormProduct.resx
@@ -1,24 +1,24 @@
-
diff --git a/ProjectGasStation/ProjectGasStation/Implementations/EmployeeRepository.cs b/ProjectGasStation/ProjectGasStation/Implementations/EmployeeRepository.cs
index 45d4dd8..f51b52f 100644
--- a/ProjectGasStation/ProjectGasStation/Implementations/EmployeeRepository.cs
+++ b/ProjectGasStation/ProjectGasStation/Implementations/EmployeeRepository.cs
@@ -11,7 +11,7 @@ namespace ProjectGasStation.Implementations;
public class EmployeeRepository : IEmployeeRepository
{
- public CreateEmployee(Employee employee)
+ public void CreateEmployee(Employee employee)
{
}
@@ -33,5 +33,6 @@ public class EmployeeRepository : IEmployeeRepository
public void UpdateEmployee(Employee employee)
{
+
}
}
diff --git a/ProjectGasStation/ProjectGasStation/Implementations/PurchaseRepository.cs b/ProjectGasStation/ProjectGasStation/Implementations/PurchaseRepository.cs
new file mode 100644
index 0000000..163e8b0
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Implementations/PurchaseRepository.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ProjectGasStation.Entities;
+using ProjectGasStation.Repositories;
+
+namespace ProjectGasStation.Implementations;
+
+public class PurchaseRepository : IPurchaseRepository
+{
+ public void CreatePurchase(Purchase purchase)
+ {
+
+ }
+
+ public IEnumerable ReadPurchases(DateTime? dateFrom = null, DateTime? dateTo = null, int? supplierId = null, int? productId = null)
+ {
+ return [];
+ }
+}
diff --git a/ProjectGasStation/ProjectGasStation/Implementations/SaleRepository.cs b/ProjectGasStation/ProjectGasStation/Implementations/SaleRepository.cs
new file mode 100644
index 0000000..9f39291
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Implementations/SaleRepository.cs
@@ -0,0 +1,22 @@
+using ProjectGasStation.Entities;
+using ProjectGasStation.Repositories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectGasStation.Implementations;
+
+public class SaleRepository : ISaleRepository
+{
+ public void CreateSale(Sale sale)
+ {
+
+ }
+
+ public IEnumerable ReadSales(DateTime? dateFrom = null, DateTime? dateTo = null, int? shiftId = null)
+ {
+ return [];
+ }
+}
diff --git a/ProjectGasStation/ProjectGasStation/Implementations/ShiftRepository.cs b/ProjectGasStation/ProjectGasStation/Implementations/ShiftRepository.cs
new file mode 100644
index 0000000..5f8ea62
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Implementations/ShiftRepository.cs
@@ -0,0 +1,22 @@
+using ProjectGasStation.Entities;
+using ProjectGasStation.Repositories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectGasStation.Implementations;
+
+public class ShiftRepository : IShiftRepository
+{
+ public void CreateShift(Shift shift)
+ {
+
+ }
+
+ public IEnumerable ReadShifts(DateTime? dateFrom = null, DateTime? dateTo = null, int? employeeId = null)
+ {
+ return [];
+ }
+}
diff --git a/ProjectGasStation/ProjectGasStation/Implementations/SupplierRepository.cs b/ProjectGasStation/ProjectGasStation/Implementations/SupplierRepository.cs
new file mode 100644
index 0000000..334659f
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Implementations/SupplierRepository.cs
@@ -0,0 +1,37 @@
+using ProjectGasStation.Entities;
+using ProjectGasStation.Repositories;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ProjectGasStation.Implementations;
+
+public class SupplierRepository : ISupplierRepository
+{
+ public void CreateSupplier(Supplier supplier)
+ {
+
+ }
+
+ public void DeleteSupplier(int id)
+ {
+
+ }
+
+ public Supplier ReadSupplierById(int id)
+ {
+ return Supplier.CreateEntity(0, string.Empty, string.Empty);
+ }
+
+ public IEnumerable ReadSuppliers()
+ {
+ return [];
+ }
+
+ public void UpdateSupplier(Supplier supplier)
+ {
+
+ }
+}
diff --git a/ProjectGasStation/ProjectGasStation/Program.cs b/ProjectGasStation/ProjectGasStation/Program.cs
index 9830769..37f8178 100644
--- a/ProjectGasStation/ProjectGasStation/Program.cs
+++ b/ProjectGasStation/ProjectGasStation/Program.cs
@@ -1,3 +1,7 @@
+using ProjectGasStation.Implementations;
+using ProjectGasStation.Repositories;
+using Unity
+
namespace ProjectGasStation
{
internal static class Program
@@ -11,7 +15,21 @@ namespace ProjectGasStation
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ Application.Run(CreateUnityContainer().Resolve());
+ }
+
+ private static IUnityContainer CreateUnityContainer()
+ {
+ var container = new UnityContainer();
+
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+ container.RegisterType();
+
+ return container;
}
}
}
\ No newline at end of file
diff --git a/ProjectGasStation/ProjectGasStation/ProjectGasStation.csproj b/ProjectGasStation/ProjectGasStation/ProjectGasStation.csproj
index b57c89e..32bb4ef 100644
--- a/ProjectGasStation/ProjectGasStation/ProjectGasStation.csproj
+++ b/ProjectGasStation/ProjectGasStation/ProjectGasStation.csproj
@@ -8,4 +8,23 @@
enable
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/ProjectGasStation/ProjectGasStation/Properties/Resources.Designer.cs b/ProjectGasStation/ProjectGasStation/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..39db742
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Properties/Resources.Designer.cs
@@ -0,0 +1,73 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace ProjectGasStation.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectGasStation.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap Union_76_Gas_Station {
+ get {
+ object obj = ResourceManager.GetObject("Union_76_Gas_Station", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/ProjectGasStation/ProjectGasStation/Properties/Resources.resx b/ProjectGasStation/ProjectGasStation/Properties/Resources.resx
new file mode 100644
index 0000000..c370f61
--- /dev/null
+++ b/ProjectGasStation/ProjectGasStation/Properties/Resources.resx
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ ..\Resources\Union_76_Gas_Station.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
\ No newline at end of file
diff --git a/ProjectGasStation/ProjectGasStation/Repositories/ISaleRepository.cs b/ProjectGasStation/ProjectGasStation/Repositories/ISaleRepository.cs
index c263188..4803ec0 100644
--- a/ProjectGasStation/ProjectGasStation/Repositories/ISaleRepository.cs
+++ b/ProjectGasStation/ProjectGasStation/Repositories/ISaleRepository.cs
@@ -9,7 +9,7 @@ namespace ProjectGasStation.Repositories;
public interface ISaleRepository
{
- IEnumerable ReadSales(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? shiftId = null);
+ IEnumerable ReadSales(DateTime? dateFrom = null, DateTime? dateTo = null, int? shiftId = null);
void CreateSale(Sale sale);
}
diff --git a/ProjectGasStation/ProjectGasStation/Resources/Union_76_Gas_Station.jpg b/ProjectGasStation/ProjectGasStation/Resources/Union_76_Gas_Station.jpg
new file mode 100644
index 0000000..94de535
Binary files /dev/null and b/ProjectGasStation/ProjectGasStation/Resources/Union_76_Gas_Station.jpg differ