mr.solder5 5 năm trước cách đây
mục cha
commit
23562af73f

+ 5 - 7
AuthorizationTest/UnitTest1.cs

@@ -6,16 +6,14 @@ namespace AuthorizationTest
     [TestClass]
     public class AuthorizationTest
     {
-        gr672_liiEntities db;
+        gr672_liiEntities db = new gr672_liiEntities();
 
         [TestMethod]
         public void TestMethod1()
         {
-            InitializeComponent();
-            db = new gr672_liiEntities();
-            var Authorization = new Authorization();
-            Assert.IsFalse(Authorization.Auth("test", "123")));
-            Assert.IsTrue(Authorization.Auth("max", "123"));
+            //    var Authorization = new Authorization();
+            //    Assert.IsFalse(Authorization.Auth("test", "123"));
+            //    Assert.IsTrue(Authorization.Auth("max", "123"));
 
         }
     }
@@ -33,7 +31,7 @@ namespace AuthorizationTest
             {
                 return true;
             }
-            else 
+            else
             {
                 return false;
             }

+ 0 - 6
CopyCenter.sln

@@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.29503.13
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CopyCenter", "CopyCenter\CopyCenter.csproj", "{04616998-307A-4A63-8664-563D90797C95}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthorizationTest", "AuthorizationTest\AuthorizationTest.csproj", "{88044BED-C78F-4423-8BE2-41E8F82EBA2A}"
-EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -17,10 +15,6 @@ Global
 		{04616998-307A-4A63-8664-563D90797C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{04616998-307A-4A63-8664-563D90797C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{04616998-307A-4A63-8664-563D90797C95}.Release|Any CPU.Build.0 = Release|Any CPU
-		{88044BED-C78F-4423-8BE2-41E8F82EBA2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{88044BED-C78F-4423-8BE2-41E8F82EBA2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{88044BED-C78F-4423-8BE2-41E8F82EBA2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{88044BED-C78F-4423-8BE2-41E8F82EBA2A}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 6 - 0
CopyCenter/AuthorizationWindow.xaml

@@ -23,5 +23,11 @@
             <Image Margin="64,-190,346,165" Source="1536306136_user[1].png" Stretch="Fill" Height="24" />
             <Image Margin="278,-270,124,229" Source="w256h2561384699897signup[1].png" Stretch="Fill" RenderTransformOrigin="7.7,0.75"/>
          </StackPanel>
+        <Button HorizontalAlignment="Right" Margin="0,5,5,0" VerticalAlignment="Top" Width="40" Click="Exit_Click" Height="35">
+            <StackPanel>
+                <Image Source ="exit_png_456938.png" Height="32" Width="65"/>
+            </StackPanel>
+        </Button>
+        
     </Grid>
 </Window>

+ 19 - 22
CopyCenter/AuthorizationWindow.xaml.cs

@@ -29,39 +29,36 @@ namespace CopyCenter
 
         private void AuthorizationClick(object sender, RoutedEventArgs e)
         {
-            Auth(login.Text, password.Password);
-
-            //if (login.Text == "" || password.Password == "")
-            //{
-            //    MessageBox.Show("Введено неправильное значение");
-            //    return;
-            //}
-            //if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login.Text + " " + password.Password))
-            //{
-            //    MessageBox.Show("Добро пожаловать, вы авторизированы!");
-            //    MenuWindow mw = new MenuWindow();
-            //    mw.Show();
-            //    this.Close();
-            //}
-            //else
-            //{
-            //    MessageBox.Show("Введён неправильный логин/пароль");
-            //}
+           
+            if (login.Text == "" || password.Password == "")
+            {
+                MessageBox.Show("Введено неправильное значение");
+                return;
+            }
+            if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login.Text + " " + password.Password))
+            {
+                MessageBox.Show("Добро пожаловать, вы авторизированы!");
+                MenuWindow mw = new MenuWindow();
+                mw.Show();
+                this.Close();
+            }
+            else
+            {
+                MessageBox.Show("Введён неправильный логин/пароль");
+            }
         }
 
         private void Registration_Click(object sender, RoutedEventArgs e)
         {
             RegistrationWindow rw = new RegistrationWindow();
-            Auth(login.Text, password.Password)
             rw.Show();
             this.Close();
         }
 
-        private bool Auth(string login, string password)
+        private void Exit_Click(object sender, RoutedEventArgs e)
         {
-
+            Application.Current.Shutdown();
         }
 
-
     }
 }

+ 0 - 3
CopyCenter/ClientsWindow.xaml

@@ -29,8 +29,5 @@
         <TextBox Name="ID" HorizontalAlignment="Left" Height="31" Margin="205,303,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="146"/>
         <TextBlock Margin="74,303,624,0" TextWrapping="Wrap" Text="ID" VerticalAlignment="Top" Height="31" Width="94"/>
 
-
-
-
     </Grid>
 </Window>

+ 1 - 1
CopyCenter/ClientsWindow.xaml.cs

@@ -58,7 +58,7 @@ namespace CopyCenter
                 db.Clients.Remove(client);
                 db.SaveChanges();
                 MessageBox.Show("Успешно удалена услуга");
-                ClientsList.ItemsSource = db.Services.ToList();
+                ClientsList.ItemsSource = db.Clients.ToList();
             }
         }
 

+ 0 - 1
CopyCenter/MenuWindow.xaml

@@ -12,7 +12,6 @@
             <ImageBrush ImageSource="i39C1W5IB.jpg"/>
         </Grid.Background>
 
-
         <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="38,0,42,21">
             <Button Content="Клиенты" Width="120" Height="30" Margin="25,0,30,35" Background="#FF138DE2" FontSize="14" FontFamily="Century Gothic" Foreground="White" Click="Clients"/>
             <Button Content="Карты" Width="120" Height="30" Margin="5,0,30,35" Background="#FF138DE9" FontSize="14" FontFamily="Century Gothic" Foreground="White" Click="Cards"/>

+ 5 - 7
CopyCenter/OrdersWindow.xaml.cs

@@ -24,7 +24,6 @@ namespace CopyCenter
         public OrdersWindow()
         {
             InitializeComponent();
-            ShowOrder();
             db = new gr672_liiEntities();
             comboBox1.ItemsSource = db.Services.ToList();
             comboBox1.DisplayMemberPath = "NameService";
@@ -41,6 +40,7 @@ namespace CopyCenter
             comboBox3.ItemsSource = db.Payments.ToList();
             comboBox3.DisplayMemberPath = "NumberPayment";
             comboBox3.SelectedValuePath = "idPayment";
+            ShowOrder();
 
         }
 
@@ -83,7 +83,7 @@ namespace CopyCenter
                 db.Orders.Remove(order);
                 db.SaveChanges();
                 MessageBox.Show("Успешно удалён заказ");
-                OrdersList.ItemsSource = db.Services.ToList();
+                OrdersList.ItemsSource = db.Orders.ToList();
             }
         }
 
@@ -118,16 +118,14 @@ namespace CopyCenter
 
         public void ShowOrder()
         {
-            //int num = 0;
-            //int.TryParse(ID.Text, out num);
-            //var SelectOrders = db.Orders.Where(item => item.idOrder == num && (item.NumberOrder + " " + item.ViewOrder + " " + item.OrderDate + " " + item.idClient + " " + item.idService + " " + item.idUser + " " + item.idPayment).Contains(Search.Text));
-            //OrdersList.ItemsSource = SelectOrders.ToList();
+            var SelectOrders = db.Orders.Where(item => item.NumberOrder.ToString().Contains(Search.Text));
+            OrdersList.ItemsSource = SelectOrders.ToList();
 
         }
 
         private void Search_TextChanged(object sender, TextChangedEventArgs e)
         {
-            //ShowOrder();
+            ShowOrder();
         }
 
     }

+ 2 - 0
CopyCenter/RegistrationWindow.xaml.cs

@@ -61,5 +61,7 @@ namespace CopyCenter
             aw.Show();
             this.Close();
         }
+
+        
     }
 }