PIbd-22 ZagidulinG.A. LabWork01 #1

Open
Grigorii_Zagidulin wants to merge 4 commits from Lab1 into main
10 changed files with 218 additions and 4 deletions
Showing only changes of commit 289b42dd9b - Show all commits

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

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

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

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

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

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

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

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

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

View File

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