first commit

This commit is contained in:
1billy17 2025-01-28 19:06:43 +03:00
commit f82f2bbf92
231 changed files with 6700 additions and 0 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

13
.idea/.idea.demo4_true/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/.idea.demo4_true.iml
/contentModel.xml
/modules.xml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AvaloniaProject">
<option name="projectPerEditor">
<map>
<entry key="demo4_true/Auth.axaml" value="demo4_true/demo4_true.csproj" />
<entry key="demo4_true/MainWindow.axaml" value="demo4_true/demo4_true.csproj" />
<entry key="demo4_true/Organizator.axaml" value="demo4_true/demo4_true.csproj" />
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
</project>

16
demo4_true.sln Normal file
View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo4_true", "demo4_true\demo4_true.csproj", "{998444DD-8F3A-4C15-8623-E2C940C0E00B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{998444DD-8F3A-4C15-8623-E2C940C0E00B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{998444DD-8F3A-4C15-8623-E2C940C0E00B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{998444DD-8F3A-4C15-8623-E2C940C0E00B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{998444DD-8F3A-4C15-8623-E2C940C0E00B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

BIN
demo4_true/.DS_Store vendored Normal file

Binary file not shown.

10
demo4_true/App.axaml Normal file
View File

@ -0,0 +1,10 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="demo4_true.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

23
demo4_true/App.axaml.cs Normal file
View File

@ -0,0 +1,23 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace demo4_true;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}

15
demo4_true/Auth.axaml Normal file
View File

@ -0,0 +1,15 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo4_true.Auth"
Title="Auth">
<DockPanel>
<StackPanel Spacing="5" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox Width="250" x:Name="Id" Watermark="Id"/>
<TextBox Width="250" x:Name="Password" Watermark="Password"/>
<Button Click="AuthButton_OnClick" Content="Авторизация"/>
</StackPanel>
</DockPanel>
</Window>

51
demo4_true/Auth.axaml.cs Normal file
View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using demo4_true.Models;
using demo4_true.ModelsMy;
namespace demo4_true;
public partial class Auth : Window
{
public Auth()
{
InitializeComponent();
}
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
{
var idText = Id?.Text;
var password = Password?.Text;
if (int.TryParse(idText, out var id))
{
var client = MainWindow.ClientAuthList?.FirstOrDefault(it => it.Id == id);
if (client != null && client.Password == password)
{
Console.WriteLine("success");
if (client.Role == 1)
{
Organizator organizatorWindow = new Organizator(client);
organizatorWindow.ShowDialog(this);
}
}
else
{
Console.WriteLine("wrong");
}
}
else
{
Console.WriteLine("Invalid ID format");
}
}
}

28
demo4_true/Item.cs Normal file
View File

@ -0,0 +1,28 @@
using System;
namespace demo4_true;
public class Item
{
public int Id { get; set; }
private string _Password { get; set; }
public string Password
{
get => _Password;
set
{
validatePassword(value);
_Password = value;
}
}
public string Text { get; set; }
private void validatePassword(string password)
{
if (password.Length < 3)
{
throw new ArgumentException(nameof(password), "Password length > 7 symbols");
}
}
}

View File

@ -0,0 +1,49 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo4_true.MainWindow"
x:CompileBindings="False"
Title="demo4_true">
<DockPanel>
<Border DockPanel.Dock="Top" Background="DeepSkyBlue" Height="50">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="10">
<ComboBox x:Name="DirectionComboBox" Width="150" SelectionChanged="DirectionComboBox_OnSelectionChanged"/>
<ComboBox x:Name="DateComboBox" Width="150" SelectionChanged="DateComboBox_OnSelectionChanged"/>
</StackPanel>
<Button Grid.Column="2" Content="Auth" HorizontalAlignment="Right" Margin="10,0,10,0" VerticalAlignment="Center" Foreground="Black" Background="LightGray" Click="AuthButton_OnClick" />
</Grid>
</Border>
<ListBox x:Name = "EventListBox" Background="Beige">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Gray" BorderThickness="1" Padding="5" Margin="5">
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center">
<Image Source="{Binding Image}" Width="100" Height="100" Margin="0,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Left" Stretch="UniformToFill"/>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250">
<TextBlock Text="{Binding Sobitie}" TextWrapping="Wrap" TextAlignment="Left" Foreground="Black" FontSize="14" Margin="0,0,0,5"/>
<TextBlock Text="{Binding Date}" TextWrapping="Wrap" TextAlignment="Left" Foreground="Black" FontSize="12" Margin="0,0,0,5"/>
<TextBlock Text="{Binding DirectionId}" TextWrapping="Wrap" TextAlignment="Left" Foreground="Black" FontSize="12"/>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</Window>

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Media.Imaging;
using demo4_true.Models;
using demo4_true.ModelsMy;
namespace demo4_true;
public partial class MainWindow : Window
{
ObservableCollection<EventPresenter> events = new ObservableCollection<EventPresenter>();
List<EventPresenter> dataSourceEvent;
ObservableCollection<ClientAuth> authClients = new ObservableCollection<ClientAuth>();
List<ClientAuth> dataSourceClient;
public List<string> DirectionsList { get; }
public List<DateTime> DatesList { get; }
public static ObservableCollection<ClientAuth> ClientAuthList { get; set; }
public MainWindow()
{
InitializeComponent();
using var context = new Demo4Context();
dataSourceEvent = context.Events.Select(it => new EventPresenter
{
Sobitie = it.Sobitie,
Date = it.Date,
Days = it.Days,
City = it.City,
Photopath = it.Photopath,
DirectionId = it.DirectionId,
}).ToList();
EventListBox.ItemsSource = events;
dataSourceClient = context.Clients.Select(it => new ClientAuth
{
Id = it.Id,
Password = it.Password,
Role = it.Role,
FIO = it.Fio,
PhotoPath = it.Photopath,
}).ToList();
DirectionsList = context.Directions.Select(it => it.Name).ToList();
DirectionComboBox.ItemsSource = DirectionsList;
DatesList = dataSourceEvent.Select(s => s.Date).ToList();
DateComboBox.ItemsSource = DatesList;
DisplayServices();
}
public class EventPresenter() : Event
{
Bitmap? Image
{
get
{
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, Photopath);
return new Bitmap(absolutePath);
}
catch
{
return null;
}
}
}
}
public void DisplayServices()
{
var temp = dataSourceEvent;
var temp2 = dataSourceClient;
events.Clear();
if (DirectionComboBox != null)
{
temp = temp.Where(it => it.Direction == DirectionComboBox.SelectedItem).ToList();
}
if (DateComboBox.SelectedItem != null)
{
DateTime selectedDate = (DateTime)DateComboBox.SelectedItem;
temp = temp.Where(it => it.Date.Date == selectedDate.Date).ToList();
}
foreach (var item in temp)
{
events.Add(item);
}
foreach (var item in temp2)
{
authClients.Add(item);
}
ClientAuthList = authClients;
}
private void AuthButton_OnClick(object? sender, RoutedEventArgs e)
{
Auth auth = new Auth();
auth.ShowDialog(this);
}
private void DirectionComboBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
DisplayServices();
}
private void DateComboBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
DisplayServices();
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Activity
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public virtual ICollection<Client> Moderators { get; set; } = new List<Client>();
}

13
demo4_true/Models/City.cs Normal file
View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class City
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public virtual ICollection<Event> Events { get; set; } = new List<Event>();
}

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Client
{
public int Id { get; set; }
public string Fio { get; set; } = null!;
public string Email { get; set; } = null!;
public DateTime Date { get; set; }
public int Country { get; set; }
public string Phone { get; set; } = null!;
public string Password { get; set; } = null!;
public string? Spec { get; set; }
public string? Meropriyatie { get; set; }
public string Photopath { get; set; } = null!;
public char Gender { get; set; }
public int Role { get; set; }
public virtual Country CountryNavigation { get; set; } = null!;
public virtual Role RoleNavigation { get; set; } = null!;
public virtual ICollection<Activity> Activities { get; set; } = new List<Activity>();
public virtual ICollection<Event> Events { get; set; } = new List<Event>();
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Country
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public string EnName { get; set; } = null!;
public string Code { get; set; } = null!;
public int Code2 { get; set; }
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
}

View File

@ -0,0 +1,297 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace demo4_true.Models;
public partial class Demo4Context : DbContext
{
public Demo4Context()
{
}
public Demo4Context(DbContextOptions<Demo4Context> options)
: base(options)
{
}
public virtual DbSet<Activity> Activities { get; set; }
public virtual DbSet<City> Cities { get; set; }
public virtual DbSet<Client> Clients { get; set; }
public virtual DbSet<Country> Countries { get; set; }
public virtual DbSet<Direction> Directions { get; set; }
public virtual DbSet<Event> Events { get; set; }
public virtual DbSet<Eventactivity> Eventactivities { get; set; }
public virtual DbSet<Jhuriactivity> Jhuriactivities { get; set; }
public virtual DbSet<Role> Roles { get; set; }
public virtual DbSet<ValidActivityJhuri> ValidActivityJhuris { get; set; }
public virtual DbSet<ValidActivityModerator> ValidActivityModerators { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=212.67.10.54;Database=demo4;Username=myuser;Password=mypassword;Port=5433");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Activity>(entity =>
{
entity.HasKey(e => e.Id).HasName("activity_pkey");
entity.ToTable("activity");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Name)
.HasMaxLength(100)
.HasColumnName("name");
entity.HasMany(d => d.Moderators).WithMany(p => p.Activities)
.UsingEntity<Dictionary<string, object>>(
"Activitymoderator",
r => r.HasOne<Client>().WithMany()
.HasForeignKey("Moderatorid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_moderator"),
l => l.HasOne<Activity>().WithMany()
.HasForeignKey("Activityid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_activity"),
j =>
{
j.HasKey("Activityid", "Moderatorid").HasName("activitymoderator_pkey");
j.ToTable("activitymoderator");
j.IndexerProperty<int>("Activityid").HasColumnName("activityid");
j.IndexerProperty<int>("Moderatorid").HasColumnName("moderatorid");
});
});
modelBuilder.Entity<City>(entity =>
{
entity.HasKey(e => e.Id).HasName("city_pkey");
entity.ToTable("city");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Name)
.HasMaxLength(100)
.HasColumnName("name");
});
modelBuilder.Entity<Client>(entity =>
{
entity.HasKey(e => e.Id).HasName("clients_pkey");
entity.ToTable("clients");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Country).HasColumnName("country");
entity.Property(e => e.Date)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("date");
entity.Property(e => e.Email)
.HasMaxLength(100)
.HasColumnName("email");
entity.Property(e => e.Fio)
.HasMaxLength(200)
.HasColumnName("fio");
entity.Property(e => e.Gender)
.HasMaxLength(1)
.HasColumnName("gender");
entity.Property(e => e.Meropriyatie)
.HasMaxLength(50)
.HasColumnName("meropriyatie");
entity.Property(e => e.Password)
.HasMaxLength(50)
.HasColumnName("password");
entity.Property(e => e.Phone)
.HasMaxLength(20)
.HasColumnName("phone");
entity.Property(e => e.Photopath)
.HasMaxLength(100)
.HasColumnName("photopath");
entity.Property(e => e.Role).HasColumnName("role");
entity.Property(e => e.Spec)
.HasMaxLength(50)
.HasColumnName("spec");
entity.HasOne(d => d.CountryNavigation).WithMany(p => p.Clients)
.HasForeignKey(d => d.Country)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_country");
entity.HasOne(d => d.RoleNavigation).WithMany(p => p.Clients)
.HasForeignKey(d => d.Role)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_role");
});
modelBuilder.Entity<Country>(entity =>
{
entity.HasKey(e => e.Id).HasName("country_pkey");
entity.ToTable("country");
entity.HasIndex(e => e.Code2, "country_code2_key").IsUnique();
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Code)
.HasMaxLength(5)
.HasColumnName("code");
entity.Property(e => e.Code2).HasColumnName("code2");
entity.Property(e => e.EnName)
.HasMaxLength(100)
.HasColumnName("en_name");
entity.Property(e => e.Name)
.HasMaxLength(100)
.HasColumnName("name");
});
modelBuilder.Entity<Direction>(entity =>
{
entity.HasKey(e => e.Id).HasName("direction_pkey");
entity.ToTable("direction");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Name)
.HasMaxLength(255)
.HasColumnName("name");
});
modelBuilder.Entity<Event>(entity =>
{
entity.HasKey(e => e.Id).HasName("event_pkey");
entity.ToTable("event");
entity.HasIndex(e => e.Date, "event_date_key").IsUnique();
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.City).HasColumnName("city");
entity.Property(e => e.Date)
.HasColumnType("timestamp(6) without time zone")
.HasColumnName("date");
entity.Property(e => e.Days).HasColumnName("days");
entity.Property(e => e.DirectionId).HasColumnName("direction_id");
entity.Property(e => e.Photopath)
.HasMaxLength(255)
.HasColumnName("photopath");
entity.Property(e => e.Sobitie)
.HasMaxLength(200)
.HasColumnName("sobitie");
entity.HasOne(d => d.CityNavigation).WithMany(p => p.Events)
.HasForeignKey(d => d.City)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_city");
entity.HasOne(d => d.Direction).WithMany(p => p.Events)
.HasForeignKey(d => d.DirectionId)
.OnDelete(DeleteBehavior.SetNull)
.HasConstraintName("fk_event_direction");
entity.HasMany(d => d.Winners).WithMany(p => p.Events)
.UsingEntity<Dictionary<string, object>>(
"Eventwinner",
r => r.HasOne<Client>().WithMany()
.HasForeignKey("Winnerid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_moderator"),
l => l.HasOne<Event>().WithMany()
.HasForeignKey("Eventid")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_event"),
j =>
{
j.HasKey("Eventid", "Winnerid").HasName("eventwinner_pkey");
j.ToTable("eventwinner");
j.IndexerProperty<int>("Eventid").HasColumnName("eventid");
j.IndexerProperty<int>("Winnerid").HasColumnName("winnerid");
});
});
modelBuilder.Entity<Eventactivity>(entity =>
{
entity
.HasNoKey()
.ToTable("eventactivity");
entity.Property(e => e.Activityid).HasColumnName("activityid");
entity.Property(e => e.Eventid).HasColumnName("eventid");
entity.HasOne(d => d.Activity).WithMany()
.HasForeignKey(d => d.Activityid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_activity");
entity.HasOne(d => d.Event).WithMany()
.HasForeignKey(d => d.Eventid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_event");
});
modelBuilder.Entity<Jhuriactivity>(entity =>
{
entity
.HasNoKey()
.ToTable("jhuriactivity");
entity.Property(e => e.Activityid).HasColumnName("activityid");
entity.Property(e => e.Jhuriid).HasColumnName("jhuriid");
entity.HasOne(d => d.Activity).WithMany()
.HasForeignKey(d => d.Activityid)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_activity");
entity.HasOne(d => d.Jhuri).WithMany()
.HasForeignKey(d => d.Jhuriid)
.HasConstraintName("fk_moderator");
});
modelBuilder.Entity<Role>(entity =>
{
entity.HasKey(e => e.Id).HasName("roles_pkey");
entity.ToTable("roles");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Name)
.HasMaxLength(20)
.HasColumnName("name");
});
modelBuilder.Entity<ValidActivityJhuri>(entity =>
{
entity
.HasNoKey()
.ToView("valid_activity_jhuri");
entity.Property(e => e.Activityid).HasColumnName("activityid");
entity.Property(e => e.Jhuriid).HasColumnName("jhuriid");
});
modelBuilder.Entity<ValidActivityModerator>(entity =>
{
entity
.HasNoKey()
.ToView("valid_activity_moderators");
entity.Property(e => e.Activityid).HasColumnName("activityid");
entity.Property(e => e.Moderatorid).HasColumnName("moderatorid");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Direction
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public virtual ICollection<Event> Events { get; set; } = new List<Event>();
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Event
{
public int Id { get; set; }
public string Sobitie { get; set; } = null!;
public DateTime Date { get; set; }
public int Days { get; set; }
public int City { get; set; }
public string? Photopath { get; set; }
public int? DirectionId { get; set; }
public virtual City CityNavigation { get; set; } = null!;
public virtual Direction? Direction { get; set; }
public virtual ICollection<Client> Winners { get; set; } = new List<Client>();
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Eventactivity
{
public int Eventid { get; set; }
public int Activityid { get; set; }
public virtual Activity Activity { get; set; } = null!;
public virtual Event Event { get; set; } = null!;
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Jhuriactivity
{
public int Activityid { get; set; }
public int? Jhuriid { get; set; }
public virtual Activity Activity { get; set; } = null!;
public virtual Client? Jhuri { get; set; }
}

13
demo4_true/Models/Role.cs Normal file
View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class Role
{
public int Id { get; set; }
public string Name { get; set; } = null!;
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class ValidActivityJhuri
{
public int? Activityid { get; set; }
public int? Jhuriid { get; set; }
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
namespace demo4_true.Models;
public partial class ValidActivityModerator
{
public int? Activityid { get; set; }
public int? Moderatorid { get; set; }
}

View File

@ -0,0 +1,30 @@
using System;
using System.IO;
using Avalonia.Media.Imaging;
using demo4_true.Models;
namespace demo4_true.ModelsMy;
public class ClientAuth: Client
{
public int Id { get; set; }
public string Password { get; set; } = null!;
public int Role { get; set; }
public string FIO { get; set; } = null!;
public string PhotoPath { get; set; } = null!;
public Bitmap? Image
{
get
{
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, PhotoPath);
return new Bitmap(absolutePath);
}
catch
{
return null;
}
}
}
}

View File

@ -0,0 +1,46 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo4_true.Organizator"
Title="Organizator">
<DockPanel>
<Border DockPanel.Dock="Top" Height="50">
<TextBlock Text="Окно организатора" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20"/>
</Border>
<Border>
<Grid>
<Grid ColumnDefinitions="Auto, 1*" VerticalAlignment="Center" Margin="10,0,0,0">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250">
<Image Width="150" Height="250" x:Name="imageOrg"/>
<Border BorderBrush="Gray" BorderThickness="1" Padding="5">
<TextBlock HorizontalAlignment="Center" Width="150" Height="50" FontSize="20" TextAlignment="Center">
<Run Text="Мой" />
<LineBreak />
<Run Text="профиль" />
</TextBlock>
</Border>
</StackPanel>
</Grid>
<Grid ColumnDefinitions="Auto, 1*" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" MaxWidth="250" Spacing="15">
<TextBlock x:Name="textHello" FontSize="16"/>
<Button x:Name="EventsButton" Height="80" Width="300" BorderThickness="2" Click="EventsButton_OnClick">
<TextBlock Text="Мероприятия" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<Button x:Name="ParticipantsButton" Height="80" Width="300" BorderThickness="2" Click="ParticipantsButton_OnClick">
<TextBlock Text="Участники" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
<Button x:Name="JuryButton" Height="80" Width="300" BorderThickness="2" Click="JuryButton_OnClick">
<TextBlock Text="Жюри" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Button>
</StackPanel>
</Grid>
</Grid>
</Border>
</DockPanel>
</Window>

View File

@ -0,0 +1,49 @@
using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo4_true.ModelsMy;
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
namespace demo4_true;
public partial class Organizator : Window
{
private string _output;
public Organizator(ClientAuth clientAuth)
{
InitializeComponent();
var blank = "";
DateTime currentTime = DateTime.Now;
if (currentTime.Hour > 9 && currentTime.Hour < 11)
{
blank = "Доброе утро!\n";
} else if (currentTime.Hour > 11 && currentTime.Hour < 18)
{
blank = "Добрый день!\n";
}
else
{
blank = "Добрый вечер!\n";
}
textHello.Text = blank+clientAuth.FIO;
imageOrg.Source = clientAuth.Image;
}
private void EventsButton_OnClick(object? sender, RoutedEventArgs e)
{
MainWindow mainWindow = new MainWindow();
mainWindow.ShowDialog(this);
}
private void ParticipantsButton_OnClick(object? sender, RoutedEventArgs e)
{
}
private void JuryButton_OnClick(object? sender, RoutedEventArgs e)
{
}
}

21
demo4_true/Program.cs Normal file
View File

@ -0,0 +1,21 @@
using Avalonia;
using System;
namespace demo4_true;
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}

18
demo4_true/app.manifest Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embedded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="demo4_true.Desktop"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

BIN
demo4_true/bin/.DS_Store vendored Normal file

Binary file not shown.

BIN
demo4_true/bin/Debug/.DS_Store vendored Normal file

Binary file not shown.

BIN
demo4_true/bin/Debug/net8.0/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More