Imagara пре 3 година
родитељ
комит
a1e6c48c77

+ 6 - 1
Kusach/Functions.cs

@@ -27,6 +27,11 @@ namespace Kusach
             else
                 return false;
         }
+        // Валидация дня рождения
+        public static bool IsValidDateOfBirthday(string Date)
+        {
+            return true;
+        }
         // Валидация логина и пароля
         public static bool IsValidLogAndPass(string login, string password)
         {
@@ -89,7 +94,7 @@ namespace Kusach
             else
                 return false;
         }
-        public static bool IsOnlyDigits (string str)
+        public static bool IsOnlyDigits(string str)
         {
             foreach (char c in str)
                 if (!char.IsDigit(c))

+ 11 - 5
Kusach/Windows/LogWindow.xaml

@@ -25,26 +25,30 @@
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
             Name="logbox" 
             HorizontalAlignment="Left" 
             TextWrapping="Wrap" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <Label 
             Content="Пароль:" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <PasswordBox 
             Name="passbox" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
         </StackPanel>
         <StackPanel
             Orientation="Horizontal"
@@ -57,12 +61,14 @@
             Height="40" 
             Width="150" 
             Margin="0,0,30,0"
+            FontSize="20"
             Click="RegButton_Click"/>
             <Button 
             x:Name="LogButton" 
             Content="Вход"
             Height="40" 
-            Width="150" 
+            Width="150"
+            FontSize="20"
             Click="LogButton_Click"/>
         </StackPanel>
     </Grid>

+ 3 - 3
Kusach/Windows/LogWindow.xaml.cs

@@ -20,8 +20,9 @@ namespace Kusach
         {
             if(!Functions.IsValidLogAndPass(logbox.Text, passbox.Password))
                 MessageBox.Show("Поля не могут быть пустыми.");
+            else if (!Functions.LoginCheck(logbox.Text, passbox.Password))
+                MessageBox.Show("Неверный логин или пароль");
             else
-            if (Functions.LoginCheck(logbox.Text, passbox.Password))
             {
                 profile.DispatcherId = cnt.db.Dispatcher.First(item => item.Login == logbox.Text).IdDispatcher;
                 profile.Permission = cnt.db.Dispatcher.First(item => item.Login == logbox.Text).Permission;
@@ -29,8 +30,7 @@ namespace Kusach
                 mw.Show();
                 this.Close();
             }
-            else
-                MessageBox.Show("Неверный логин или пароль");
+                
         }
         private void RegButton_Click(object sender, RoutedEventArgs e)
         {

+ 44 - 17
Kusach/Windows/RegWindow.xaml

@@ -22,61 +22,71 @@
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
             x:Name="logbox" 
             HorizontalAlignment="Left"  
             TextWrapping="Wrap" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <Label 
             Content="Пароль:" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
             x:Name="passbox" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <Label 
             Content="Имя:" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
             x:Name="FNameBox" 
             HorizontalAlignment="Left"  
             TextWrapping="Wrap" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <Label 
             Content="Фамилия:" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
             x:Name="LNameBox" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <Label 
             Content="Отчество:" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
             x:Name="MNameBox" 
             HorizontalAlignment="Left" 
-            VerticalAlignment="Top" 
+            VerticalAlignment="Top"
+            FontSize="20"
             Height="40" 
             Width="240"/>
             <Label 
@@ -84,11 +94,13 @@
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <DatePicker
             x:Name="BirthdayBox" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
+            FontSize="20"
             Height="40" 
             Width="240"/>
             <Label 
@@ -96,21 +108,34 @@
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
-            <TextBox 
-            x:Name="PhoneBox" 
+            Width="240"
+            FontSize="20"/>
+            <StackPanel Orientation="Horizontal">
+            <Label
+            Content="+7"
+            FontSize="20"
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="40"/>
+            <TextBox
+            x:Name="PhoneBox" 
+            HorizontalAlignment="Left" 
+            VerticalAlignment="Top"
+            FontSize="20"
+            Height="40" 
+            Width="200"/>
+            </StackPanel>
             <Label 
             Content="Email:" 
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
-            Width="240"/>
+            Width="240"
+            FontSize="20"/>
             <TextBox 
-            x:Name="EmailBox" 
+            x:Name="EmailBox"
+            FontSize="20"
             HorizontalAlignment="Left" 
             VerticalAlignment="Top" 
             Height="40" 
@@ -127,12 +152,14 @@
             Margin="0,0,30,0"
             Height="40" 
             Width="150" 
+            FontSize="20"
             Click="BackButton_Click"/>
             <Button 
             x:Name="RegButton" 
             Content="Регистрация"
             Height="40" 
             Width="150" 
+            FontSize="20"
             Click="RegButton_Click"/>
         </StackPanel>
     </Grid>

+ 6 - 10
Kusach/Windows/RegWindow.xaml.cs

@@ -22,18 +22,14 @@ namespace Kusach
                     MessageBox.Show("Поля не могут быть пустыми.");
                 else if (Functions.IsLoginAlreadyTaken(logbox.Text))
                     MessageBox.Show("Данный логин уже занят");
+                else if (!Functions.IsValidPhoneNumber(PhoneBox.Text))
+                    MessageBox.Show("Номер телефона введен неверно.");
+                else if (!Functions.IsValidEmail(EmailBox.Text))
+                    MessageBox.Show("Email введен неверно."); 
+                else if (!Functions.IsValidDateOfBirthday(BirthdayBox.Text))
+                    MessageBox.Show("День рождения введен неверно.");
                 else
                 {
-                    if (!Functions.IsValidPhoneNumber(PhoneBox.Text))
-                    {
-                        MessageBox.Show("Номер телефона введен неверно.");
-                        return;
-                    }
-                    if (!Functions.IsValidEmail(EmailBox.Text))
-                    {
-                        MessageBox.Show("email введен неверно.");
-                        return;
-                    }
                     Dispatcher newUser = new Dispatcher()
                     {
                         IdDispatcher = cnt.db.Dispatcher.Select(p => p.IdDispatcher).DefaultIfEmpty(0).Max() + 1,