normik photo + role
This commit is contained in:
parent
a792f9df5e
commit
fafd4f40eb
@ -8,6 +8,7 @@ using Avalonia.Controls;
|
|||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Media.Imaging;
|
using Avalonia.Media.Imaging;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using demo5.MyModels;
|
using demo5.MyModels;
|
||||||
using demo5.Models;
|
using demo5.Models;
|
||||||
|
|
||||||
@ -15,28 +16,10 @@ namespace demo5;
|
|||||||
|
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
|
|
||||||
ObservableCollection<ClientMy> myClients = new ObservableCollection<ClientMy>();
|
|
||||||
List<ClientMy> dataSourceClient;
|
|
||||||
|
|
||||||
public static ObservableCollection<ClientMy> ClientMyList { get; set; }
|
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
PasswordTextBox.PasswordChar = '•';
|
PasswordTextBox.PasswordChar = '•';
|
||||||
|
|
||||||
using var context = new Demo5Context();
|
|
||||||
dataSourceClient = context.Clients.Select(it => new ClientMy
|
|
||||||
{
|
|
||||||
Photopath = it.Photopath,
|
|
||||||
Email = it.Email,
|
|
||||||
Password = it.Password,
|
|
||||||
Fio = it.Fio,
|
|
||||||
Role = it.Role
|
|
||||||
}).ToList();
|
|
||||||
|
|
||||||
ClientMyList = new ObservableCollection<ClientMy>(dataSourceClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
|
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
@ -51,7 +34,9 @@ public partial class MainWindow : Window
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var client = ClientMyList.FirstOrDefault(it => it.Email == LoginText);
|
var client = context.Clients
|
||||||
|
.Include(c => c.RoleNavigation)
|
||||||
|
.FirstOrDefault(it => it.Email == LoginText);
|
||||||
|
|
||||||
if (client != null && client.Password == Password)
|
if (client != null && client.Password == Password)
|
||||||
{
|
{
|
||||||
|
@ -15,12 +15,21 @@ namespace demo5;
|
|||||||
|
|
||||||
public partial class SellerWindow : Window
|
public partial class SellerWindow : Window
|
||||||
{
|
{
|
||||||
public SellerWindow(ClientMy client)
|
public SellerWindow(Client client)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
FioTextBlock.Text = client.Fio;
|
FioTextBlock.Text = client.Fio;
|
||||||
RoleTextBlock.Text = client.Role.ToString();
|
RoleTextBlock.Text = client.RoleNavigation.Name;
|
||||||
ClientImage.Source = client.Image;
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string absolutePath = Path.Combine(AppContext.BaseDirectory, client.Photopath);
|
||||||
|
ClientImage.Source = new Bitmap(absolutePath);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
ClientImage.Source = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormOrderButton_OnClick(object? sender, RoutedEventArgs e)
|
private void FormOrderButton_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("demo5")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("demo5")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a792f9df5e854314a0e7c5e8d78a9b881174c492")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("demo5")]
|
[assembly: System.Reflection.AssemblyProductAttribute("demo5")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("demo5")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("demo5")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
5299d84ef59144d73024c4687cf1933e5b7aa5467c8ae9b7a78ab7160ba7089b
|
5d85425ecb3c1ae34c6e36ade359dd0f925831013e3aae1c7054d3b2991eff96
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user