Merge branch 'Kalyshev'

This commit is contained in:
Калышев Ян 2023-04-05 14:35:40 +04:00
commit fb8c1fb763
17 changed files with 94 additions and 20 deletions

View File

@ -17,8 +17,9 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
public double Cost { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
public int UserId { get; set; }
[DisplayName("Изготовитель")]
public IUserModel User { get; set; } = new UserViewModel();
public string UserName { get; set; } = string.Empty;
public Dictionary<int, (IFurnitureModel, int)> FurnitureFurnitureModules { get; set; } = new();
}
}

View File

@ -18,7 +18,8 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
public Dictionary<int, (IMaterialModel, int)> FurnitureMaterials { get; set; } = new();
[DisplayName("Менеджер")]
public IUserModel User { get; set; } = new UserViewModel();
public int UserId { get; set; }
[DisplayName("Изготовитель")]
public string UserName { get; set; } = string.Empty;
}
}

View File

@ -1,6 +1,7 @@
using FurnitureAssembly_WorkerDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -9,9 +10,16 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
{
public class MaterialViewModel : IMaterialModel
{
public string Name { get; set; } = string.Empty;
public double Cost { get; set; }
public IScopeModel scope { get; set; } = new ScopeViewModel();
public int Id { get; set; }
[DisplayName("Название материала")]
public string Name { get; set; } = string.Empty;
[DisplayName("Стоимость материала")]
public double Cost { get; set; }
public int ScopeId { get; set; }
[DisplayName("Область применения")]
public string ScopeName { get; set; } = string.Empty;
public int UserId { get; set; }
[DisplayName("Изготовитель")]
public string UserName { get; set; } = string.Empty;
}
}

View File

@ -17,10 +17,13 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
public string CustomerName { get; set; } = string.Empty;
[DisplayName("Тип оплаты")]
public PaymentType PaymentType { get; set; } = PaymentType.Неизвестен;
public Dictionary<int, (ISetModel, int)> OrderSets { get; set; } = new();
public int SetId { get; set; }
[DisplayName("Гарнитур")]
public string SetName { get; set; } = string.Empty;
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
public int UserId { get; set; }
[DisplayName("Менеджер")]
public IUserModel User { get; set; } = new UserViewModel();
public string UserName { get; set; } = string.Empty;
}
}

View File

@ -1,6 +1,7 @@
using FurnitureAssembly_WorkerDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,6 +11,7 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
public class RoleViewModel : IRoleModel
{
public int Id { get; set; }
[DisplayName("Название роли")]
public string Name { get; set; } = string.Empty;
}
}

View File

@ -1,6 +1,7 @@
using FurnitureAssembly_WorkerDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,6 +11,7 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
public class ScopeViewModel : IScopeModel
{
public int Id { get; set; }
[DisplayName("Название области применения")]
public string Name { get; set; } = string.Empty;
}
}

View File

@ -17,8 +17,9 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
public double Cost { get; set; }
[DisplayName("Дата создания")]
public DateTime DateCreate { get; set; }
public int UserId { get; set; }
[DisplayName("Менеджер")]
public IUserModel User { get; set; } = new UserViewModel();
public string UserName { get; set; } = string.Empty;
public Dictionary<int, (IFurnitureModuleModel, int)> SetFurnitureModules { get; set; } = new();
}
}

View File

@ -18,7 +18,8 @@ namespace FurnitureAssembly_WorkerContracts.ViewModels
public string Login { get; set; } = string.Empty;
[DisplayName("ФИО пользователя")]
public string Name { get; set; } = string.Empty;
[DisplayName("Роль пользоватеоя")]
public IRoleModel Role { get; set; } = new RoleViewModel();
public int RoleId { get; set; }
[DisplayName("Роль пользователя")]
public string RoleName { get; set; } = string.Empty;
}
}

View File

@ -12,6 +12,6 @@ namespace FurnitureAssembly_WorkerDataModels.Models
double Cost { get; }
DateTime DateCreate { get; }
Dictionary<int, (IMaterialModel, int)> FurnitureMaterials { get; }
IUserModel User { get; }
int UserId { get; }
}
}

View File

@ -11,7 +11,7 @@ namespace FurnitureAssembly_WorkerDataModels.Models
string Name { get; }
double Cost { get; }
DateTime DateCreate { get; }
IUserModel User { get; }
int UserId { get; }
Dictionary<int, (IFurnitureModel, int)> FurnitureFurnitureModules { get; }
}
}

View File

@ -11,6 +11,7 @@ namespace FurnitureAssembly_WorkerDataModels.Models
{
string Name { get; }
double Cost { get; }
IScopeModel scope { get; }
int ScopeId { get; }
int UserId { get; }
}
}

View File

@ -11,8 +11,8 @@ namespace FurnitureAssembly_WorkerDataModels.Models
{
string CustomerName { get; }
PaymentType PaymentType { get; }
Dictionary<int, (ISetModel, int)> OrderSets { get; }
int SetId { get; }
int UserId { get; }
DateTime DateCreate { get; }
IUserModel User { get; }
}
}

View File

@ -11,7 +11,7 @@ namespace FurnitureAssembly_WorkerDataModels.Models
string Name { get; }
double Cost { get; }
DateTime DateCreate { get; }
IUserModel User { get; }
int UserId { get; }
Dictionary<int, (IFurnitureModuleModel, int)> SetFurnitureModules { get; }
}
}

View File

@ -12,6 +12,6 @@ namespace FurnitureAssembly_WorkerDataModels.Models
string Login { get; }
string Password { get; }
string Name { get; }
IRoleModel Role { get; }
int RoleId { get; }
}
}

View File

@ -17,6 +17,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FurnitureAssembly_WorkerContracts\FurnitureAssembly_WorkerContracts.csproj" />
<ProjectReference Include="..\FurnitureAssembly_WorkerDataModels\FurnitureAssembly_WorkerDataModels.csproj" />
</ItemGroup>

View File

@ -1,6 +1,9 @@
using FurnitureAssembly_WorkerDataModels.Models;
using FurnitureAssembly_WorkerContracts.BindingModels;
using FurnitureAssembly_WorkerContracts.ViewModels;
using FurnitureAssembly_WorkerDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -10,6 +13,32 @@ namespace FurnitureAssembly_WorkerDatabaseImplement.Models
public class Role : IRoleModel
{
public int Id { get; set; }
public string Name => throw new NotImplementedException();
[Required]
public string Name { get; set; } = string.Empty;
public static Role? Create(RoleBindingModel? model)
{
if (model == null)
{
return null;
}
return new Role()
{
Id = model.Id,
Name = model.Name
};
}
public void Update(RoleBindingModel? model)
{
if (model == null)
{
return;
}
Name = model.Name;
}
public RoleViewModel GetViewModel => new()
{
Id = Id,
Name = Name
};
}
}

View File

@ -0,0 +1,24 @@
using FurnitureAssembly_WorkerDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FurnitureAssembly_WorkerDatabaseImplement.Models
{
public class User : IUserModel
{
public int Id { get; set; }
[Required]
public string Login { get; set; } = string.Empty;
[Required]
public string Password { get; set; } = string.Empty;
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public int RoleId { get; set; }
public virtual Role Role { get; set; }
}
}