edit models

This commit is contained in:
revengel66 2024-07-24 13:22:05 +04:00
parent a4023d8aff
commit 9fb4943f9b
29 changed files with 673 additions and 103 deletions

View File

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="BusinessLogics\" />
<ProjectReference Include="..\BeautySalonContracts\BeautySalonContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -6,11 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="BindingModels\" />
<Folder Include="ViewModels\" />
<Folder Include="StorageContracts\" />
<Folder Include="BusinessLogicsContracts\" />
</ItemGroup>
</Project>

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IClientStorage
public interface IClientStorage
{
List<ClientViewModel> GetFullList();
List<ClientViewModel> GetFilteredList(ClientBindingModel model);
ClientViewModel GetElement(ClientBindingModel model);
ClientViewModel Insert(ClientBindingModel model);
ClientViewModel Update(ClientBindingModel model);
ClientViewModel Deleted(ClientBindingModel model);
}
}

View File

@ -1,16 +1,18 @@

using System.Data;
using System.Runtime.InteropServices;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
public interface ICosmeticStorage
{
//CRUD
//public Create(new CosmeticBinngModel);
//public Read();
//public Update();
//public Deleted();
List<CosmeticViewModel> GetFullList();
List<CosmeticViewModel> GetFilteredList(CosmeticBindingModel model);
CosmeticViewModel GetElement(CosmeticBindingModel model);
CosmeticViewModel Insert(CosmeticBindingModel model);
CosmeticViewModel Update(CosmeticBindingModel model);
CosmeticViewModel Deleted(CosmeticBindingModel model);
}
}

View File

@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IDistributionStorage
public interface IDistributionStorage
{
List<DistributionViewModel> GetFullList();
List<DistributionViewModel> GetFilteredList(DistributionBindingModel model);
DistributionViewModel GetElement(DistributionBindingModel model);
DistributionViewModel Insert(DistributionBindingModel model);
DistributionViewModel Update(DistributionBindingModel model);
DistributionViewModel Deleted(DistributionBindingModel model);
}
}

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IEmployeeStorage
public interface IEmployeeStorage
{
List<EmployeeViewModel> GetFullList();
List<EmployeeViewModel> GetFilteredList(EmployeeBindingModel model);
EmployeeViewModel GetElement(EmployeeBindingModel model);
EmployeeViewModel Insert(EmployeeBindingModel model);
EmployeeViewModel Update(EmployeeBindingModel model);
EmployeeViewModel Deleted(EmployeeBindingModel model);
}
}

View File

@ -1,12 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IProcedureStorage
public interface IProcedureStorage
{
List<ProcedureViewModel> GetFullList();
List<ProcedureViewModel> GetFilteredList(ProcedureBindingModel model);
ProcedureViewModel GetElement(ProcedureBindingModel model);
ProcedureViewModel Insert(ProcedureBindingModel model);
ProcedureViewModel Update(ProcedureBindingModel model);
ProcedureViewModel Deleted(ProcedureBindingModel model);
}
}

View File

@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IPurchaseStorage
public interface IPurchaseStorage
{
List<PurchaseViewModel> GetFullList();
List<PurchaseViewModel> GetFilteredList(PurchaseBindingModel model);
PurchaseViewModel GetElement(PurchaseBindingModel model);
PurchaseViewModel Insert(PurchaseBindingModel model);
PurchaseViewModel Update(PurchaseBindingModel model);
PurchaseViewModel Deleted(PurchaseBindingModel model);
}
}

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IReceiptStorage
public interface IReceiptStorage
{
List<ReceiptViewModel> GetFullList();
List<ReceiptViewModel> GetFilteredList(ReceiptBindingModel model);
ReceiptViewModel GetElement(ReceiptBindingModel model);
ReceiptViewModel Insert(ReceiptBindingModel model);
ReceiptViewModel Update(ReceiptBindingModel model);
ReceiptViewModel Deleted(ReceiptBindingModel model);
}
}

View File

@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonContracts.StorageContracts
{
internal interface IVisitStorage
public interface IVisitStorage
{
List<VisitViewModel> GetFullList();
List<VisitViewModel> GetFilteredList(VisitBindingModel model);
VisitViewModel GetElement(VisitBindingModel model);
VisitViewModel Insert(VisitBindingModel model);
VisitViewModel Update(VisitBindingModel model);
VisitViewModel Deleted(VisitBindingModel model);
}
}

View File

@ -9,6 +9,6 @@ namespace BeautySalonContracts.ViewModels
[DisplayName("Дата покупки")]
public DateTime Date { get; set; }
[DisplayName("Сумма")]
public double Sum { get; }
public double Sum { get; set; }
}
}

View File

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<Folder Include="Implements\" />
<ProjectReference Include="..\BeautySalonContracts\BeautySalonContracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,39 @@

using BeautySalonDatabaseImplement.Models;
namespace BeautySalonListImplement
{
public class DataListSingleton
{
private static DataListSingleton? _instance;
public List<Client> Clients { get; set; }
public List<Cosmetic> Cosmetics { get; set; }
public List<Distribution> Distributions { get; set; }
public List<Employee> Employees { get; set; }
public List<Procedure> Procedures { get; set; }
public List<Purchase> Purchases { get; set; }
public List<Receipt> Receipts { get; set; }
public List<Visit> Visits { get; set; }
private DataListSingleton()
{
Clients = new List<Client>();
Cosmetics = new List<Cosmetic>();
Distributions = new List<Distribution>();
Employees = new List<Employee>();
Procedures = new List<Procedure>();
Purchases = new List<Purchase>();
Receipts = new List<Receipt>();
Visits = new List<Visit>();
}
public static DataListSingleton GetInstance()
{
if (_instance == null)
{
_instance = new DataListSingleton();
}
return _instance;
}
}
}

View File

@ -1,12 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class ClientStorage : IClientStorage
{
public ClientViewModel Deleted(ClientBindingModel model)
{
throw new NotImplementedException();
}
public ClientViewModel GetElement(ClientBindingModel model)
{
throw new NotImplementedException();
}
public List<ClientViewModel> GetFilteredList(ClientBindingModel model)
{
throw new NotImplementedException();
}
public List<ClientViewModel> GetFullList()
{
throw new NotImplementedException();
}
public ClientViewModel Insert(ClientBindingModel model)
{
throw new NotImplementedException();
}
public ClientViewModel Update(ClientBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
using BeautySalonListImplement;
namespace BeautySalonDatabaseImplement.Implements
{
internal class CosmeticStorage : ICosmeticStorage
public class CosmeticStorage : ICosmeticStorage
{
private readonly DataListSingleton _source;
public CosmeticStorage()
{
_source = DataListSingleton.GetInstance();
}
public CosmeticViewModel GetElement(CosmeticBindingModel model)
{
foreach(var cosmetic in _source.Cosmetics)
}
public List<CosmeticViewModel> GetFilteredList(CosmeticBindingModel model)
{
throw new NotImplementedException();
}
public List<CosmeticViewModel> GetFullList()
{
throw new NotImplementedException();
}
public CosmeticViewModel Insert(CosmeticBindingModel model)
{
throw new NotImplementedException();
}
public CosmeticViewModel Update(CosmeticBindingModel model)
{
throw new NotImplementedException();
}
public CosmeticViewModel Deleted(CosmeticBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class DistributionStorage : IDistributionStorage
{
public DistributionViewModel Deleted(DistributionBindingModel model)
{
throw new NotImplementedException();
}
public DistributionViewModel GetElement(DistributionBindingModel model)
{
throw new NotImplementedException();
}
public List<DistributionViewModel> GetFilteredList(DistributionBindingModel model)
{
throw new NotImplementedException();
}
public List<DistributionViewModel> GetFullList()
{
throw new NotImplementedException();
}
public DistributionViewModel Insert(DistributionBindingModel model)
{
throw new NotImplementedException();
}
public DistributionViewModel Update(DistributionBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class EmployeeStorage : IEmployeeStorage
{
public EmployeeViewModel Deleted(EmployeeBindingModel model)
{
throw new NotImplementedException();
}
public EmployeeViewModel GetElement(EmployeeBindingModel model)
{
throw new NotImplementedException();
}
public List<EmployeeViewModel> GetFilteredList(EmployeeBindingModel model)
{
throw new NotImplementedException();
}
public List<EmployeeViewModel> GetFullList()
{
throw new NotImplementedException();
}
public EmployeeViewModel Insert(EmployeeBindingModel model)
{
throw new NotImplementedException();
}
public EmployeeViewModel Update(EmployeeBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class ProcedureStorage : IProcedureStorage
{
public ProcedureViewModel Deleted(ProcedureBindingModel model)
{
throw new NotImplementedException();
}
public ProcedureViewModel GetElement(ProcedureBindingModel model)
{
throw new NotImplementedException();
}
public List<ProcedureViewModel> GetFilteredList(ProcedureBindingModel model)
{
throw new NotImplementedException();
}
public List<ProcedureViewModel> GetFullList()
{
throw new NotImplementedException();
}
public ProcedureViewModel Insert(ProcedureBindingModel model)
{
throw new NotImplementedException();
}
public ProcedureViewModel Update(ProcedureBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class PurchaseStorage : IPurchaseStorage
{
public PurchaseViewModel Deleted(PurchaseBindingModel model)
{
throw new NotImplementedException();
}
public PurchaseViewModel GetElement(PurchaseBindingModel model)
{
throw new NotImplementedException();
}
public List<PurchaseViewModel> GetFilteredList(PurchaseBindingModel model)
{
throw new NotImplementedException();
}
public List<PurchaseViewModel> GetFullList()
{
throw new NotImplementedException();
}
public PurchaseViewModel Insert(PurchaseBindingModel model)
{
throw new NotImplementedException();
}
public PurchaseViewModel Update(PurchaseBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class ReceiptStorage : IReceiptStorage
{
public ReceiptViewModel Deleted(ReceiptBindingModel model)
{
throw new NotImplementedException();
}
public ReceiptViewModel GetElement(ReceiptBindingModel model)
{
throw new NotImplementedException();
}
public List<ReceiptViewModel> GetFilteredList(ReceiptBindingModel model)
{
throw new NotImplementedException();
}
public List<ReceiptViewModel> GetFullList()
{
throw new NotImplementedException();
}
public ReceiptViewModel Insert(ReceiptBindingModel model)
{
throw new NotImplementedException();
}
public ReceiptViewModel Update(ReceiptBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,12 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.StorageContracts;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Implements
{
internal class VisitStorage : IVisitStorage
{
public VisitViewModel Deleted(VisitBindingModel model)
{
throw new NotImplementedException();
}
public VisitViewModel GetElement(VisitBindingModel model)
{
throw new NotImplementedException();
}
public List<VisitViewModel> GetFilteredList(VisitBindingModel model)
{
throw new NotImplementedException();
}
public List<VisitViewModel> GetFullList()
{
throw new NotImplementedException();
}
public VisitViewModel Insert(VisitBindingModel model)
{
throw new NotImplementedException();
}
public VisitViewModel Update(VisitBindingModel model)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,4 +1,8 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using System.Diagnostics;
namespace BeautySalonDatabaseImplement.Models
{
public class Client
@ -9,5 +13,45 @@ namespace BeautySalonDatabaseImplement.Models
public string? Login { get; set; }
public string? Password { get; set; }
public string? Phone { get; set; }
public static Client? Create(ClientBindingModel model)
{
if (model == null)
{
return null;
}
return new Client
{
Id = model.Id,
Name = model.Name,
Surname = model.Surname,
Login = model.Login,
Password = model.Password,
Phone = model.Phone,
};
}
public void Update(ClientBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
Surname = model.Surname;
Login = model.Login;
Password = model.Password;
Phone = model.Phone;
}
public ClientViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Surname = Surname,
Login = Login,
Password = Password,
Phone = Phone
};
}
}

View File

@ -1,4 +1,7 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
public class Cosmetic
@ -7,6 +10,35 @@ namespace BeautySalonDatabaseImplement.Models
public string? Name { get; set; }
public double Price { get; set; }
public static Cosmetic? Create(CosmeticBindingModel model)
{
if (model == null)
{
return null;
}
return new Cosmetic
{
Id = model.Id,
Name = model.Name,
Price = model.Price
};
}
public void Update(CosmeticBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
Price = model.Price;
}
public CosmeticViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Price = Price
};
}
}

View File

@ -1,4 +1,10 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using System.Numerics;
using System.Reflection;
using System.Xml.Linq;
namespace BeautySalonDatabaseImplement.Models
{
public class Distribution
@ -6,5 +12,34 @@ namespace BeautySalonDatabaseImplement.Models
public int Id { get; set; }
public DateTime Date { get; set; }
public double Sum { get; set; }
public static Distribution? Create(DistributionBindingModel model)
{
if (model == null)
{
return null;
}
return new Distribution
{
Id = model.Id,
Date = model.Date,
Sum = model.Sum
};
}
public void Update(DistributionBindingModel model)
{
if (model == null)
{
return;
}
Date = model.Date;
Sum = model.Sum;
}
public DistributionViewModel GetViewModel => new()
{
Id = Id,
Date = Date,
Sum = Sum
};
}
}

View File

@ -1,4 +1,7 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
public class Employee
@ -9,5 +12,44 @@ namespace BeautySalonDatabaseImplement.Models
public string? Login { get; set; }
public string? Password { get; set; }
public string? Phone { get; set; }
public static Employee? Create(EmployeeBindingModel model)
{
if (model == null)
{
return null;
}
return new Employee
{
Id = model.Id,
Name = model.Name,
Surname = model.Surname,
Login = model.Login,
Password = model.Password,
Phone = model.Phone,
};
}
public void Update(EmployeeBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
Surname = model.Surname;
Login = model.Login;
Password = model.Password;
Phone = model.Phone;
}
public EmployeeViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Surname = Surname,
Login = Login,
Password = Password,
Phone = Phone
};
}
}

View File

@ -1,4 +1,8 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
using System.Reflection;
namespace BeautySalonDatabaseImplement.Models
{
public class Procedure
@ -7,5 +11,38 @@ namespace BeautySalonDatabaseImplement.Models
public string? Name { get; set; }
public double Price { get; set; }
public string? FIO_Master { get; set; }
public static Procedure? Create(ProcedureBindingModel model)
{
if (model == null)
{
return null;
}
return new Procedure
{
Id = model.Id,
Name = model.Name,
Price = model.Price,
FIO_Master = model.FIO_Master
};
}
public void Update(ProcedureBindingModel model)
{
if (model == null)
{
return;
}
Name = model.Name;
Price = model.Price;
FIO_Master = model.FIO_Master;
}
public ProcedureViewModel GetViewModel => new()
{
Id = Id,
Name = Name,
Price = Price,
FIO_Master = FIO_Master
};
}
}

View File

@ -1,10 +1,42 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
public class Purchase
{
public int Id { get; set; }
public DateTime Date { get; set; }
public double Sum { get;}
public double Sum { get; set; }
public static Purchase? Create(PurchaseBindingModel model)
{
if (model == null)
{
return null;
}
return new Purchase
{
Id = model.Id,
Date = model.Date,
Sum = model.Sum
};
}
public void Update(PurchaseBindingModel model)
{
if (model == null)
{
return;
}
Date = model.Date;
Sum = model.Sum;
}
public PurchaseViewModel GetViewModel => new()
{
Id = Id,
Date = Date,
Sum = Sum
};
}
}

View File

@ -1,4 +1,7 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
public class Receipt
@ -6,5 +9,34 @@ namespace BeautySalonDatabaseImplement.Models
public int Id { get; set; }
public DateTime Date { get; set; }
public double Sum { get; set; }
public static Receipt? Create(ReceiptBindingModel model)
{
if (model == null)
{
return null;
}
return new Receipt
{
Id = model.Id,
Date = model.Date,
Sum = model.Sum
};
}
public void Update(ReceiptBindingModel model)
{
if (model == null)
{
return;
}
Date = model.Date;
Sum = model.Sum;
}
public ReceiptViewModel GetViewModel => new()
{
Id = Id,
Date = Date,
Sum = Sum
};
}
}

View File

@ -1,4 +1,7 @@

using BeautySalonContracts.BindingModels;
using BeautySalonContracts.ViewModels;
namespace BeautySalonDatabaseImplement.Models
{
public class Visit
@ -6,5 +9,35 @@ namespace BeautySalonDatabaseImplement.Models
public int Id { get; set; }
public DateTime Date { get; set; }
public double Sum { get; set; }
public static Visit? Create(VisitBindingModel model)
{
if (model == null)
{
return null;
}
return new Visit
{
Id = model.Id,
Date = model.Date,
Sum = model.Sum
};
}
public void Update(VisitBindingModel model)
{
if (model == null)
{
return;
}
Date = model.Date;
Sum = model.Sum;
}
public VisitViewModel GetViewModel => new()
{
Id = Id,
Date = Date,
Sum = Sum
};
}
}