начало работы над лабой 8

This commit is contained in:
Полина Чубыкина 2024-05-19 12:15:07 +04:00
parent 9ffc761a2a
commit 677190ee63
8 changed files with 85 additions and 18 deletions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConfectioneryContracts.Attributes
{
[AttributeUsage(AttributeTargets.Property)]
public class ColumnAttribute : Attribute
{
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
{
Title = title;
Visible = visible;
Width = width;
GridViewAutoSize = gridViewAutoSize;
IsUseAutoSize = isUseAutoSize;
}
public string Title { get; private set; }
public bool Visible { get; private set; }
public int Width { get; private set; }
public GridViewAutoSize GridViewAutoSize { get; private set; }
public bool IsUseAutoSize { get; private set; }
}s
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConfectioneryContracts.Attributes
{
public enum GridViewAutoSize
{
NotSet = 0,
None = 1,
ColumnHeader = 2,
AllCellsExceptHeader = 4,
AllCells = 6,
DisplayedCellsExceptHeader = 8,
DisplayedCells = 10,
Fill = 16
}
}

View File

@ -5,17 +5,19 @@ using System.Text;
using System.Threading.Tasks;
using ConfectioneryDataModels.Models;
using System.ComponentModel;
using ConfectioneryContracts.Attributes;
namespace ConfectioneryContracts.ViewModels
{
public class ClientViewModel : IClientModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("ФИО клиента")]
[Column(title: "ФИО клиента", width: 150)]
public string ClientFIO { get; set; } = string.Empty;
[DisplayName("Логин (эл. почта)")]
[Column(title: "Логин (эл. почта)", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Email { get; set; } = string.Empty;
[DisplayName("Пароль")]
[Column(title: "Пароль", width: 150)]
public string Password { get; set; } = string.Empty;
}
}

View File

@ -5,15 +5,17 @@ using System.Text;
using System.Threading.Tasks;
using ConfectioneryDataModels.Models;
using System.ComponentModel;
using ConfectioneryContracts.Attributes;
namespace ConfectioneryContracts.ViewModels
{
public class ComponentViewModel : IComponentModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("Название компонента")]
[Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string ComponentName { get; set; } = string.Empty;
[DisplayName("Цена")]
[Column(title: "Цена", width: 150)]
public double Cost { get; set; }
}
}

View File

@ -1,4 +1,5 @@
using ConfectioneryDataModels.Models;
using ConfectioneryContracts.Attributes;
using ConfectioneryDataModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -10,18 +11,19 @@ namespace ConfectioneryContracts.ViewModels
{
public class ImplementerViewModel : IImplementerModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("ФИО исполнителя")]
[Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string ImplementerFIO { get; set; } = string.Empty;
[DisplayName("Пароль")]
[Column(title: "Пароль", width: 100)]
public string Password { get; set; } = string.Empty;
[DisplayName("Стаж работы")]
[Column(title: "Стаж работы", width: 100)]
public int WorkExperience { get; set; }
[DisplayName("Квалификация")]
[Column(title: "Квалификация", width: 100)]
public int Qualification { get; set; }
}
}

View File

@ -1,24 +1,30 @@
using ConfectioneryDataModels.Models;
using ConfectioneryContracts.Attributes;
using ConfectioneryDataModels.Models;
using System.ComponentModel;
namespace ConfectioneryContracts.ViewModels
{
public class MessageInfoViewModel : IMessageInfoModel
{
[Column(visible: false)]
public int Id { get; set; }
[Column(visible: false)]
public string MessageId { get; set; } = string.Empty;
[Column(visible: false)]
public int? ClientId { get; set; }
[DisplayName("Отправитель")]
[Column(title: "Отправитель", width: 150)]
public string SenderName { get; set; } = string.Empty;
[DisplayName("Дата письма")]
[Column(title: "Дата письма", width: 120)]
public DateTime DateDelivery { get; set; }
[DisplayName("Заголовок")]
[Column(title: "Дата письма", width: 150)]
public string Subject { get; set; } = string.Empty;
[DisplayName("Текст")]
[Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Body { get; set; } = string.Empty;
}
}

View File

@ -5,15 +5,17 @@ using System.Text;
using System.Threading.Tasks;
using ConfectioneryDataModels.Models;
using System.ComponentModel;
using ConfectioneryContracts.Attributes;
namespace ConfectioneryContracts.ViewModels
{
public class PastryViewModel : IPastryModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("Название визделия")]
[Column(title: "Название выпечки", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string PastryName { get; set; } = string.Empty;
[DisplayName("Цена")]
[Column(title: "Цена", width: 150)]
public double Price { get; set; }
public Dictionary<int, (IComponentModel, int)> PastryComponents
{

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace ConfectioneryDataModels.Models
{
public interface IMessageInfoModel
public interface IMessageInfoModel : IId
{
string MessageId { get; }