I am create all classes and interfaces

This commit is contained in:
Lazypr0ger 2024-11-12 19:18:35 +03:00
parent f0543820c0
commit 7963f6e9f0
28 changed files with 620 additions and 1 deletions

View File

@ -0,0 +1,20 @@
using ProductionInCehOTP.Entities.Enums;
namespace ProductionInCehOTP.Entities;
public class ArrivalMaterials
{
public int Id { get; set; }
public DateTime Date { get; set; }
public string Name { get; set; }
public static ArrivalMaterials CreateArrivalMaterials(int id, DateTime date, string name )
{
return new ArrivalMaterials
{
Id = id,
Date = date,
Name = name,
};
}
}

View File

@ -0,0 +1,9 @@
namespace ProductionInCehOTP.Entities.Enums;
[Flags]
public enum NameOfMaterials
{
Metal = 0,
GraphiteDust = 1,
Soil = 2,
Oil = 4
}

View File

@ -0,0 +1,7 @@
namespace ProductionInCehOTP.Entities.Enums;
public enum NameOfProductTypes
{
machine = 0,
kernel = 1
}

View File

@ -0,0 +1,12 @@
namespace ProductionInCehOTP.Entities.Enums;
public enum NameOfProducts
{
ch60 = 0,
ch65 = 1,
ch80 = 2,
ch85 = 3,
ch120 = 4,
ch160 = 5,
ch165 = 6
}

View File

@ -0,0 +1,20 @@
namespace ProductionInCehOTP.Entities;
public class Material
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public int ArrivalMaterialsID { get; private set; }
public int PlanID { get; private set; }
public static Material CreateMaterial(int id, string name, int arrivalMaterialsID, int planID)
{
return new Material
{
Id = id,
Name = name,
ArrivalMaterialsID = arrivalMaterialsID,
PlanID = planID
};
}
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProductionInCehOTP.Entities;
public class MaterialForProduct
{
public int ProductID { get; private set; }
public int[] MaterialID { get; private set; }
public int[] Count { get; private set; }
public static MaterialForProduct CreateDependenceMaterialsToProduct(int productID, int[] materialsId, int[]count)
{
return new MaterialForProduct { ProductID = productID, MaterialID = materialsId, Count = count };
}
}

View File

@ -0,0 +1,13 @@
namespace ProductionInCehOTP.Entities;
public class PlanWork
{
public int Id { get; private set; }
public int Plan { get; private set; }
public DateTime Date { get; private set; } = DateTime.Now;
public PlanWork CreatePlanWork(int id, int Plan, DateTime date)
{
return new PlanWork { Id = id, Plan = Plan, Date = date };
}
}

View File

@ -0,0 +1,20 @@
namespace ProductionInCehOTP.Entities;
public class PlanWorkForProduct
{
public int Id { get; private set; }
public int PlanWorkId { get; private set; }
public int ProductId { get; private set; }
public int Count { get; private set; }
public PlanWorkForProduct CreateDependencePlanWorkToProduct(int id, int planworkId, int productID, int Count)
{
return new PlanWorkForProduct
{
Id = id,
PlanWorkId = planworkId,
ProductId = productID,
Count = Count
};
}
}

View File

@ -0,0 +1,17 @@
using ProductionInCehOTP.Entities.Enums;
namespace ProductionInCehOTP.Entities;
public class Product
{
public int Id { get; private set; }
public NameOfProducts Name { get; private set; }
public int Price { get; private set; }
public int ProductionId { get; private set; }
public int ProductionTypeID { get; private set; }
public static Product CreateProducts(int id, NameOfProducts name, int price, int productionId, int productionTypeId)
{
return new Product { Id = id, Name = name, Price = price, ProductionId = productionId, ProductionTypeID = productionTypeId };
}
}

View File

@ -0,0 +1,18 @@
using ProductionInCehOTP.Entities.Enums;
namespace ProductionInCehOTP.Entities;
public class ProductType
{
public int Id { get; private set; }
public NameOfProductTypes Name { get; private set; }
public static ProductType CreateType(int id, NameOfProductTypes name)
{
return new ProductType
{
Id = id,
Name = name
};
}
}

View File

@ -0,0 +1,24 @@
using System.Runtime.CompilerServices;
namespace ProductionInCehOTP.Entities;
public class Worker
{
public int Id { get; private set; }
public string Name { get; private set; } = string.Empty;
public DateTime Experiebce { get; private set; }
public int ClassOfWorker { get; private set; }
public int PlanWork { get; private set; }
public static Worker CreateWorker(int id, string name, DateTime experience, int classOfWorker, int planWorkID)
{
return new Worker
{
Id = id,
Name = name,
Experiebce = experience,
ClassOfWorker = classOfWorker,
PlanWork = planWorkID
};
}
}

View File

@ -8,4 +8,8 @@
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unity" Version="5.11.10" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,45 @@
namespace ProductionInCehOTP
{
partial class ProductionInIndustrial
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
SuspendLayout();
//
// ProductionInIndustrial
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1043, 522);
Name = "ProductionInIndustrial";
Text = "ProductionInIndustrial";
ResumeLayout(false);
}
#endregion
}
}

View File

@ -0,0 +1,20 @@
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 ProductionInCehOTP
{
public partial class ProductionInIndustrial : Form
{
public ProductionInIndustrial()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,3 +1,7 @@
using ProductionInCehOTP.Repositories;
using ProductionInCehOTP.Repositories.Implementations;
using Unity;
namespace ProductionInCehOTP
{
internal static class Program
@ -11,7 +15,18 @@ namespace ProductionInCehOTP
// 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(CreateContainer().Resolve<ProductionInIndustrial>());
}
private static IUnityContainer CreateContainer()
{
var container = new UnityContainer();
container.RegisterType<IArrivalMaterialsRepository, ArrivalMaterialsRepository>();
container.RegisterType<IMaterialRepository, MaterialRepository>();
container.RegisterType<IProductRepository, ProductRepository>();
container.RegisterType<IProductTypeRepository, ProductTypeRepository>();
container.RegisterType<IPlanWorkRepository, PlanWorkRepository>();
container.RegisterType<IWorkerRepository, WorkerRepository>();
return container;
}
}
}

View File

@ -0,0 +1,10 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories;
public interface IArrivalMaterialsRepository
{
IEnumerable<ArrivalMaterials> GetMaterials(int ? ArrivalID,DateTime ? dateFrom = null, DateTime ? dateTo = null, string ? name = null );
void CreateArrivalMaterials(ArrivalMaterials material);
void DeleteArrivalMaterials(int id);
}

View File

@ -0,0 +1,13 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories;
public interface IMaterialRepository
{
IEnumerable<Material> GetMaterials();
Material GetMaterialById(int id);
void CreateMaterial (Material material);
void UpdateMaterial (Material material);
void DeleteMaterial (int id);
}

View File

@ -0,0 +1,10 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories;
public interface IPlanWorkRepository
{
IEnumerable<PlanWork> GetPlanWorks(int ? id = null, int ? plan = null, DateTime ? dateFrom = null, DateTime ? DateTo = null);
void CreatePlanWork(PlanWork planWork);
void DeletePlanWork(PlanWork planWork);
}

View File

@ -0,0 +1,11 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories;
public interface IProductRepository
{
IEnumerable<Product> GetProducts();
Product GetProductById(int productId);
void CreateProduct(Product product);
void UpdateProduct(Product product);
void DeleteProduct(int productId);
}

View File

@ -0,0 +1,13 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories;
public interface IProductTypeRepository
{
IEnumerable<ProductType> GetProductTypes();
ProductType GetProductTypeById(int id);
void CreateProductType(ProductType productType);
void UpdateProductType(ProductType productType);
void DeleteProductType(int id);
}

View File

@ -0,0 +1,14 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories;
public interface IWorkerRepository
{
IEnumerable<Worker> GetWorkers();
Worker GetWorkerById(int id);
void CreateWorker (Worker worker);
void UpdateWorker (Worker worker);
void DeleteWorker (Worker worker);
}

View File

@ -0,0 +1,21 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories.Implementations;
public class ArrivalMaterialsRepository : IArrivalMaterialsRepository
{
public void CreateArrivalMaterials(ArrivalMaterials material)
{
}
public void DeleteArrivalMaterials(int id)
{
}
public IEnumerable<ArrivalMaterials> GetMaterials(int? ArrivalID, DateTime? dateFrom = null, DateTime? dateTo = null, string? name = null)
{
return [];
}
}

View File

@ -0,0 +1,31 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories.Implementations;
public class MaterialRepository : IMaterialRepository
{
public void CreateMaterial(Material material)
{
}
public void DeleteMaterial(int id)
{
}
public Material GetMaterialById(int id)
{
return Material.CreateMaterial(0, string.Empty, 0, 0);
}
public IEnumerable<Material> GetMaterials()
{
return [];
}
public void UpdateMaterial(Material material)
{
}
}

View File

@ -0,0 +1,21 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories.Implementations;
public class PlanWorkRepository : IPlanWorkRepository
{
public void CreatePlanWork(PlanWork planWork)
{
}
public void DeletePlanWork(PlanWork planWork)
{
}
public IEnumerable<PlanWork> GetPlanWorks(int? id = null, int? plan = null, DateTime? dateFrom = null, DateTime? DateTo = null)
{
return [];
}
}

View File

@ -0,0 +1,31 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories.Implementations;
public class ProductRepository : IProductRepository
{
public void CreateProduct(Product product)
{
}
public void DeleteProduct(int productId)
{
}
public Product GetProductById(int productId)
{
return Product.CreateProducts(0, 0, 0, 0, 0);
}
public IEnumerable<Product> GetProducts()
{
return [];
}
public void UpdateProduct(Product product)
{
}
}

View File

@ -0,0 +1,30 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories.Implementations;
public class ProductTypeRepository : IProductTypeRepository
{
public void CreateProductType(ProductType productType)
{
}
public void DeleteProductType(int id)
{
}
public ProductType GetProductTypeById(int id)
{
return ProductType.CreateType(0,0);
}
public IEnumerable<ProductType> GetProductTypes()
{
return [];
}
public void UpdateProductType(ProductType productType)
{
}
}

View File

@ -0,0 +1,31 @@
using ProductionInCehOTP.Entities;
namespace ProductionInCehOTP.Repositories.Implementations;
public class WorkerRepository : IWorkerRepository
{
public void CreateWorker(Worker worker)
{
}
public void DeleteWorker(Worker worker)
{
}
public Worker GetWorkerById(int id)
{
return Worker.CreateWorker(0, string.Empty, DateTime.Now, 0, 0);
}
public IEnumerable<Worker> GetWorkers()
{
return [];
}
public void UpdateWorker(Worker worker)
{
}
}