Начало Lab8

This commit is contained in:
malimova 2024-06-02 19:45:09 +04:00
parent 248204ff7c
commit aaa9b16759
3 changed files with 70 additions and 10 deletions

View File

@ -0,0 +1,30 @@
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; }
}
}

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

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