From c7e0c3823aa874866cb3c87a04df4c6a692bd618 Mon Sep 17 00:00:00 2001 From: devil_1nc Date: Tue, 11 Jun 2024 12:18:10 +0400 Subject: [PATCH] scroogie models update --- .../BindingModels/MediaFileBindingModel.cs | 15 ++++++++++++ .../BindingModels/ProductBindingModel.cs | 16 +++++++++++++ .../BindingModels/PurchaseBindingModel.cs | 14 +++++++++++ Contracts/BindingModels/SellBindingModel.cs | 13 ++++++++++ .../IEmployeeProductLogic.cs | 24 +++++++++++++++++++ .../BusinessLogicContracts/IPurchaseLogic.cs | 24 +++++++++++++++++++ .../BusinessLogicContracts/ISellLogic.cs | 24 +++++++++++++++++++ .../IUserProductLogic.cs | 21 ++++++++++++++++ Contracts/Contracts.csproj | 4 ++++ Contracts/SearchModels/ProductSearchModel.cs | 16 +++++++++++++ Contracts/SearchModels/PurchaseSearchModel.cs | 20 ++++++++++++++++ Contracts/SearchModels/SellSearchModel.cs | 16 +++++++++++++ Contracts/StorageContracts/IProductStorage.cs | 23 ++++++++++++++++++ .../StorageContracts/IPurchaseStorage.cs | 23 ++++++++++++++++++ Contracts/StorageContracts/ISellStorage.cs | 23 ++++++++++++++++++ .../ViewModels/EmployeeProductViewModel.cs | 15 ++++++++++++ Contracts/ViewModels/PurchaseViewModel.cs | 19 +++++++++++++++ Contracts/ViewModels/SellViewModel.cs | 16 +++++++++++++ Contracts/ViewModels/UserProductViewModel.cs | 15 ++++++++++++ DataModels/Enums/PurchaseStatus.cs | 15 ++++++++++++ DataModels/Models/IMediaFile.cs | 14 +++++++++++ DataModels/Models/IProduct.cs | 17 +++++++++++++ DataModels/Models/IPurchase.cs | 15 ++++++++++++ DataModels/Models/ISell.cs | 13 ++++++++++ DataModels/Models/ISupplyDoc.cs | 13 ++++++++++ DatabaseImplement/Models/MediaFile.cs | 18 ++++++++++++++ DatabaseImplement/Models/Product.cs | 12 ++++++++++ DatabaseImplement/Models/Purchase.cs | 21 ++++++++++++++++ DatabaseImplement/Models/Sell.cs | 12 ++++++++++ 29 files changed, 491 insertions(+) create mode 100644 Contracts/BindingModels/MediaFileBindingModel.cs create mode 100644 Contracts/BindingModels/ProductBindingModel.cs create mode 100644 Contracts/BindingModels/PurchaseBindingModel.cs create mode 100644 Contracts/BindingModels/SellBindingModel.cs create mode 100644 Contracts/BusinessLogicContracts/IEmployeeProductLogic.cs create mode 100644 Contracts/BusinessLogicContracts/IPurchaseLogic.cs create mode 100644 Contracts/BusinessLogicContracts/ISellLogic.cs create mode 100644 Contracts/BusinessLogicContracts/IUserProductLogic.cs create mode 100644 Contracts/SearchModels/ProductSearchModel.cs create mode 100644 Contracts/SearchModels/PurchaseSearchModel.cs create mode 100644 Contracts/SearchModels/SellSearchModel.cs create mode 100644 Contracts/StorageContracts/IProductStorage.cs create mode 100644 Contracts/StorageContracts/IPurchaseStorage.cs create mode 100644 Contracts/StorageContracts/ISellStorage.cs create mode 100644 Contracts/ViewModels/EmployeeProductViewModel.cs create mode 100644 Contracts/ViewModels/PurchaseViewModel.cs create mode 100644 Contracts/ViewModels/SellViewModel.cs create mode 100644 Contracts/ViewModels/UserProductViewModel.cs create mode 100644 DataModels/Enums/PurchaseStatus.cs create mode 100644 DataModels/Models/IMediaFile.cs create mode 100644 DataModels/Models/IProduct.cs create mode 100644 DataModels/Models/IPurchase.cs create mode 100644 DataModels/Models/ISell.cs create mode 100644 DataModels/Models/ISupplyDoc.cs create mode 100644 DatabaseImplement/Models/MediaFile.cs create mode 100644 DatabaseImplement/Models/Product.cs create mode 100644 DatabaseImplement/Models/Purchase.cs create mode 100644 DatabaseImplement/Models/Sell.cs diff --git a/Contracts/BindingModels/MediaFileBindingModel.cs b/Contracts/BindingModels/MediaFileBindingModel.cs new file mode 100644 index 0000000..656354a --- /dev/null +++ b/Contracts/BindingModels/MediaFileBindingModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BindingModels +{ + public class MediaFileBindingModel + { + public Guid Id { get; set; } + public Guid ProductId { get; set; } + public string Location { get; set; } = string.Empty; + } +} diff --git a/Contracts/BindingModels/ProductBindingModel.cs b/Contracts/BindingModels/ProductBindingModel.cs new file mode 100644 index 0000000..6be324e --- /dev/null +++ b/Contracts/BindingModels/ProductBindingModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BindingModels +{ + public class ProductBindingModel + { + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public double Price { get; set; } + public int Amount { get; set; } + } +} diff --git a/Contracts/BindingModels/PurchaseBindingModel.cs b/Contracts/BindingModels/PurchaseBindingModel.cs new file mode 100644 index 0000000..c0e577d --- /dev/null +++ b/Contracts/BindingModels/PurchaseBindingModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BindingModels +{ + public class PurchaseBindingModel + { + public Guid Id { get; set; } + public DateTime DatePurchase { get; set; } + } +} diff --git a/Contracts/BindingModels/SellBindingModel.cs b/Contracts/BindingModels/SellBindingModel.cs new file mode 100644 index 0000000..7f2c663 --- /dev/null +++ b/Contracts/BindingModels/SellBindingModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BindingModels +{ + public class SellBindingModel + { + public DateTime DateSell { get; set; } + } +} diff --git a/Contracts/BusinessLogicContracts/IEmployeeProductLogic.cs b/Contracts/BusinessLogicContracts/IEmployeeProductLogic.cs new file mode 100644 index 0000000..c61ace2 --- /dev/null +++ b/Contracts/BusinessLogicContracts/IEmployeeProductLogic.cs @@ -0,0 +1,24 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using Contracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BusinessLogicContracts +{ + public interface IEmployeeProductLogic + { + EmployeeProductViewModel Create(ProductBindingModel model); + + EmployeeProductViewModel Update(ProductBindingModel model); + + EmployeeProductViewModel ReadElement(ProductSearchModel model); + + IEnumerable ReadElements(ProductSearchModel? model); + + EmployeeProductViewModel Delete(ProductSearchModel model); + } +} diff --git a/Contracts/BusinessLogicContracts/IPurchaseLogic.cs b/Contracts/BusinessLogicContracts/IPurchaseLogic.cs new file mode 100644 index 0000000..65892dd --- /dev/null +++ b/Contracts/BusinessLogicContracts/IPurchaseLogic.cs @@ -0,0 +1,24 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using Contracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BusinessLogicContracts +{ + public interface IPurchaseLogic + { + PurchaseViewModel Create(PurchaseBindingModel model); + + PurchaseViewModel Update(PurchaseBindingModel model); + + PurchaseViewModel ReadElement(PurchaseSearchModel model); + + IEnumerable ReadElements(PurchaseSearchModel? model); + + PurchaseViewModel Delete(PurchaseSearchModel model); + } +} diff --git a/Contracts/BusinessLogicContracts/ISellLogic.cs b/Contracts/BusinessLogicContracts/ISellLogic.cs new file mode 100644 index 0000000..471cfb2 --- /dev/null +++ b/Contracts/BusinessLogicContracts/ISellLogic.cs @@ -0,0 +1,24 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using Contracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BusinessLogicContracts +{ + public interface ISellLogic + { + SellViewModel Create(SellBindingModel model); + + SellViewModel Update(SellBindingModel model); + + SellViewModel ReadElement(SellSearchModel model); + + IEnumerable ReadElements(SellSearchModel? model); + + SellViewModel Delete(SellSearchModel model); + } +} diff --git a/Contracts/BusinessLogicContracts/IUserProductLogic.cs b/Contracts/BusinessLogicContracts/IUserProductLogic.cs new file mode 100644 index 0000000..049cfdc --- /dev/null +++ b/Contracts/BusinessLogicContracts/IUserProductLogic.cs @@ -0,0 +1,21 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using Contracts.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.BusinessLogicContracts +{ + public interface IUserProductLogic + { + + UserProductViewModel ReadElement(ProductSearchModel model); + + IEnumerable ReadElements(ProductSearchModel? model); + + UserProductViewModel Delete(ProductSearchModel model); + } +} diff --git a/Contracts/Contracts.csproj b/Contracts/Contracts.csproj index fa71b7a..f1b5623 100644 --- a/Contracts/Contracts.csproj +++ b/Contracts/Contracts.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/Contracts/SearchModels/ProductSearchModel.cs b/Contracts/SearchModels/ProductSearchModel.cs new file mode 100644 index 0000000..a6527dd --- /dev/null +++ b/Contracts/SearchModels/ProductSearchModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.SearchModels +{ + public class ProductSearchModel + { + public Guid? Id { get; set; } + public string? Name { get; set; } + public double? Price { get; set; } + public double? Rate { get; set; } + } +} diff --git a/Contracts/SearchModels/PurchaseSearchModel.cs b/Contracts/SearchModels/PurchaseSearchModel.cs new file mode 100644 index 0000000..1dc89d7 --- /dev/null +++ b/Contracts/SearchModels/PurchaseSearchModel.cs @@ -0,0 +1,20 @@ +using DataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace Contracts.SearchModels +{ + public class PurchaseSearchModel + { + public Guid? Id { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + public double? PriceFrom { get; set; } + public double? PriceTo { get; set; } + public PurchaseStatus? Status { get; set; } + } +} diff --git a/Contracts/SearchModels/SellSearchModel.cs b/Contracts/SearchModels/SellSearchModel.cs new file mode 100644 index 0000000..8564cf4 --- /dev/null +++ b/Contracts/SearchModels/SellSearchModel.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.SearchModels +{ + public class SellSearchModel + { + public Guid? Id { get; set; } + public DateTime? DateFrom { get; set; } + public DateTime? DateTo { get; set; } + public Guid? SupplyDocId { get; set; } + } +} diff --git a/Contracts/StorageContracts/IProductStorage.cs b/Contracts/StorageContracts/IProductStorage.cs new file mode 100644 index 0000000..49ce4e3 --- /dev/null +++ b/Contracts/StorageContracts/IProductStorage.cs @@ -0,0 +1,23 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.StorageContracts +{ + public interface IProductStorage + { + ProductBindingModel? Insert(ProductBindingModel model); + + IEnumerable GetList(ProductSearchModel? model); + + ProductBindingModel? GetElement(ProductSearchModel model); + + ProductBindingModel? Update(ProductBindingModel model); + + ProductBindingModel? Delete(ProductSearchModel model); + } +} diff --git a/Contracts/StorageContracts/IPurchaseStorage.cs b/Contracts/StorageContracts/IPurchaseStorage.cs new file mode 100644 index 0000000..855831a --- /dev/null +++ b/Contracts/StorageContracts/IPurchaseStorage.cs @@ -0,0 +1,23 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.StorageContracts +{ + public interface IPurchaseStorage + { + PurchaseBindingModel? Insert(PurchaseBindingModel model); + + IEnumerable GetList(PurchaseSearchModel? model); + + PurchaseBindingModel? GetElement(PurchaseSearchModel model); + + PurchaseBindingModel? Update(PurchaseBindingModel model); + + PurchaseBindingModel? Delete(PurchaseSearchModel model); + } +} diff --git a/Contracts/StorageContracts/ISellStorage.cs b/Contracts/StorageContracts/ISellStorage.cs new file mode 100644 index 0000000..ba31175 --- /dev/null +++ b/Contracts/StorageContracts/ISellStorage.cs @@ -0,0 +1,23 @@ +using Contracts.BindingModels; +using Contracts.SearchModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.StorageContracts +{ + public interface ISellStorage + { + SellBindingModel? Insert(SellBindingModel model); + + IEnumerable GetList(SellSearchModel? model); + + SellBindingModel? GetElement(SellSearchModel model); + + SellBindingModel? Update(SellBindingModel model); + + SellBindingModel? Delete(SellSearchModel model); + } +} diff --git a/Contracts/ViewModels/EmployeeProductViewModel.cs b/Contracts/ViewModels/EmployeeProductViewModel.cs new file mode 100644 index 0000000..ecf629a --- /dev/null +++ b/Contracts/ViewModels/EmployeeProductViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.ViewModels +{ + public class EmployeeProductViewModel + { + public Guid Guid { get; set; } + public string Name { get; set; } = string.Empty; + public double Price { get; set; } + } +} diff --git a/Contracts/ViewModels/PurchaseViewModel.cs b/Contracts/ViewModels/PurchaseViewModel.cs new file mode 100644 index 0000000..f777858 --- /dev/null +++ b/Contracts/ViewModels/PurchaseViewModel.cs @@ -0,0 +1,19 @@ +using DataModels.Enums; +using DataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.ViewModels +{ + public class PurchaseViewModel + { + public Guid Id { get; set; } + public DateTime PurchaseDate { get; set; } + public required IUser User { get; set; } + public required List Products { get; set; } + public PurchaseStatus Status { get; set; } + } +} diff --git a/Contracts/ViewModels/SellViewModel.cs b/Contracts/ViewModels/SellViewModel.cs new file mode 100644 index 0000000..54a40bd --- /dev/null +++ b/Contracts/ViewModels/SellViewModel.cs @@ -0,0 +1,16 @@ +using DataModels.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.ViewModels +{ + public class SellViewModel + { + public Guid Id { get; set; } + public DateTime SellDate { get; set; } + public ISupplyDoc? SupplyDoc { get; set; } + } +} diff --git a/Contracts/ViewModels/UserProductViewModel.cs b/Contracts/ViewModels/UserProductViewModel.cs new file mode 100644 index 0000000..2da47eb --- /dev/null +++ b/Contracts/ViewModels/UserProductViewModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Contracts.ViewModels +{ + public class UserProductViewModel + { + public string Name { get; set; } = string.Empty; + public double Price { get; set; } + public double Rate { get; set; } + } +} diff --git a/DataModels/Enums/PurchaseStatus.cs b/DataModels/Enums/PurchaseStatus.cs new file mode 100644 index 0000000..1107f4d --- /dev/null +++ b/DataModels/Enums/PurchaseStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataModels.Enums +{ + public enum PurchaseStatus + { + Unknown = -1, + Processing = 0, + Complited = 1 + } +} diff --git a/DataModels/Models/IMediaFile.cs b/DataModels/Models/IMediaFile.cs new file mode 100644 index 0000000..34eec99 --- /dev/null +++ b/DataModels/Models/IMediaFile.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataModels.Models +{ + public interface IMediaFile + { + string Name { get; } + string Location { get; } + } +} diff --git a/DataModels/Models/IProduct.cs b/DataModels/Models/IProduct.cs new file mode 100644 index 0000000..b263796 --- /dev/null +++ b/DataModels/Models/IProduct.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataModels.Models +{ + public interface IProduct : IId + { + string Name { get; } + double Price { get; } + bool IBeingSold { get; } + public double Rate { get; } + int Amount { get; } + } +} diff --git a/DataModels/Models/IPurchase.cs b/DataModels/Models/IPurchase.cs new file mode 100644 index 0000000..e13e222 --- /dev/null +++ b/DataModels/Models/IPurchase.cs @@ -0,0 +1,15 @@ +using DataModels.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataModels.Models +{ + public interface IPurchase : IId + { + DateTime DatePurchase { get; } + PurchaseStatus Status { get; } + } +} diff --git a/DataModels/Models/ISell.cs b/DataModels/Models/ISell.cs new file mode 100644 index 0000000..c10496f --- /dev/null +++ b/DataModels/Models/ISell.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataModels.Models +{ + public interface ISell : IId + { + DateTime DateSell { get; } + } +} diff --git a/DataModels/Models/ISupplyDoc.cs b/DataModels/Models/ISupplyDoc.cs new file mode 100644 index 0000000..cb1f6c4 --- /dev/null +++ b/DataModels/Models/ISupplyDoc.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataModels.Models +{ + public interface ISupplyDoc : IId + { + string Name { get; } + } +} diff --git a/DatabaseImplement/Models/MediaFile.cs b/DatabaseImplement/Models/MediaFile.cs new file mode 100644 index 0000000..8c7e084 --- /dev/null +++ b/DatabaseImplement/Models/MediaFile.cs @@ -0,0 +1,18 @@ +using DataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseImplement.Models +{ + public class MediaFile : IMediaFile + { + [Required] + public string Name { get; set; } + [Required] + public string Location { get; set; } + } +} diff --git a/DatabaseImplement/Models/Product.cs b/DatabaseImplement/Models/Product.cs new file mode 100644 index 0000000..6f6a242 --- /dev/null +++ b/DatabaseImplement/Models/Product.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseImplement.Models +{ + public class Product + { + } +} diff --git a/DatabaseImplement/Models/Purchase.cs b/DatabaseImplement/Models/Purchase.cs new file mode 100644 index 0000000..ecb1efc --- /dev/null +++ b/DatabaseImplement/Models/Purchase.cs @@ -0,0 +1,21 @@ +using DataModels.Enums; +using DataModels.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseImplement.Models +{ + public class Purchase : IPurchase + { + public Guid Id { get; set; } + [Required] + public DateTime DatePurchase { get; set; } + [Required] + public PurchaseStatus Status { get; private set; } = PurchaseStatus.Unknown; + + } +} diff --git a/DatabaseImplement/Models/Sell.cs b/DatabaseImplement/Models/Sell.cs new file mode 100644 index 0000000..3376e82 --- /dev/null +++ b/DatabaseImplement/Models/Sell.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DatabaseImplement.Models +{ + internal class Sell + { + } +}