PIbd-22 ZagidulinG.A. LabWork01 #1
28
Workshop/Entities/Cheque.cs
Normal file
28
Workshop/Entities/Cheque.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class Cheque
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public double Sum { get; private set; }
|
||||
public IEnumerable<ChequeProduct> ChequeProduct { get; private set; } = [];
|
||||
|
||||
public static Cheque CreateEntity(int id, int sum, IEnumerable<ChequeProduct> products)
|
||||
{
|
||||
return new Cheque()
|
||||
{
|
||||
Id = id,
|
||||
Sum = sum,
|
||||
Date = DateTime.Now,
|
||||
ChequeProduct = products
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
20
Workshop/Entities/ChequeProduct.cs
Normal file
20
Workshop/Entities/ChequeProduct.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
public class ChequeProduct
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int ChequeId { get; private set; }
|
||||
public static ChequeProduct CreateEntity(int productid, int chequeid)
|
||||
{
|
||||
return new ChequeProduct
|
||||
{
|
||||
ProductId = productid,
|
||||
ChequeId = chequeid
|
||||
};
|
||||
}
|
||||
}
|
15
Workshop/Entities/Enums/CreatingState.cs
Normal file
15
Workshop/Entities/Enums/CreatingState.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities.Enums;
|
||||
|
||||
public enum CreatingState
|
||||
{
|
||||
None = 0,
|
||||
Created = 1,
|
||||
InProgress = 2,
|
||||
Finished = 3
|
||||
}
|
16
Workshop/Entities/Enums/ProductCategory.cs
Normal file
16
Workshop/Entities/Enums/ProductCategory.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities.Enums;
|
||||
[Flags]
|
||||
public enum ProductCategory
|
||||
{
|
||||
None = 0,
|
||||
Furniture = 1,
|
||||
Gifts = 2,
|
||||
Kitchenware = 4,
|
||||
Tools = 8
|
||||
}
|
26
Workshop/Entities/Master.cs
Normal file
26
Workshop/Entities/Master.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class Master
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public string LastName { get; private set; } = string.Empty;
|
||||
public int Age { get; private set; }
|
||||
|
||||
public static Master CreateEntity(int id, string name, string lastName, int age)
|
||||
{
|
||||
return new Master
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
LastName = lastName,
|
||||
Age = age
|
||||
};
|
||||
}
|
||||
}
|
25
Workshop/Entities/Material.cs
Normal file
25
Workshop/Entities/Material.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class Material
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public int WarehouseAmount { get; private set; }
|
||||
public double Price { get; private set; }
|
||||
public static Material CreateEntity(int id, string name, int warehouseAmount, double price)
|
||||
{
|
||||
return new Material
|
||||
{
|
||||
Id = id,
|
||||
Name = name,
|
||||
WarehouseAmount = warehouseAmount,
|
||||
Price = price
|
||||
};
|
||||
}
|
||||
}
|
26
Workshop/Entities/Product.cs
Normal file
26
Workshop/Entities/Product.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Workshop.Entities.Enums;
|
||||
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
public double Price { get; private set; }
|
||||
public int WarehouseAmount { get; private set; }
|
||||
public ProductCategory Category { get; private set; }
|
||||
public int MasterId { get; private set; }
|
||||
public static Product CreateEntity(int id, string name, int price, int warehouseAmount,
|
||||
ProductCategory category, int masterId)
|
||||
{
|
||||
return new Product {
|
||||
Id = id,
|
||||
Name = name,
|
||||
Price = price,
|
||||
WarehouseAmount = warehouseAmount,
|
||||
Category = category,
|
||||
MasterId = masterId
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
29
Workshop/Entities/ProductCreate.cs
Normal file
29
Workshop/Entities/ProductCreate.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Workshop.Entities.Enums;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class ProductCreate
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int ProductId { get; private set; }
|
||||
public int MasterId { get; private set; }
|
||||
public DateTime CreatingDate { get; private set; }
|
||||
public CreatingState State { get; private set; }
|
||||
public static ProductCreate CreateOperation(int id, int productid, int masterid, CreatingState? state)
|
||||
{
|
||||
return new ProductCreate
|
||||
{
|
||||
Id = id,
|
||||
ProductId = productid,
|
||||
MasterId = masterid,
|
||||
State = state ?? CreatingState.None,
|
||||
CreatingDate = DateTime.Now
|
||||
};
|
||||
}
|
||||
|
||||
}
|
23
Workshop/Entities/ProductMaterial.cs
Normal file
23
Workshop/Entities/ProductMaterial.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Workshop.Entities;
|
||||
|
||||
public class ProductMaterial
|
||||
{
|
||||
public int ProductId { get; private set; }
|
||||
public int MaterialId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
public static ProductMaterial CreateEntity(int productId, int materialId, int count)
|
||||
{
|
||||
return new ProductMaterial
|
||||
{
|
||||
ProductId = productId,
|
||||
MaterialId = materialId,
|
||||
Count = count
|
||||
};
|
||||
}
|
||||
}
|
14
Workshop/Form1.Designer.cs
generated
14
Workshop/Form1.Designer.cs
generated
@ -28,10 +28,16 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
SuspendLayout();
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(800, 450);
|
||||
Name = "Form1";
|
||||
Text = "Form1";
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Loading…
Reference in New Issue
Block a user