Forráskód Böngészése

--ПАРТИЗАН

СазоноваАА 7 hónapja
szülő
commit
2ff9057b6c

+ 25 - 2
Practikaoy/ViewModels/AuthPageViewModel.cs

@@ -1,10 +1,33 @@
 using System;
 using System.Collections.Generic;
+using Practikaoy.Models;
 using ReactiveUI;
 
 namespace Practikaoy.ViewModels
 {
 	public class AuthPageViewModel : ReactiveObject
-	{
-	}
+	{ Sazonova2Context ConnectBD = new Sazonova2Context();
+		string _log;
+		string _pas;
+		int _port;
+		public string Loginn
+		{
+			  get =>  _log; set => _log = value;  
+		}
+        public string Pass
+		{
+			get => _pas; set => _pas = value;
+		}
+		 public bool PiklsPerson (ref int ex)
+		{
+			foreach(User item in ConnectBD.Users)
+			{
+				if (item.Login == Loginn && item.Passs == Pass)
+				{ ex = item.IdUser;
+					return true;
+				}
+			}
+			return false;
+		}
+    }
 }

+ 41 - 4
Practikaoy/ViewModels/MainWindowViewModel.cs

@@ -1,9 +1,46 @@
-namespace Practikaoy.ViewModels
+using Avalonia.Controls;
+using Practikaoy.Models;
+using Practikaoy.Views;
+using ReactiveUI;
+using System.Net;
+
+namespace Practikaoy.ViewModels
 {
     public class MainWindowViewModel : ViewModelBase
     {
-#pragma warning disable CA1822 // Mark members as static
-        public string Greeting => "Welcome to Avalonia!";
-#pragma warning restore CA1822 // Mark members as static
+        Sazonova2Context ConnectBD = new Sazonova2Context();
+        AuthPageViewModel _authPage = new AuthPageViewModel();
+        MeRoomViewModel _meRoom = new MeRoomViewModel(1);
+        UserControl canic = new AuthPas();
+        public UserControl Canic
+        {
+            get => canic;
+            set => this.RaiseAndSetIfChanged(ref canic, value);
+        }
+       // UserControl _uthP = new MeRoomViewModel();
+        public MeRoomViewModel MeRoom { get => _meRoom; set => _meRoom = value; } 
+        public AuthPageViewModel AuthPage { get => _authPage; set => _authPage = value; }
+        public UserControl USE { get => canic; set => this.RaiseAndSetIfChanged(ref canic, value); }
+
+        public void NextPage()
+        {
+            int ex = 0;
+            if (AuthPage.PiklsPerson(ref ex))
+            {
+                _meRoom = new MeRoomViewModel(ex);
+                USE = new MeRoom();
+            }
+            else { USE = new AuthPas(); }
+        }
+        public void PreviousPage() 
+        { 
+        MeRoom.IsEnableEdit = true;
+        }
+
+
+
+
+
+
     }
 }

+ 6 - 1
Practikaoy/ViewModels/MeRoomViewModel.cs

@@ -1,10 +1,15 @@
 using System;
 using System.Collections.Generic;
+using Practikaoy.Models;
 using ReactiveUI;
 
 namespace Practikaoy.ViewModels
 {
 	public class MeRoomViewModel : ReactiveObject
 	{
-	}
+        Sazonova2Context ConnectBD = new Sazonova2Context();
+        User? _Useris;
+        public User UserIS { get => _Useris; set => _Useris = value; }
+
+    }
 }

+ 1 - 2
Practikaoy/Views/MainWindow.axaml

@@ -14,7 +14,6 @@
              to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
         <vm:MainWindowViewModel/>
     </Design.DataContext>
-
-    <TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+	<ContentControl Content ="{Binding USE} " ></ContentControl>
 	
 </Window>

+ 25 - 17
Practikaoy/Views/MeRoom.axaml

@@ -6,44 +6,52 @@
              x:Class="Practikaoy.Views.MeRoom">
 	<Grid>
 		<TextBlock Foreground="#592321" FontSize="18" Margin="4" HorizontalAlignment="Center">Добро пожаловать в личный кабинет :)</TextBlock>
-		<Border Background="#ffa69e" Height="390" Width="650" CornerRadius="15">
-			<StackPanel  Margin="15">
+		<Border Background="#ffa69e" Height="395" Width="650" CornerRadius="15">
+			<StackPanel  Margin="16">
 				
-				<TextBlock Text="Фамилия" FontSize="18" >
+				<TextBlock Text="Фамилия" FontSize="18" Margin="-7 3 9 2" >
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="80 -30 9 6"/>
 				
-				<TextBlock Text="Имя" FontSize="18" >
+				<TextBlock Text="Имя" FontSize="18" Margin="-7 0 -2 -6" >
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="2 -69 9 6"/>
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="-290 -20 9 6"/>
 				
-				<TextBlock Text="Отчество" FontSize="18" >
+				<TextBlock Text="Отчество" FontSize="18" Margin="-7 0 -2 -6">
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  HorizontalAlignment="Right"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="3 -112 9 6"/>
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Right"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="0 -20 355 7"/>
 				
-				<TextBlock Text="Логин" FontSize="18">
+				<TextBlock Text="Логин" FontSize="18" Margin="370 -90 -2 -6">
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="429 -159 0 0"/>
+				<CheckBox Margin="370 -60 -1 30" Content="Хотите изменить пароль? ;)"></CheckBox>
+				<StackPanel Margin="2">
+				<TextBox Background="#fae1dd" Watermark="Пароль" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Right"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="2" />
+				<TextBox Background="#fae1dd" Watermark="Повторите пароль" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Right"  BorderBrush="#ff686b" BorderThickness="2" Height="10" />
+			</StackPanel>
 				
-				<TextBlock Text="Пол" FontSize="18">
+				<TextBlock Text="Пол" FontSize="18" Margin="-7 -70 -2 -6">
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+				<ComboBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10" Margin="35 -77 0 7"/>
 				
-				<TextBlock Text="Дата рождения" FontSize="18">
+				<TextBlock Text="Дата рождения" FontSize="18"  Margin="-7 -40 -2 -6" >
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+				<DatePicker  Background="#fae1dd" Width="310" FontSize="15" CornerRadius="5"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="27" Margin="0 -10 0 7"/>
 				
 				<TextBlock Text="Стаж (в годах)" FontSize="18">
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="20"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
 				
 				<TextBlock Text="Почта" FontSize="18">
 				</TextBlock>
-				<TextBox Background="#fae1dd" Width="200" FontSize="15" CornerRadius="20"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
 				
 				<TextBlock Text="Телефон (если телефон отсутствует, то поле не заполняйте!!)" FontSize="18">
 				</TextBlock>
-
+				<TextBox Background="#fae1dd" Width="180" FontSize="15" CornerRadius="10"  HorizontalAlignment="Left"  BorderBrush="#ff686b" BorderThickness="2" Height="10"/>
+			
+			
+			
 			</StackPanel>
 		</Border>