Добавил перечисление, сущьности. Осталось репозитории, формы и тп.

This commit is contained in:
MorozovDanil 2024-11-29 21:52:39 +04:00
parent 522b02f6a7
commit 7bc008185b
8 changed files with 203 additions and 0 deletions

View File

@ -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
};
}
}

View File

@ -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 // Со скидкой
}

View File

@ -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
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}