diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Detail.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Detail.cs new file mode 100644 index 0000000..fc60a05 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Detail.cs @@ -0,0 +1,29 @@ +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Detail +{ + public int Id { get; private set; } + public string NameDetail { get; private set; } = string.Empty; + public int NumberDetail { get; private set; } + public int PriceDetail { get; private set; } + public DetailProperties DetailProperties { get; private set; } + + public static Detail CreateEntity(int id, string nameDetail, int numberDetail, int priceDetail, DetailProperties detailProperties) + { + return new Detail + { + Id = id, + NameDetail = nameDetail, + NumberDetail = numberDetail, + PriceDetail = priceDetail, + DetailProperties = detailProperties + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/DetailProperties.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/DetailProperties.cs new file mode 100644 index 0000000..2bb1512 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/DetailProperties.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities.Enums; + +[Flags] +public enum DetailProperties +{ + None = 0, // Нет свойств + Fragile = 1, // Хрупкая деталь + Heavy = 2, // Тяжелая + Expensive = 4, // Дорогая + CustomMade = 8, // Изготовлена на заказ + InStock = 16, // В наличии + Discounted = 32 // Со скидкой +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/MasterPost.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/MasterPost.cs new file mode 100644 index 0000000..d014c30 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Enums/MasterPost.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities.Enums; + +public enum MasterPost +{ + None = 0, + Intern = 1, + Worker = 2, + Head = 3 + +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Master.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Master.cs new file mode 100644 index 0000000..67076c8 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Master.cs @@ -0,0 +1,27 @@ +using ProjectRepairCompany.Entities.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Master +{ + public int Id { get; private set; } + public string MasterName { get; private set; } = string.Empty; + public DateTime StartDate { get; private set; } + public MasterPost MasterPost { get; private set; } + + public static Master CreateEntity(int id, string masterName, MasterPost masterPost) + { + return new Master + { + Id = id, + MasterName = masterName, + StartDate = DateTime.Now, + MasterPost = masterPost + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Order.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Order.cs new file mode 100644 index 0000000..1b32603 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Order.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Order +{ + public int Id { get; private set; } + public DateTime OrderDate { get; private set; } + public DateTime? DateCompletion { get; private set; } // уточнить + public DateTime? DateIssue { get; private set; } // уточнить + public int FullPrice { get; private set; } + public int MasterId { get; private set; } + + public static Order CreateOperation(int id, int fullPrice, int masterId, DateTime? dateCompletion = null, DateTime? dateIssue = null) + { + if (dateCompletion.HasValue && dateCompletion < DateTime.Now) + throw new ArgumentException("Дата начала ремонта не может быть раньше текущей даты."); + + if (dateIssue.HasValue && dateCompletion.HasValue && dateIssue < dateCompletion) + throw new ArgumentException("Дата выдачи не может быть раньше даты начала ремонта."); + + return new Order + { + Id = id, + OrderDate = DateTime.Now, // Автоматически задается текущая дата + DateCompletion = dateCompletion, // Задается вручную, если есть + DateIssue = dateIssue, // Задается вручную, если есть + FullPrice = fullPrice, + MasterId = masterId + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/OrderDetail.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/OrderDetail.cs new file mode 100644 index 0000000..d240c09 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/OrderDetail.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class OrderDetail +{ + public int OrderId { get; private set; } + public int DetailId { get; private set; } + public int DetailPrice { get; private set; } + public int DetailCount { get; private set; } + + public static OrderDetail CreateOperation(int orderId, int detailId, int detailPrice, int detailCount) + { + return new OrderDetail + { + OrderId = orderId, + DetailId = detailId, + DetailPrice = detailPrice, + DetailCount = detailCount + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/Storage.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/Storage.cs new file mode 100644 index 0000000..0bf4dc7 --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/Storage.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class Storage +{ + public int Id { get; private set; } + public string StorageAddress { get; private set; } = string.Empty; + public int Capacity { get; private set; } + + public static Storage CreateEntity(int id, string storageAddress, int capacity) + { + return new Storage + { + Id = id, + StorageAddress = storageAddress, + Capacity = capacity + }; + } +} diff --git a/ProjectRepairCompany/ProjectRepairCompany/Entities/StorageDetail.cs b/ProjectRepairCompany/ProjectRepairCompany/Entities/StorageDetail.cs new file mode 100644 index 0000000..bdec3fe --- /dev/null +++ b/ProjectRepairCompany/ProjectRepairCompany/Entities/StorageDetail.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectRepairCompany.Entities; + +public class StorageDetail +{ + public int StorageId { get; private set; } + public int DetailId { get; private set; } + public int DetailCount { get; private set; } + public DateTime SupplyDate { get; private set; } // Дата поступления деталей + + public static StorageDetail CreateOperation(int storageId, int detailId, int detailCount, DateTime supplyDate) + { + return new StorageDetail + { + StorageId = storageId, + DetailId = detailId, + DetailCount = detailCount, + SupplyDate = supplyDate + }; + } +}