PIbd-22 Alkin_D.V. LabWork_1 #1
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ProjectGasStation.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -12,8 +13,10 @@ public class Employee
|
||||
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public static Employee CreateEntity(int id, string name)
|
||||
public EmployeePost EmployeePost { get; private set; }
|
||||
|
||||
public static Employee CreateEntity(int id, string name, EmployeePost employeePost)
|
||||
{
|
||||
return new Employee { Id = id, Name = name };
|
||||
return new Employee { Id = id, Name = name ?? string.Empty, EmployeePost = employeePost };
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities.Enums;
|
||||
[Flags]
|
||||
public enum EmployeePost
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Cashier = 1,
|
||||
|
||||
Fueler = 2,
|
||||
|
||||
Manager = 4,
|
||||
|
||||
Programmer = 8,
|
||||
|
||||
Mechanic = 16
|
||||
}
|
@ -5,12 +5,18 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities.Enums;
|
||||
[Flags]
|
||||
|
||||
public enum ProductType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Fuel = 1,
|
||||
|
||||
MotorOil = 2,
|
||||
|
||||
AutoChemicals = 3,
|
||||
|
||||
AutoParts = 4,
|
||||
|
||||
Tires = 5,
|
||||
}
|
||||
|
24
ProjectGasStation/ProjectGasStation/Entities/Product.cs
Normal file
24
ProjectGasStation/ProjectGasStation/Entities/Product.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using ProjectGasStation.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities;
|
||||
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
public ProductType ProductType { get; private set; }
|
||||
|
||||
public static Product CreateEntity(int id, string name, double price, ProductType productType)
|
||||
{
|
||||
return new Product { Id = id, Name = name ?? string.Empty, Price = price, ProductType = productType };
|
||||
}
|
||||
}
|
27
ProjectGasStation/ProjectGasStation/Entities/Purchase.cs
Normal file
27
ProjectGasStation/ProjectGasStation/Entities/Purchase.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities;
|
||||
|
||||
public class Purchase
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int ProductId { get; private set; }
|
||||
|
||||
public int SupplierId { get; private set; }
|
||||
|
||||
public double Quantity { get; private set; }
|
||||
|
||||
public DateTime PurchaseDate { get; private set; }
|
||||
|
||||
public double Price { get; private set; }
|
||||
|
||||
public static Purchase CreateElement(int id, int productId, int supplierId, double quantity, DateTime purchaseDate, double price)
|
||||
{
|
||||
return new Purchase { Id = id, ProductId = productId, SupplierId = supplierId, Quantity = quantity, PurchaseDate = purchaseDate, Price = price };
|
||||
}
|
||||
}
|
23
ProjectGasStation/ProjectGasStation/Entities/Sale.cs
Normal file
23
ProjectGasStation/ProjectGasStation/Entities/Sale.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities;
|
||||
|
||||
public class Sale
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int ShiftId { get; private set; }
|
||||
|
||||
public double Quantity { get; private set; }
|
||||
|
||||
public DateTime SaleDate { get; private set; }
|
||||
|
||||
public static Sale CreateElement(int id, int shiftId, double quantity, DateTime saleDate)
|
||||
{
|
||||
return new Sale { Id = id, ShiftId = shiftId, Quantity = quantity, SaleDate = saleDate };
|
||||
}
|
||||
}
|
19
ProjectGasStation/ProjectGasStation/Entities/SaleProduct.cs
Normal file
19
ProjectGasStation/ProjectGasStation/Entities/SaleProduct.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities;
|
||||
|
||||
public class SaleProduct
|
||||
{
|
||||
public int SaleID { get; private set; }
|
||||
|
||||
public int ProductID { get; private set;}
|
||||
|
||||
public static SaleProduct CreateElement(int saleID, int productID)
|
||||
{
|
||||
return new SaleProduct() { SaleID = saleID, ProductID = productID };
|
||||
}
|
||||
}
|
@ -15,4 +15,9 @@ public class Shift
|
||||
public DateTime DateFinish { get; private set; }
|
||||
|
||||
public int EmployeeID { get; private set; }
|
||||
|
||||
public static Shift CreateElement(int id, DateTime dateStart, DateTime dateFinish, int employeeID)
|
||||
{
|
||||
return new Shift { Id = id, DateStart = dateStart, DateFinish = dateFinish, EmployeeID = employeeID };
|
||||
}
|
||||
}
|
||||
|
21
ProjectGasStation/ProjectGasStation/Entities/Supplier.cs
Normal file
21
ProjectGasStation/ProjectGasStation/Entities/Supplier.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Entities;
|
||||
|
||||
public class Supplier
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
public string INN { get; private set; } = string.Empty;
|
||||
|
||||
public static Supplier CreateElement(int id, string name, string INN)
|
||||
{
|
||||
return new Supplier { Id = id, Name = name, INN = INN };
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using ProjectGasStation.Entities.Enums;
|
||||
using ProjectGasStation.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Implementations;
|
||||
|
||||
public class EmployeeRepository : IEmployeeRepository
|
||||
{
|
||||
public CreateEmployee(Employee employee)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteEmployee(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Employee ReadEmployeeById(int id)
|
||||
{
|
||||
return Employee.CreateEntity(0, string.Empty, EmployeePost.None);
|
||||
}
|
||||
|
||||
public IEnumerable<Employee> ReadEmployees()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateEmployee(Employee employee)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using ProjectGasStation.Entities.Enums;
|
||||
using ProjectGasStation.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Implementations;
|
||||
|
||||
public class ProductRepository : IProductRepository
|
||||
{
|
||||
public void CreateProduct(Product product)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteProduct(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Product ReadProductById(int id)
|
||||
{
|
||||
return Product.CreateEntity(0, string.Empty, 0, ProductType.None);
|
||||
}
|
||||
|
||||
public IEnumerable<Product> ReadProducts()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateProduct(Product product)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -8,8 +8,4 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Entities\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,21 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
|
||||
public interface IEmployeeRepository
|
||||
{
|
||||
IEnumerable<Employee> ReadEmployees();
|
||||
|
||||
Employee ReadEmployeeById(int id);
|
||||
|
||||
void CreateEmployee(Employee employee);
|
||||
|
||||
void UpdateEmployee(Employee employee);
|
||||
|
||||
void DeleteEmployee(int id);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
|
||||
public interface IProductRepository
|
||||
{
|
||||
IEnumerable<Product> ReadProducts();
|
||||
|
||||
Product ReadProductById(int id);
|
||||
|
||||
void CreateProduct(Product product);
|
||||
|
||||
void UpdateProduct(Product product);
|
||||
|
||||
void DeleteProduct(int id);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
|
||||
public interface IPurchaseRepository
|
||||
{
|
||||
IEnumerable<Purchase> ReadPurchases(DateTime? dateFrom = null, DateTime? dateTo = null, int? supplierId = null, int? productId = null);
|
||||
|
||||
void CreatePurchase(Purchase purchase);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
|
||||
public interface ISaleRepository
|
||||
{
|
||||
IEnumerable<Sale> ReadSales(DateTime? dateFrom = null, DateTime? dateTo = null, int? productId = null, int? shiftId = null);
|
||||
|
||||
void CreateSale(Sale sale);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
|
||||
public interface IShiftRepository
|
||||
{
|
||||
IEnumerable<Shift> ReadShifts(DateTime? dateFrom = null, DateTime? dateTo = null, int? employeeId = null);
|
||||
|
||||
void CreateShift(Shift shift);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ProjectGasStation.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
|
||||
public interface ISupplierRepository
|
||||
{
|
||||
IEnumerable<Supplier> ReadSuppliers();
|
||||
|
||||
Supplier ReadSupplierById(int id);
|
||||
|
||||
void CreateSupplier(Supplier supplier);
|
||||
|
||||
void UpdateSupplier(Supplier supplier);
|
||||
|
||||
void DeleteSupplier(int id);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user